renamecollection or any action using renamecollection like aggregation in oplog drop all data on node in startup2 mode and restarts initial sync from mongo version 3.2.12 and this is up to all versions in 3.4. issue has fix in version 3.6
Related Jira :
https://jira.mongodb.org/browse/SERVER-38524
https://jira.mongodb.org/browse/SERVER-4941
Logs in mongo error log..
Tue Dec 11 11:16:42.601 E REPL [repl writer worker 9] Error applying command ({ ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o: { renameCollection: “xdb.tmp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }): OplogOperationUnsupported: Applying renameCollection not supported in initial sync: { ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o: { renameCollection: “xdb.t
mp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }
Tue Dec 11 11:16:42.601 E REPL [repl writer worker 9] Error applying command ({ ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o: { renameCollection: “xdb.tmp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }): OplogOperationUnsupported: Applying renameCollection not supported in initial sync: { ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o: { renameCollection: “xdb.t
mp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }
Tue Dec 11 11:16:42.601 E REPL [replication-221] Failed to apply batch due to ‘OplogOperationUnsupported: error applying batch: Applying renameCollection not supported in initial sync: { ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o: { renameCollection: “xdb.tmp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }’
Tue Dec 11 11:16:42.601 I REPL [replication-223] Finished fetching oplog during initial sync: CallbackCanceled: Callback canceled. Last fetched optime and hash: { ts: Timestamp 1544507199000|3, t: 18 }[-5401731233052630226]
Tue Dec 11 11:16:42.602 E REPL [replication-223] Initial sync attempt failed — attempts left: 7 cause: OplogOperationUnsupported: error applying batch: Applying renameCollection not supported in initial sync: { ts: Timestamp 1544373391000|135, t: 17, h: -4526450696875989552, v: 2, op: “c”, ns: “xdb.$cmd”, o:{ renameCollection: “xdb.tmp.agg_out.136”, to: “xdb.xcollection”, stayTemp: false, dropTarget: true } }
Tue Dec 11 11:16:43.602 I REPL [replication-222] Starting initial sync (attempt 4 of 10)
Tue Dec 11 11:16:43.620 I REPL [replication-222] sync source candidate: 172.29.126.139:27017
Tue Dec 11 11:16:43.689 I STORAGE [replication-222] dropAllDatabasesExceptLocal 4
Tue Dec 11 11:16:50.019 I REPL [replication-222] ******
Tue Dec 11 11:16:50.019 I REPL [replication-222] ******