Skip to content

Commit ecb9f2c

Browse files
committed
PBM-1398: handle renameCollection and convertToCapped commands
1 parent 6d394c4 commit ecb9f2c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pbm/oplog/restore.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ func (o *OplogRestore) isOpExcluded(oe *Record) bool {
327327
coll, _ = oe.Object[0].Value.(string)
328328
return o.excludeNS.Has(db + "." + coll)
329329
}
330+
// handle renameCollection and convertToCapped commands.
331+
// NOTE: convertToCapped is done by creating a temporary capped collection,
332+
// inserting docs from the source collection to the collection,
333+
// and renaming it to the source collection.
334+
if cmd == "renameCollection" {
335+
from, _ := oe.Object[0].Value.(string)
336+
if o.excludeNS.Has(from) {
337+
return true
338+
}
339+
to, _ := oe.Object[1].Value.(string)
340+
if o.excludeNS.Has(to) {
341+
return true
342+
}
343+
}
330344

331345
return false
332346
}

0 commit comments

Comments
 (0)