Skip to content

Commit

Permalink
SOLR-17015: Test and fix bug in MoveReplicaCmd for PRS collections
Browse files Browse the repository at this point in the history
backported from in-process upstream PR at:
(cherry picked from commit 34c289b4f91a1eb18c851049c74558ab4c4de600)
  • Loading branch information
magibney committed Oct 6, 2023
1 parent 38c7694 commit 2c01919
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public class ActiveReplicaWatcher implements CollectionStateWatcher {
private final List<String> solrCoreNames = new ArrayList<>();
private final List<Replica> activeReplicas = new ArrayList<>();

private int lastZkVersion = -1;

private SolrCloseableLatch latch;

/**
Expand Down Expand Up @@ -149,11 +147,6 @@ public synchronized boolean onStateChanged(Set<String> liveNodes, DocCollection
log.debug("-- already done, exiting...");
return true;
}
if (collectionState.getZNodeVersion() == lastZkVersion) {
log.debug("-- spurious call with already seen zkVersion= {}, ignoring...", lastZkVersion);
return false;
}
lastZkVersion = collectionState.getZNodeVersion();

for (Slice slice : collectionState.getSlices()) {
for (Replica replica : slice.getReplicas()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
*/
public class MoveReplicaTest extends AbstractMoveReplicaTestBase {

@Override
@Test
public void test() throws Exception {
super.test();
super.test(random().nextBoolean());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ protected String getConfigSet() {

@Test
public void testNormalMove() throws Exception {
inPlaceMove = false;
super.test();
super.test(inPlaceMove = false);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1806,9 +1806,11 @@ public void waitForState(
AtomicReference<DocCollection> docCollection = new AtomicReference<>();
CollectionStateWatcher watcher =
(n, c) -> {
docCollection.set(c);
boolean matches = predicate.matches(n, c);
if (matches) latch.countDown();
if (matches) {
docCollection.set(c);
latch.countDown();
}

return matches;
};
Expand Down
Loading

0 comments on commit 2c01919

Please sign in to comment.