Created
April 8, 2020 13:38
-
-
Save ks07/869229ea0fd26c6b0058f81427691070 to your computer and use it in GitHub Desktop.
Console log showing how to reproduce the mongodb oplog size bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[george@c7 ~]$ docker run --name mongo-server -d mongo:4.2.5 mongod --replSet rs0 | |
f6810e93af750a6d4520d9d708233b52ca5f5ace07d8aa6505e69a81fafbba56 | |
[george@c7 ~]$ docker cp mongo-bug/ f6810e93af75:/mongo-bug | |
[george@c7 ~]$ docker exec -it f6810e93af75 bash | |
root@f6810e93af75:/# ls mongo-bug/ | |
go.mod go.sum init largetx | |
root@f6810e93af75:/# echo "rs.initiate()" | mongo | |
MongoDB shell version v4.2.5 | |
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb | |
Implicit session: session { "id" : UUID("a6ae214c-7e7c-4cdb-94f0-5e678c52e822") } | |
MongoDB server version: 4.2.5 | |
{ | |
"info2" : "no configuration specified. Using a default configuration for the set", | |
"me" : "f6810e93af75:27017", | |
"ok" : 1, | |
"$clusterTime" : { | |
"clusterTime" : Timestamp(1586351017, 1), | |
"signature" : { | |
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), | |
"keyId" : NumberLong(0) | |
} | |
}, | |
"operationTime" : Timestamp(1586351017, 1) | |
} | |
bye | |
root@f6810e93af75:/# /mongo-bug/init/init | |
2020/04/08 13:03:54 Connecting to mongo... | |
2020/04/08 13:03:54 Connected, starting session... | |
root@f6810e93af75:/# /mongo-bug/largetx/largetx & mongodump --oplog | |
[1] 116 | |
2020-04-08T13:05:26.857+0000 writing admin.system.version to | |
2020-04-08T13:05:26.859+0000 done dumping admin.system.version (1 document) | |
2020-04-08T13:05:26.865+0000 writing foo.junk to | |
2020-04-08T13:05:29.810+0000 done dumping foo.junk (1000005 documents) | |
2020-04-08T13:05:29.869+0000 writing captured oplog to | |
2020-04-08T13:05:30.159+0000 dumped 7 oplog entries | |
[1]+ Done /mongo-bug/largetx/largetx | |
root@f6810e93af75:/# ls -lh dump/ | |
total 81M | |
drwxr-xr-x 2 root root 4.0K Apr 8 13:05 admin | |
drwxr-xr-x 2 root root 4.0K Apr 8 13:05 foo | |
-rw-r--r-- 1 root root 81M Apr 8 13:05 oplog.bson | |
root@f6810e93af75:/# bsondump dump/oplog.bson | |
{"ts":{"$timestamp":{"t":1586351109,"i":3}},"t":{"$numberLong":"1"},"h":{"$numberLong":"0"},"v":{"$numberInt":"2"},"op":"c","ns":"config.$cmd","ui":{"$binary":{"base64":"zJUkdrwhSAKm0SbCRajOEA==","subType":"04"}},"wall":{"$date":{"$numberLong":"1586351109590"}},"o":{"createIndexes":"system.sessions","v":{"$numberInt":"2"},"key":{"lastUse":{"$numberInt":"1"}},"name":"lsidTTLIndex","expireAfterSeconds":{"$numberInt":"1800"}}} | |
{"ts":{"$timestamp":{"t":1586351127,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"0"},"v":{"$numberInt":"2"},"op":"n","ns":"","wall":{"$date":{"$numberLong":"1586351127763"}},"o":{"msg":"periodic noop"}} | |
2020-04-08T13:05:40.841+0000 2 objects found | |
2020-04-08T13:05:40.841+0000 invalid BSONSize: 16777499 bytes | |
root@f6810e93af75:/# echo "db.dropDatabase()" | mongo foo | |
MongoDB shell version v4.2.5 | |
connecting to: mongodb://127.0.0.1:27017/foo?compressors=disabled&gssapiServiceName=mongodb | |
Implicit session: session { "id" : UUID("31e5d8ad-45df-407f-83c6-caaaf3895041") } | |
MongoDB server version: 4.2.5 | |
{ | |
"dropped" : "foo", | |
"ok" : 1, | |
"$clusterTime" : { | |
"clusterTime" : Timestamp(1586352438, 1), | |
"signature" : { | |
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), | |
"keyId" : NumberLong(0) | |
} | |
}, | |
"operationTime" : Timestamp(1586352438, 1) | |
} | |
bye | |
root@f6810e93af75:/# mongorestore --oplogReplay | |
2020-04-08T13:15:13.749+0000 using default 'dump' directory | |
2020-04-08T13:15:13.749+0000 preparing collections to restore from | |
2020-04-08T13:15:13.751+0000 reading metadata for foo.junk from dump/foo/junk.metadata.json | |
2020-04-08T13:15:13.762+0000 restoring foo.junk from dump/foo/junk.bson | |
2020-04-08T13:15:16.748+0000 [........................] foo.junk 4.55MB/131MB (3.5%) | |
2020-04-08T13:15:19.748+0000 [#.......................] foo.junk 8.74MB/131MB (6.7%) | |
2020-04-08T13:15:22.749+0000 [##......................] foo.junk 13.0MB/131MB (10.0%) | |
2020-04-08T13:15:25.751+0000 [###.....................] foo.junk 17.6MB/131MB (13.5%) | |
2020-04-08T13:15:28.752+0000 [####....................] foo.junk 22.1MB/131MB (16.9%) | |
2020-04-08T13:15:31.748+0000 [####....................] foo.junk 26.5MB/131MB (20.3%) | |
2020-04-08T13:15:34.748+0000 [#####...................] foo.junk 31.3MB/131MB (24.0%) | |
2020-04-08T13:15:37.748+0000 [######..................] foo.junk 36.1MB/131MB (27.7%) | |
2020-04-08T13:15:40.753+0000 [#######.................] foo.junk 40.7MB/131MB (31.2%) | |
2020-04-08T13:15:43.748+0000 [########................] foo.junk 45.4MB/131MB (34.8%) | |
2020-04-08T13:15:46.748+0000 [#########...............] foo.junk 49.7MB/131MB (38.1%) | |
2020-04-08T13:15:48.489+0000 [########################] foo.junk 131MB/131MB (100.0%) | |
2020-04-08T13:15:48.489+0000 no indexes to restore | |
2020-04-08T13:15:48.489+0000 finished restoring foo.junk (1000001 documents, 0 failures) | |
2020-04-08T13:15:48.489+0000 replaying oplog | |
2020-04-08T13:15:48.496+0000 applied 1 oplog entries | |
2020-04-08T13:15:48.496+0000 Failed: restore error: error reading oplog bson input: invalid BSONSize: 16777499 bytes | |
2020-04-08T13:15:48.496+0000 1000001 document(s) restored successfully. 0 document(s) failed to restore. | |
root@f6810e93af75:/# mongodump --db local --collection oplog.rs --out oplogdump | |
2020-04-08T13:24:05.094+0000 writing local.oplog.rs to | |
2020-04-08T13:24:08.083+0000 local.oplog.rs 716842 | |
2020-04-08T13:24:11.086+0000 local.oplog.rs 1384772 | |
2020-04-08T13:24:13.312+0000 local.oplog.rs 2000135 | |
2020-04-08T13:24:13.312+0000 done dumping local.oplog.rs (2000135 documents) | |
root@f6810e93af75:/# bsondump oplogdump/local/oplog.rs.bson >/dev/null | |
2020-04-08T13:25:36.175+0000 1000017 objects found | |
2020-04-08T13:25:36.176+0000 invalid BSONSize: 16777499 bytes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment