Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-68503

Revisit oplog format for op=n no-op entry for $wouldChangeOwningShard

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Cluster Scalability
    • 3

      As part of SERVER-67492, it was found that the following "op" = "n" oplog entry with empty "o2" field and "o" value as "$wouldChangeOwningShard" : 1 is created when "featureFlagUpdateDocumentShardKeyUsingTransactionApi" feature flag is set for "findAndModify" command:

      {
      	"lsid" : {
      		"id" : UUID("d7bf4672-6df6-4ab3-9aa5-738a68c4fbb2"),
      		"uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
      	},
      	"txnNumber" : NumberLong(62),
      	"op" : "n",
      	"ns" : "test0_fsmdb0.fsmcoll0",
      	"ui" : UUID("723d67f7-ce95-4812-9171-07c39130c567"),
      	"o" : {
      		"$wouldChangeOwningShard" : 1
      	},
      	"o2" : {
      
      	},
      	"stmtId" : 0,
      	"fromMigrate" : true,
      	"ts" : Timestamp(1658761337, 107),
      	"t" : NumberLong(1),
      	"v" : NumberLong(2),
      	"wall" : ISODate("2022-07-25T15:02:17.027Z"),
      	"prevOpTime" : {
      		"ts" : Timestamp(0, 0),
      		"t" : NumberLong(-1)
      	}
      } 

      On the other hand, "op" = "n" with an empty "o2" field and "fromMigrate:true" indicates a pre/postImage oplog entry which can be easily mixed together with "$wouldChangeOwningShard" : 1 case above:

      {
              "lsid" : {
                      "id" : UUID("77972370-47d2-40c6-a786-c91e17c90e9c"),
                      "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
              },
              "txnNumber" : NumberLong(30),
              "op" : "n",
              "ns" : "test5_fsmdb0.fsmcoll0",
              "ui" : UUID("9b26f8b6-ab52-4d92-8309-7ca77213d083"),
              "o" : {
                      "_id" : 450,
                      "skey" : 511,
                      "tid" : 2,
                      "counter" : 1
              },
              "o2" : {
       
              },
              "stmtId" : 0,
              "fromMigrate" : true,
              "ts" : Timestamp(1654658045, 197),
              "t" : NumberLong(34),
              "v" : NumberLong(2),
              "wall" : ISODate("2022-06-08T03:14:05.522Z"),
              "prevOpTime" : {
                      "ts" : Timestamp(0, 0),
                      "t" : NumberLong(-1)
              }
      } 

      It would be great if we can consolidate oplog format to avoid handling special cases in code in order to make the code more maintainable over time.

       

            Assignee:
            backlog-server-cluster-scalability [DO NOT USE] Backlog - Cluster Scalability
            Reporter:
            abdul.qadeer@mongodb.com Abdul Qadeer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: