Skip to content

Commit

Permalink
Merge pull request #79 from ml054/v5.4
Browse files Browse the repository at this point in the history
post sync bugfixes
  • Loading branch information
ml054 authored Oct 12, 2023
2 parents a9e6864 + a282db6 commit 2e1af8d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/ravendb/client/http/NodeSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void scheduleSpeedTest() {

private void ensureFastestNodeTimerExists() {
if (_updateFastestNodeTimer == null) {
_updateFastestNodeTimer = new Timer(this::switchToSpeedTestPhase, null, executorService);
_updateFastestNodeTimer = new Timer(this::switchToSpeedTestPhase, null, null, executorService);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/ravendb/client/primitives/Timer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public Timer(Runnable action, Duration dueTime, Duration period, ExecutorService
this.executorService = executorService;
this.action = action;
this.period = period;
schedule(dueTime);
if (dueTime != null) {
schedule(dueTime);
}
}

public void change(Duration dueTime) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/ravendb/client/ClusterTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public static void waitForIndexingInTheCluster(IDocumentStore store, String dbNa
new GetDatabaseRecordOperation(ObjectUtils.firstNonNull(dbName, store.getDatabase())));

for (String nodeTag : record.getTopology().getAllNodes()) {
waitForIndexing(store, dbName, timeout, nodeTag);
waitForIndexing(store, dbName, timeout, false, nodeTag);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/ravendb/client/IndexesTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void waitForIndexing(IDocumentStore store, String database, Duration time
}

public void waitForIndexing(IDocumentStore store, String database, Duration timeout, String nodeTag) {
RemoteTestBase.waitForIndexing(store, database, timeout, nodeTag);
RemoteTestBase.waitForIndexing(store, database, timeout, false, nodeTag);
}

public IndexErrors[] waitForIndexingErrors(IDocumentStore store, Duration timeout, String... indexNames) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void canListErrors() throws Exception {
session.saveChanges();
}

waitForIndexing(store, store.getDatabase());
waitForIndexing(store, store.getDatabase(), null, true, null);

waitForValue(() -> store.maintenance().send(new GetIndexErrorsOperation())[0].getErrors().length, 1);
waitForValue(() -> store.maintenance().send(new GetIndexErrorsOperation(new String[] { indexDef.getName() }))[0].getErrors().length, 1);
Expand Down
14 changes: 11 additions & 3 deletions src/test/java/net/ravendb/client/driver/RavenTestDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ public static void waitForIndexing(IDocumentStore store, String database) {
}

public static void waitForIndexing(IDocumentStore store, String database, Duration timeout) {
waitForIndexing(store, database, timeout, null);
waitForIndexing(store, database, timeout, false, null);
}

public static void waitForIndexing(IDocumentStore store, String database, Duration timeout, String nodeTag) {
public static void waitForIndexing(IDocumentStore store, String database, Duration timeout, boolean allowErrors, String nodeTag) {
MaintenanceOperationExecutor admin = store.maintenance().forDatabase(database);

if (timeout == null) {
Expand All @@ -212,7 +212,11 @@ public static void waitForIndexing(IDocumentStore store, String database, Durati
return;
}

if (Arrays.stream(databaseStatistics.getIndexes()).anyMatch(x -> IndexState.ERROR.equals(x.getState()))) {
long erroredIndexesCount = Arrays.stream(databaseStatistics.getIndexes()).filter(x -> IndexState.ERROR.equals(x.getState())).count();
if (allowErrors) {
// wait for all indexes to become non stale
} else if (erroredIndexesCount > 0) {
// have at least some errors
break;
}

Expand All @@ -223,6 +227,10 @@ public static void waitForIndexing(IDocumentStore store, String database, Durati
}
}

if (allowErrors) {
return;
}


IndexErrors[] errors = admin.send(new GetIndexErrorsOperation());
String allIndexErrorsText = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class DisableOnPullRequestCondition implements ExecutionCondition {

public static final String ENV_RAVEN_LICENSE = "RAVEN_LICENSE";
public static final String ENV_RAVEN_LICENSE = "RAVEN_License";

@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) {
Expand Down

0 comments on commit 2e1af8d

Please sign in to comment.