Details
-
Task
-
Resolution: Fixed
-
Critical - P2
-
None
-
None
Description
Description
I'm looking at https://docs.mongodb.com/manual/reference/command/cleanupOrphaned/#remove-all-orphaned-documents-from-a-shard
When put inside a script to run via the Mongo shell, it would be good to:
(1) print something to confirm that all the keys have been checked
(2) allow some sleep to slow down the loop and reduce any performance impact.
I suggest something like:
var loopSleep = 100; // milliseconds
|
var nextKey = { };
|
var result;
|
|
|
while ( nextKey != null ) {
|
result = db.adminCommand( { cleanupOrphaned: "test.user", startingFromKey: nextKey } );
|
|
|
if (result.ok != 1)
|
print("Unable to complete at this time: failure or timeout.");
|
|
|
printjson(result);
|
|
|
nextKey = result.stoppedAtKey;
|
|
|
if (loopSleep > 0) sleep(loopSleep); // allow tuning of performance impact
|
}
|
|
|
print("Orphan cleanup complete.");
|
Scope of changes
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
Attachments
Issue Links
- related to
-
DOCS-4723 Check for failure in cleanupOrphaned script
-
- Closed
-