Skip to content

Commit

Permalink
0005675: Bidirectional sync causes need for trigger to be re-built on
Browse files Browse the repository at this point in the history
target side if table does not exist
  • Loading branch information
catherinequamme committed Jan 31, 2023
1 parent 499b19e commit 385f8e8
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -42,6 +42,7 @@
import org.jumpmind.symmetric.model.IncomingBatch;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.NodeSecurity;
import org.jumpmind.symmetric.model.TableReloadRequest;
import org.jumpmind.symmetric.model.TableReloadStatus;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.IParameterService;
Expand All @@ -62,6 +63,7 @@ public class ConfigurationChangedDatabaseWriterFilter extends DatabaseWriterFilt
private static final String CTX_KEY_MY_NODE_ID = "MyNodeId." + SUFFIX;
private static final String CTX_KEY_MY_NODE_SECURITY = "MyNodeSecurity." + SUFFIX;
private static final String CTX_KEY_CANCEL_LOAD = "CancelLoad." + SUFFIX;
private static final String CTX_KEY_INITAL_LOAD_ID = "InitialLoadId." + SUFFIX;
private ISymmetricEngine engine;
private ConfigurationChangedHelper helper;
private String tablePrefixLower;
Expand Down Expand Up @@ -139,6 +141,7 @@ public void afterWrite(DataContext context, Table table, CsvData data) {
}
if (isInitialLoadComplete) {
context.put(CTX_KEY_INITIAL_LOAD_COMPLETED, true);
context.put(CTX_KEY_INITAL_LOAD_ID, Long.parseLong(newData.get("INITIAL_LOAD_ID")));
}
}
if (matchesTable(table, TableConstants.SYM_NODE_SECURITY)) {
Expand Down Expand Up @@ -201,13 +204,18 @@ public void syncEnded(DataContext context, List<IncomingBatch> batchesProcessed,
engine.getTriggerRouterService().syncTriggers(new ArrayList<Table>(tables), false);
}
if (context.remove(CTX_KEY_INITIAL_LOAD_COMPLETED) != null) {
log.info("Initial load ended for me");
long loadId = (long) context.remove(CTX_KEY_INITAL_LOAD_ID);
log.info("Initial load ended for load ID {}", loadId);
if (hasClientReloadListener(context)) {
List<IClientReloadListener> listeners = engine.getExtensionService().getExtensionPointList(IClientReloadListener.class);
for (IClientReloadListener listener : listeners) {
listener.reloadCompleted();
}
}
TableReloadRequest currLoad = engine.getDataService().getTableReloadRequest(loadId);
if (currLoad != null && currLoad.isCreateTable()) {
engine.getTriggerRouterService().syncTriggers();
}
}
@SuppressWarnings("unchecked")
List<Long> loadIds = (List<Long>) context.get(CTX_KEY_CANCEL_LOAD);
Expand Down

0 comments on commit 385f8e8

Please sign in to comment.