Skip to content

Commit

Permalink
0000757: All tables are synchronized during a CREATE batch when initi…
Browse files Browse the repository at this point in the history
…al.load.create.first is true resulting in a lot of table missing
  • Loading branch information
chenson42 committed Aug 11, 2012
1 parent ab78724 commit f30c704
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 130 deletions.
Expand Up @@ -548,7 +548,7 @@ public void syncTriggers() {

public void forceTriggerRebuild() {
MDC.put("engineName", getEngineName());
triggerRouterService.syncTriggers(null, true);
triggerRouterService.syncTriggers(true);
}

public NodeStatus getNodeStatus() {
Expand Down
Expand Up @@ -80,9 +80,13 @@ public void afterWrite(DataContext context, Table table, CsvData data) {
}

private void recordSyncNeeded(DataContext context, Table table, CsvData data) {
if (isSyncTriggersNeeded(table) || data.getDataEventType() == DataEventType.CREATE) {
if (isSyncTriggersNeeded(table)) {
context.put(CTX_KEY_RESYNC_NEEDED, true);
}

if (data.getDataEventType() == DataEventType.CREATE) {
engine.getTriggerRouterService().syncTriggers(table, false);
}
}

private void recordJobManagerRestartNeeded(DataContext context, Table table, CsvData data) {
Expand Down
Expand Up @@ -462,18 +462,20 @@ public long toHashedValue() {
}

return hashedValue;
}

public boolean matches(Table table) {
return StringUtils.equals(sourceCatalogName, table.getCatalog())
&& StringUtils.equals(sourceSchemaName, table.getSchema())
&& table.getName().equalsIgnoreCase(sourceTableName);
}

public boolean isSame(Trigger trigger) {
return isSame(sourceCatalogName, trigger.sourceCatalogName)
&& isSame(sourceSchemaName, trigger.sourceSchemaName)
public boolean matches(Trigger trigger) {
return StringUtils.equals(sourceCatalogName, trigger.sourceCatalogName)
&& StringUtils.equals(sourceSchemaName, trigger.sourceSchemaName)
&& trigger.sourceTableName.equalsIgnoreCase(sourceTableName);
}

protected boolean isSame(String one, String two) {
return (one == null && two == null) || (one != null && two != null && one.equals(two));
}

@Override
public boolean equals(Object obj) {
if (obj instanceof Trigger && triggerId != null) {
Expand Down
Expand Up @@ -205,7 +205,7 @@ public boolean isPingBackEnabled() {
public boolean isSame(TriggerRouter triggerRouter) {
return (this.trigger == null && triggerRouter.trigger == null)
|| (this.trigger != null && triggerRouter.trigger != null && this.trigger
.isSame(triggerRouter.trigger))
.matches(triggerRouter.trigger))
&& (this.router == null && triggerRouter.router == null)
|| (this.router != null && triggerRouter.router != null && this.router
.equals(triggerRouter.router));
Expand Down
Expand Up @@ -136,7 +136,11 @@ public interface ITriggerRouterService {

public void saveTriggerRouter(TriggerRouter triggerRouter, boolean updateTriggerRouterTableOnly);

public void saveTriggerRouter(TriggerRouter triggerRouter);
public void saveTriggerRouter(TriggerRouter triggerRouter);

public void syncTriggers(Table table, boolean genAlways);

public void syncTriggers(boolean genAlways);

public void syncTriggers();

Expand Down

0 comments on commit f30c704

Please sign in to comment.