mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-49706 Repair should not write documents with duplicate keys to local.system collections
This commit is contained in:
parent
992cff8ecb
commit
5d8f238387
@ -13,7 +13,7 @@ load("jstests/libs/uuid_util.js");
|
|||||||
const baseName = "repair_duplicate_keys";
|
const baseName = "repair_duplicate_keys";
|
||||||
const localBaseName = "local";
|
const localBaseName = "local";
|
||||||
const collName = "test";
|
const collName = "test";
|
||||||
const lostAndFoundCollBaseName = "system.lost_and_found.";
|
const lostAndFoundCollBaseName = "lost_and_found.";
|
||||||
|
|
||||||
const dbpath = MongoRunner.dataPath + baseName + "/";
|
const dbpath = MongoRunner.dataPath + baseName + "/";
|
||||||
const indexName = "a_1";
|
const indexName = "a_1";
|
||||||
|
@ -224,8 +224,8 @@ StatusWith<std::pair<long long, long long>> IndexBuildsManager::startBuildingInd
|
|||||||
long long recordsRemoved = 0;
|
long long recordsRemoved = 0;
|
||||||
long long bytesRemoved = 0;
|
long long bytesRemoved = 0;
|
||||||
|
|
||||||
const NamespaceString lostAndFoundNss = NamespaceString(
|
const NamespaceString lostAndFoundNss =
|
||||||
NamespaceString::kLocalDb, "system.lost_and_found." + coll->uuid().toString());
|
NamespaceString(NamespaceString::kLocalDb, "lost_and_found." + coll->uuid().toString());
|
||||||
|
|
||||||
// Delete duplicate record and insert it into local lost and found.
|
// Delete duplicate record and insert it into local lost and found.
|
||||||
Status status = [&] {
|
Status status = [&] {
|
||||||
@ -400,9 +400,10 @@ StatusWith<MultiIndexBlock*> IndexBuildsManager::_getBuilder(const UUID& buildUU
|
|||||||
return builderIt->second.get();
|
return builderIt->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusWith<int> IndexBuildsManager::_moveRecordToLostAndFound(OperationContext* opCtx,
|
StatusWith<int> IndexBuildsManager::_moveRecordToLostAndFound(
|
||||||
NamespaceString nss,
|
OperationContext* opCtx,
|
||||||
NamespaceString lostAndFoundNss,
|
const NamespaceString& nss,
|
||||||
|
const NamespaceString& lostAndFoundNss,
|
||||||
RecordId dupRecord) {
|
RecordId dupRecord) {
|
||||||
invariant(opCtx->lockState()->isCollectionLockedForMode(nss, MODE_IX));
|
invariant(opCtx->lockState()->isCollectionLockedForMode(nss, MODE_IX));
|
||||||
|
|
||||||
|
@ -219,12 +219,12 @@ private:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes record containing duplicate keys and insert it into a local lost and found collection
|
* Deletes record containing duplicate keys and insert it into a local lost and found collection
|
||||||
* titled "local.system.lost_and_found.<original collection UUID>". Returns the size of the
|
* titled "local.lost_and_found.<original collection UUID>". Returns the size of the
|
||||||
* record removed.
|
* record removed.
|
||||||
*/
|
*/
|
||||||
StatusWith<int> _moveRecordToLostAndFound(OperationContext* opCtx,
|
StatusWith<int> _moveRecordToLostAndFound(OperationContext* opCtx,
|
||||||
NamespaceString ns,
|
const NamespaceString& ns,
|
||||||
NamespaceString lostAndFoundNss,
|
const NamespaceString& lostAndFoundNss,
|
||||||
RecordId dupRecord);
|
RecordId dupRecord);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user