2

A month ago, I have upgraded my mongodb cluster to version 4.4.1 from 3.6. Then recently mongodb shard migration failed with error 'aborted' as follows:

balancer:
Currently enabled:  yes
    Currently running:  no
    Failed balancer rounds in last 5 attempts:  0
    Migration Results for the last 24 hours: 
            2844 : Failed with error 'aborted', from mdbn1 to mdbn4
            2788 : Failed with error 'aborted', from mdbn1 to mdbn2
            2833 : Failed with error 'aborted', from mdbn1 to mdbn3

And I found it's caused from config.system.sessions collection as following log message

-- egrep -v '"s":"I"' /var/log/mongodb/mongod.log
{
    "t": {"$date": "2020-12-14T10:26:11.525-05:00" },
    "s": "W",
    "c": "SHARDING",
    "id": 23777,
    "ctx": "MoveChunk",
    "msg": "Error while doing moveChunk",
    "attr": {
        "error": "OperationFailed: Data transfer error: migrate failed: InvalidUUID: Cannot create collection config.system.sessions because we already have an identically named collection with UUID 587470bd-a60d-4f85-a56d-e31182c34d90, which differs from the donor's UUID 9a757a91-1335-4caf-8796-513271be534d. Manually drop the collection on this shard if it contains data from a previous incarnation of config.system.sessions"
    }
}

I have followed the above messages, tried to remove the system.sessions collection, but it failed because I am not authorized even I have loggeed in as a root.

I don't understand how to fix it. If you have any idea please share with me.

mdbn1:PRIMARY> db.system.sessions.remove({})
WriteCommandError({
    "operationTime" : Timestamp(1607966914, 12),
    "ok" : 0,
    "errmsg" : "not authorized on config to execute command { delete: \"system.sessions\", ordered: true, lsid: { id: UUID(\"c26b3641-62ac-4496-91b2-1b8eb76594e0\") }, $clusterTime: { clusterTime: Timestamp(1607966903, 15), signature: { hash: BinData(0, 4B67FC70E037CB8F6C421CA759595A68617D0F42), keyId: 6864366270343544833 } }, $db: \"config\" }",
    "code" : 13,
    "codeName" : "Unauthorized",
    "$gleStats" : {
        "lastOpTime" : Timestamp(0, 0),
        "electionId" : ObjectId("7fffffff0000000000000042")
    },
    "lastCommittedOpTime" : Timestamp(1607966914, 12),
    "$configServerState" : {
        "opTime" : {
            "ts" : Timestamp(1607966914, 13),
            "t" : NumberLong(32)
        }
    },
    "$clusterTime" : {
        "clusterTime" : Timestamp(1607966917, 2),
        "signature" : {
            "hash" : BinData(0,"DQyhmJK4/XZVnIJv8Oj8lWg/PhE="),
            "keyId" : NumberLong("6864366270343544833")
        }
    }
})
jelongpark
  • 61
  • 4

0 Answers0