moved distributed database drop behind distributed lock
@@ -1461,6 +1461,37 @@ public class OHazelcastPlugin extends ODistributedAbstractPlugin
if (iDatabase.getStorage() instanceof OAutoshardedStorage
&& !((OAutoshardedStorage) iDatabase.getStorage()).isLocalEnv()) {
+ executeInDistributedDatabaseLock(
+ dbName,
+ 20000,
+ null,
+ (cfg) -> {
+ distributeDrop(dbName);
+ return null;
+ });
+ }
+
+ super.onDrop(iDatabase);
+
+ if (configurationMap != null) {
+ configurationMap.remove(OHazelcastPlugin.CONFIG_DBSTATUS_PREFIX + nodeName + "." + dbName);
+
+ if (!OScenarioThreadLocal.INSTANCE.isRunModeDistributed()) {
+ // LAST NODE HOLDING THE DATABASE, DELETE DISTRIBUTED CFG TOO
+ configurationMap.remove(OHazelcastPlugin.CONFIG_DATABASE_PREFIX + dbName);
+ configurationMap.remove(OAbstractSyncDatabaseTask.DEPLOYDB + dbName);
+ ODistributedServerLog.info(
+ this,
+ getLocalNodeName(),
+ null,
+ DIRECTION.NONE,
+ "Dropped last copy of database '%s', removing it from the cluster",
+ dbName);
+ }
+ }
+ }
+
+ private void distributeDrop(final String dbName) {
// DROP THE DATABASE ON ALL THE SERVERS
final ODistributedConfiguration dCfg = getDatabaseConfiguration(dbName);
@@ -1501,26 +1532,6 @@ public class OHazelcastPlugin extends ODistributedAbstractPlugin
}
}
- super.onDrop(iDatabase);
-
- if (configurationMap != null) {
- configurationMap.remove(OHazelcastPlugin.CONFIG_DBSTATUS_PREFIX + nodeName + "." + dbName);
-
- if (!OScenarioThreadLocal.INSTANCE.isRunModeDistributed()) {
- // LAST NODE HOLDING THE DATABASE, DELETE DISTRIBUTED CFG TOO
- configurationMap.remove(OHazelcastPlugin.CONFIG_DATABASE_PREFIX + dbName);
- configurationMap.remove(OAbstractSyncDatabaseTask.DEPLOYDB + dbName);
- ODistributedServerLog.info(
- this,
- getLocalNodeName(),
- null,
- DIRECTION.NONE,
- "Dropped last copy of database '%s', removing it from the cluster",
- dbName);
- }
- }
- }
-
public ODocument getNodeConfigurationByUuid(final String iNodeId, final boolean useCache) {
if (configurationMap == null)
// NOT YET STARTED
