Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-8063

The cold standby client doesn't correctly handle backward references

    XMLWordPrintableJSON

Details

    Description

      The logic from StandbyClientSyncExecution#copySegmentHierarchyFromPrimary has a flaw when it comes to "backward references". Suppose we have the following data segment graph to be transferred from primary: S1, which references {S2, S3} and S3 which references S2. Then, the correct transfer order should be S2, S3 and S1.

      Going through the current logic employed by the method, here's what happens:

      Step 0: batch={S1}
      
      Step 1: visited={S1}, data={S1}, batch={S2, S3}, queued={S2, S3}
      
      Step 2: visited={S1, S2}, data={S2, S1}, batch={S3}, queued={S2, S3}
      
      Step 3: visited={S1, S2, S3}, data={S3, S2, S1}, batch={}, queued={S2, S3}.

      Therefore, at the end of the loop, the order of the segments to be transferred will be S3, S2, S1, which might trigger a SegmentNotFoundException when S3 is further processed, because S2 is missing on standby (see OAK-8006).

      /cc frm

      Attachments

        1. OAK-8063-03.patch
          5 kB
          Francesco Mari
        2. OAK-8063-02.patch
          6 kB
          Andrei Dulceanu
        3. OAK-8063.patch
          6 kB
          Andrei Dulceanu

        Issue Links

          Activity

            People

              adulceanu Andrei Dulceanu
              adulceanu Andrei Dulceanu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: