Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-4354

Replication should perform full copy if slave's generation higher than master's

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 4.1
    • Fix Version/s: 4.2
    • Component/s: replication (java)
    • Labels:
      None

      Description

      We have dual masters each incrementally indexing from our MySQL database and sit behind a virtual hostname in our load balancer. As such, it's possible that the generation numbers between the masters for a given index are not in sync. Slaves are configured to replicate from this virtual host (and pin based on source/dest IP hash) so we can add and remove masters as necessary (great for maintenance).

      For the most part this works but we've seen the following happen:

      • Slave has been pulling from master A
      • Master A goes down for maint and now will pull from master B (which has a lower generation number for some reason than master A).
      • Slave now tries to pull from master B (has higher index version than slave but lower generation).
      • Slave downloads index files, moves them to the index/ directory but these files are deleted during the doCommit() phase (looks like older generation data is deleted).
      • Index remains as-is and no change.
      1. SOLR-4354.patch
        0.9 kB
        Amit Nithian

        Issue Links

          Activity

          Hide
          thetaphi Uwe Schindler added a comment -

          Closed after release.

          Show
          thetaphi Uwe Schindler added a comment - Closed after release.
          Hide
          markrmiller@gmail.com Mark Miller added a comment -

          No worries Amit - looks like this was a dupe of SOLR-4303.

          Show
          markrmiller@gmail.com Mark Miller added a comment - No worries Amit - looks like this was a dupe of SOLR-4303 .
          Hide
          anithian Amit Nithian added a comment -

          My apologies that was embarrassing. I was looking at the 4.0 code that we use and not the 4.1 code which has this fixed. I blindly copied my code to trunk without doing a proper code refresh (so much for late night working).

          Again please accept my apologies.

          Show
          anithian Amit Nithian added a comment - My apologies that was embarrassing. I was looking at the 4.0 code that we use and not the 4.1 code which has this fixed. I blindly copied my code to trunk without doing a proper code refresh (so much for late night working). Again please accept my apologies.
          Hide
          shalinmangar Shalin Shekhar Mangar added a comment -

          Amit, I don't complete understand the problem.

          Slave now tries to pull from master B (has higher index version than slave but lower generation)

          Say, slave has generation G and version V and master(B) has a higher version V+1 but lower generation G-1. The code right now says:

          boolean isFullCopyNeeded = IndexDeletionPolicyWrapper
                     .getCommitTimestamp(commit) >= latestVersion
          -          || commit.getGeneration() >= latestGeneration || forceReplication;
          

          Since master's generation is lower than slave, a full copy will be forced here. Further, your patch has:

          -          || commit.getGeneration() >= latestGeneration || forceReplication;
          +          || commit.getGeneration() >= latestGeneration || (commit.getGeneration() > latestGeneration) || forceReplication;
          

          I don't see how that changes anything. The second condition on generation is redundant. Did I miss something?

          Show
          shalinmangar Shalin Shekhar Mangar added a comment - Amit, I don't complete understand the problem. Slave now tries to pull from master B (has higher index version than slave but lower generation) Say, slave has generation G and version V and master(B) has a higher version V+1 but lower generation G-1. The code right now says: boolean isFullCopyNeeded = IndexDeletionPolicyWrapper .getCommitTimestamp(commit) >= latestVersion - || commit.getGeneration() >= latestGeneration || forceReplication; Since master's generation is lower than slave, a full copy will be forced here. Further, your patch has: - || commit.getGeneration() >= latestGeneration || forceReplication; + || commit.getGeneration() >= latestGeneration || (commit.getGeneration() > latestGeneration) || forceReplication; I don't see how that changes anything. The second condition on generation is redundant. Did I miss something?
          Hide
          anithian Amit Nithian added a comment -

          My fix will force a full copy if the slave's generation is greater than the master's generation.

          Show
          anithian Amit Nithian added a comment - My fix will force a full copy if the slave's generation is greater than the master's generation.

            People

            • Assignee:
              markrmiller@gmail.com Mark Miller
              Reporter:
              anithian Amit Nithian
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development