Hi guys,
I have question regarding Compact command on mongo 4.4.2.
The documentation says that in v.4.4 the compact command is not blocking CRUD operations to the collection and in the case of replicaset it doesn’t change the state from secondary to recovering.
But in my case it does.
I am doing something different?
The command is:
db.runCommand({compact: “collectiontocompact”})
Before v4.4,
compact
forced the secondary to enterRECOVERING
state during its execution, which caused read operations from clients to fail. Starting in v4.4,compact
does not change the run state of the secondary, and clients may continue to read from the secondary during the compaction operation.
{“t”:{“$date”:“2021-01-27T06:44:06.438-05:00”},“s”:“I”, “c”:“REPL”, “id”:21350, “ctx”:“conn58”,“msg”:“Going into maintenance mode”,“attr”:{“otherMaintenanceModeTasksInProgress”:0}}
{“t”:{“$date”:“2021-01-27T06:44:06.439-05:00”},“s”:“I”, “c”:“REPL”, “id”:21358, “ctx”:“conn58”,“msg”:“Replica set state transition”,“attr”:{“newState”:“RECOVERING”,“oldState”:“SECONDARY”}}
{“t”:{“$date”:“2021-01-27T06:44:06.439-05:00”},“s”:“I”, “c”:“REPL”, “id”:21106, “ctx”:“conn58”,“msg”:“Resetting sync source to empty”,“attr”:{“previousSyncSource”:“1.1.1.1:27017”}}
{“t”:{“$date”:“2021-01-27T06:44:06.439-05:00”},“s”:“I”, “c”:“COMMAND”, “id”:20284, “ctx”:“conn58”,“msg”:“Compact begin”,“attr”:{“namespace”:“db.collection”}}