diff options
author | nehakhatri5 <neha.khatri@mongodb.com> | 2018-10-13 06:22:07 +1100 |
---|---|---|
committer | nehakhatri5 <neha.khatri@mongodb.com> | 2018-10-16 08:33:27 +1100 |
commit | 9693ebbdb9a0098dbcd894a739218ae30238c72d (patch) | |
tree | d5cbeb69426fc184d09e3ff32a64137beb95a037 /src/mongo/db | |
parent | d90876a3346e84fb75d8f21b21e9754d78e242e4 (diff) | |
download | mongo-9693ebbdb9a0098dbcd894a739218ae30238c72d.tar.gz |
SERVER-37555 Abort of collMod need not refreshEntry for index on rollback.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/catalog/coll_mod.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp index 295c65979c8..bc7061147aa 100644 --- a/src/mongo/db/catalog/coll_mod.cpp +++ b/src/mongo/db/catalog/coll_mod.cpp @@ -67,6 +67,8 @@ namespace { // databases if none are provided). MONGO_FAIL_POINT_DEFINE(hangBeforeDatabaseUpgrade); +MONGO_FAIL_POINT_DEFINE(assertAfterIndexUpdate); + struct CollModRequest { const IndexDescriptor* idx = nullptr; BSONElement indexExpireAfterSeconds = {}; @@ -398,11 +400,14 @@ Status _collModInternal(OperationContext* opCtx, // Notify the index catalog that the definition of this index changed. cmr.idx = coll->getIndexCatalog()->refreshEntry(opCtx, cmr.idx); result->appendAs(newExpireSecs, "expireAfterSeconds_new"); - opCtx->recoveryUnit()->onRollback([ opCtx, idx = cmr.idx, coll ]() { - coll->getIndexCatalog()->refreshEntry(opCtx, idx); - }); + + if (MONGO_FAIL_POINT(assertAfterIndexUpdate)) { + log() << "collMod - assertAfterIndexUpdate fail point enabled."; + uasserted(50968, "trigger rollback after the index update"); + } } + // Save previous TTL index expiration. ttlInfo = TTLCollModInfo{Seconds(newExpireSecs.safeNumberLong()), Seconds(oldExpireSecs.safeNumberLong()), @@ -444,8 +449,10 @@ Status _collModInternal(OperationContext* opCtx, // Refresh the in-memory instance of the index. desc = coll->getIndexCatalog()->refreshEntry(opCtx, desc); - opCtx->recoveryUnit()->onRollback( - [opCtx, desc, coll]() { coll->getIndexCatalog()->refreshEntry(opCtx, desc); }); + if (MONGO_FAIL_POINT(assertAfterIndexUpdate)) { + log() << "collMod - assertAfterIndexUpdate fail point enabled."; + uasserted(50969, "trigger rollback for unique index update"); + } } } |