I am facing issue while running hot backup for Percona Server for Mongodb (4.0.21-16.bionic). While trying to do a basic hotbackup it fails as below
rs01:SECONDARY> use admin;
switched to db admin
rs01:SECONDARY> db.runCommand({createBackup: 1, backupDir: "/home/ubuntu/hotbackups"})
{
"ok" : 0,
"errmsg" : "22: Invalid argument",
"operationTime" : Timestamp(1611676494, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1611676524, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
I have disabled write to this secondary prior to above step by running db.fsyncLock()
. Weird thing is that it works when if I run this createBackup
command without locking for write.
rs01:SECONDARY> use admin;
switched to db admin
rs01:SECONDARY>
rs-okan:SECONDARY> db.runCommand({createBackup: 1, backupDir: "/home/ubuntu/hotbackups"})
{
"ok" : 1,
"operationTime" : Timestamp(1611674674, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1611674674, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
Looking at mongodb logs I see this
{
"t": {
"$date": "2021-01-26T23:50:12.122+05:30"
},
"s": "E",
"c": "STORAGE",
"id": 22435,
"ctx": "conn44",
"msg": "WiredTiger error",
"attr": {
"error": 22,
"message": "[1611685212:122119][9907:0x7eff1574d700], WT_SESSION.open_cursor: __backup_start, 615: there is already a backup cursor open: Invalid argument"
}
}
I know createBackup
was added in 4.2+ and we should upgrade our mongo version but current it is a bit difficult. Fyi. To confirm this is not issue with MongoDB 4.0 , I tried this same on Percona Server for mongoDB 4.4 and it is same issue. So I’m guessing it is not something with older version of MongoDB. I might be missing something very silly here.
If anyone encountered this before or suggest for resolution. Thanks.