Skip to content

Commit

Permalink
fix: skip the health check if the database is on sync, issues #10383, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Jan 17, 2025
1 parent 1b0611b commit 6ef186e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.hazelcast.core.HazelcastInstanceNotActiveException;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.OSystemDatabase;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.tx.OTransactionSequenceStatus;
import com.orientechnologies.orient.distributed.db.OrientDBDistributed;
Expand Down Expand Up @@ -98,6 +97,9 @@ private void checkServerConfig() {
// NO NODES CONFIGURED: CHECK IF THERE IS ANY MISCONFIGURATION BY CHECKING THE DATABASE STATUSES
OrientDBDistributed context = (OrientDBDistributed) manager.getServerInstance().getDatabases();
for (String databaseName : manager.getDatabases()) {
if (manager.isSyncronizing(databaseName)) {
continue;
}
final ODistributedConfiguration cfg = context.getDistributedConfiguration(databaseName);
if (cfg == null) {
continue;
Expand Down Expand Up @@ -203,14 +205,14 @@ private void checkServerStatus() {

OrientDBDistributed context = (OrientDBDistributed) server.getDatabases();
for (String dbName : manager.getDatabases()) {
if (manager.isSyncronizing(dbName)) {
continue;
}
final ODistributedServerManager.DB_STATUS localNodeStatus =
manager.getDatabaseStatus(manager.getLocalNodeName(), dbName);
if (localNodeStatus != ODistributedServerManager.DB_STATUS.NOT_AVAILABLE)
// ONLY NOT_AVAILABLE NODE/DB CAN BE RECOVERED
continue;
if (OSystemDatabase.SYSTEM_DB_NAME.equalsIgnoreCase(dbName))
// SKIP SYSTEM DATABASE FROM HEALTH CHECK
continue;

final Set<String> servers = manager.getAvailableNodeNames(dbName);
servers.remove(manager.getLocalNodeName());
Expand Down Expand Up @@ -257,6 +259,9 @@ private void checkServerInStall() {
return;

for (String dbName : manager.getDatabases()) {
if (manager.isSyncronizing(dbName)) {
continue;
}
final ODistributedServerManager.DB_STATUS localNodeStatus =
manager.getDatabaseStatus(manager.getLocalNodeName(), dbName);
if (localNodeStatus != ODistributedServerManager.DB_STATUS.ONLINE)
Expand Down Expand Up @@ -300,14 +305,14 @@ private void notifyDatabaseSequenceStatus() {
if (!manager.getServerInstance().isActive()) return;

for (String dbName : manager.getDatabases()) {
if (manager.isSyncronizing(dbName)) {
continue;
}
final ODistributedServerManager.DB_STATUS localNodeStatus =
manager.getDatabaseStatus(manager.getLocalNodeName(), dbName);
if (localNodeStatus != ODistributedServerManager.DB_STATUS.ONLINE)
// ONLY NOT_AVAILABLE NODE/DB CAN BE RECOVERED
continue;
if (OSystemDatabase.SYSTEM_DB_NAME.equalsIgnoreCase(dbName))
// SKIP SYSTEM DATABASE FROM HEALTH CHECK
continue;

final List<String> servers = manager.getOnlineNodesNotLocal(dbName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,10 @@ public boolean installDatabase(
}
}

public boolean isSyncronizing(String databaseName) {
return this.installingDatabases.contains(databaseName);
}

public Boolean internalInstallDatabase(
final boolean iStartup,
final String databaseName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,6 @@ default void messageProcessEnd(ODistributedRequest iRequest, Object responsePayl
ODocument getOnlineDatabaseConfiguration(String databaseName);

Set<String> getDatabases();

boolean isSyncronizing(String databaseName);
}

0 comments on commit 6ef186e

Please sign in to comment.