-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
RSS Sydney
-
Fully Compatible
-
v8.0
-
RSS Sydney - 2024-06-11, RSS Sydney - 2024-06-25
Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.runCommand({compact: "foo", dryRun: true}) MongoServerError: will not run compact on an active replica set primary as this will slow down other running operations. use force:true to force
While this error makes sense if you're actually running compact, this is just a dry run.
Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.runCommand({compact: "foo", dryRun: true, force:true}) { bytesFreed: 0, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1715669461, i: 1 }), signature: { hash: Binary(Buffer.from("b766c9c60438b2e7eb0d4fadee3e549a15a5dc17", "hex"), 0), keyId: Long("7368697861568987141") } }, operationTime: Timestamp({ t: 1715669461, i: 1 }) }
It's a little difficult to tell if this actually did a dry run, or actually ran - I did see a smaller freeStorageSize after running this command even though it was only meant to be a dry run.
Later I ran it again, and got an actual number – but no change in freeStorageSize
Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.foo.stats().freeStorageSize 1908318208 Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.runCommand({compact: "foo", dryRun: true}) MongoServerError: will not run compact on an active replica set primary as this will slow down other running operations. use force:true to force Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.runCommand({compact: "foo", dryRun: true, force:true}) { bytesFreed: 921612288, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1715670141, i: 1 }), signature: { hash: Binary(Buffer.from("dc32ed7e4f54c2ed1d5b5c0481b90af04b8bbe2c", "hex"), 0), keyId: Long("7368697861568987141") } }, operationTime: Timestamp({ t: 1715670141, i: 1 }) } Atlas atlas-ktz9lc-shard-0 [primary] mydb> db.foo.stats().freeStorageSize 1908318208