|
39 | 39 | #include "mongo/db/index/hash_access_method.h" |
40 | 40 | #include "mongo/db/index/haystack_access_method.h" |
41 | 41 | #include "mongo/db/index/s2_access_method.h" |
| 42 | +#include "mongo/db/pdfile_version.h" |
42 | 43 | #include "mongo/db/server_parameters.h" |
| 44 | +#include "mongo/db/storage/data_file.h" |
43 | 45 | #include "mongo/db/structure/catalog/namespace_details.h" |
44 | 46 | #include "mongo/db/structure/catalog/namespace_details_collection_entry.h" |
45 | 47 | #include "mongo/db/structure/catalog/namespace_details_rsv1_metadata.h" |
@@ -324,6 +326,41 @@ namespace mongo { |
324 | 326 |
|
325 | 327 | } |
326 | 328 |
|
| 329 | + bool MMAP1DatabaseCatalogEntry::isOlderThan24( OperationContext* opCtx ) const { |
| 330 | + if ( _extentManager.numFiles() == 0 ) |
| 331 | + return false; |
| 332 | + |
| 333 | + int major = 0; |
| 334 | + int minor = 0; |
| 335 | + |
| 336 | + _extentManager.getFileFormat( opCtx, &major, &minor ); |
| 337 | + |
| 338 | + invariant( major == PDFILE_VERSION ); |
| 339 | + |
| 340 | + return minor == PDFILE_VERSION_MINOR_22_AND_OLDER; |
| 341 | + } |
| 342 | + |
| 343 | + void MMAP1DatabaseCatalogEntry::markIndexSafe24AndUp( OperationContext* opCtx ) { |
| 344 | + if ( _extentManager.numFiles() == 0 ) |
| 345 | + return; |
| 346 | + |
| 347 | + int major = 0; |
| 348 | + int minor = 0; |
| 349 | + |
| 350 | + _extentManager.getFileFormat( opCtx, &major, &minor ); |
| 351 | + |
| 352 | + invariant( major == PDFILE_VERSION ); |
| 353 | + |
| 354 | + if ( minor == PDFILE_VERSION_MINOR_24_AND_NEWER ) |
| 355 | + return; |
| 356 | + |
| 357 | + invariant( minor == PDFILE_VERSION_MINOR_22_AND_OLDER ); |
| 358 | + |
| 359 | + DataFile* df = _extentManager.getFile( opCtx, 0 ); |
| 360 | + opCtx->recoveryUnit()->writingInt(df->getHeader()->versionMinor) = |
| 361 | + PDFILE_VERSION_MINOR_24_AND_NEWER; |
| 362 | + } |
| 363 | + |
327 | 364 | void MMAP1DatabaseCatalogEntry::getCollectionNamespaces( std::list<std::string>* tofill ) const { |
328 | 365 | _namespaceIndex.getCollectionNamespaces( tofill ); |
329 | 366 | } |
|
0 commit comments