Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-60930

[BP 7.2.5] - XDCR - MergeNewTasks of backfillSpec can append a null task in the tasks list

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.2.5
    • 7.6.0, 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.0.4, 7.1.4, 7.0.5, 7.1.0, 7.1.1, 7.1.2, 7.2.0, 7.1.3, 7.2.1, 7.1.5, 7.2.4, 7.0.6, 7.1.7, 7.2.2, 7.1.6, 7.2.3
    • XDCR
    • Untriaged
    • 0
    • Unknown

    Description

      Note that BackfillTasks.addTasks() assumes that the the task input is non-nil. 
      BackfillReplicationSpec.MergeNewTasks will invoke MergeIncomingTaskIntoTasksNoLock, which will recursively compute the unmergeable tasks so that that unmergeable tasks can be appended to the tasksList using addTasks(). 

      Consider the following scenarios:

      1. There already exists a task in the VBTasksMap of the spec - say (a, b) and we have a new incoming task to be merged - say (c, d), with d > b; a < c < b. Example: (a, b) = (5, 5000) and (c, d) = (6, 5005). Now as per variable names in MergeIncomingTaskIntoTasksNoLock, subtask1 is nil and subtask2 is non-nil and MergeIncomingTaskIntoTasksNoLock is called recursively on subtask1 and subtask2. Focusing on subtask1, since there are no more tasks in the spec's VBTasksMap, it will append nil into the unmergeable tasks list, which will eventually be added to the VBTasksMap via addTasks()
      2. The same as (1), but now consider c < a; a < d < b. Example: (a, b) = (5, 5000) and (c, d) = (0, 10) => here subtask2 will be nil and cause nil to be appended to vbTasks list.

      Having said that, as far as I have seen so far, we do have checks to see if the task is nil when a task is read from the map to be backfilled, say in dcp_nozzle, so this isn't a big issue. But might be worth fixing this to avoid false positives in terms of tasks left when looking for tasks left to backfill (the list might be full of null spammed) and during debugging a customer issue.

      [metakv:debug,2024-02-16T18:38:22.825Z,ns_1@10.31.218.165:simple_store_xdcr_ckpt_data<0.4104.0>:simple_store:update_store:122]Updating data [{<<"/ckpt/backfill/131ebbfa0219141edb96959da571129c/Common/Common/spec">>,                <<"{\"id\":\"131ebbfa0219141edb96959da571129c/Common/Common\",\"internalId\":\"6ZMG3f9F0qryeeZNysN_Ag==\",\"VBTasksMap\":{\"0\":{\"List\":[{\"Timestamps\":{\"StartingTimestamp\":{\"Vbno\":0,\"Vbuuid\":0,\"Seqno\":0,\"SnapshotStart\":0,\"SnapshotEnd\":0,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}},\"EndingTimestamp\":{\"Vbno\":0,\"Vbuuid\":0,\"Seqno\":307516,\"SnapshotStart\":307516,\"SnapshotEnd\":307516,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}}},\"RequestedCollectionsShas\":[\"6fd17942b525b69049600dd0842a8e928d8bc80269a4c36cb006230f41659979\"]},null,null,null,null,null,null,null,{\"Timestamps\":{\"StartingTimestamp\":{\"Vbno\":0,\"Vbuuid\":0,\"Seqno\":0,\"SnapshotStart\":0,\"SnapshotEnd\":0,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}},\"EndingTimestamp\":{\"Vbno\":0,\"Vbuuid\":0,\"Seqno\":38668,\"SnapshotStart\":38668,\"SnapshotEnd\":38668,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}}},\"RequestedCollectionsShas\":[\"6fd17942b525b69049600dd0842a8e928d8bc80269a4c36cb006230f41659979\"]},null]},\"1\":{\"List\":[null,null,null,{\"Timestamps\":{\"StartingTimestamp\":{\"Vbno\":1,\"Vbuuid\":0,\"Seqno\":0,\"SnapshotStart\":0,\"SnapshotEnd\":0,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}},\"EndingTimestamp\":{\"Vbno\":1,\"Vbuuid\":0,\"Seqno\":92006,\"SnapshotStart\":92006,\"SnapshotEnd\":92006,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}}},\"RequestedCollectionsShas\":[\"6fd17942b525b69049600dd0842a8e928d8bc80269a4c36cb006230f41659979\"]},null]},\"10\":{\"List\":[null,null,null,null,null,null,null,null,{\"Timestamps\":{\"StartingTimestamp\":{\"Vbno\":10,\"Vbuuid\":0,\"Seqno\":0,\"SnapshotStart\":0,\"SnapshotEnd\":0,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}},\"EndingTimestamp\":{\"Vbno\":10,\"Vbuuid\":0,\"Seqno\":319573,\"SnapshotStart\":319573,\"SnapshotEnd\":319573,\"ManifestIDs\":{\"SourceManifestId\":0,\"TargetManifestId\":0}}},\"RequestedCollectionsShas\":[\"6fd17942b525b69049600dd0842a8e928d8bc80269a4c36cb006230f41659979\"]},null]}

      Attachments

        Issue Links

          Activity

            People

              ayush.nayyar Ayush Nayyar
              sumukh.bhat Sumukh Bhat
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty