Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.8' into 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 31, 2017
2 parents 2c8d28e + abc8ed3 commit 2714b43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Expand Up @@ -42,7 +42,6 @@
import org.jumpmind.symmetric.model.TriggerHistory;
import org.jumpmind.symmetric.model.TriggerRouter;
import org.jumpmind.symmetric.service.IParameterService;
import org.jumpmind.util.FormatUtils;

public class AuditTableDataRouter extends AbstractDataRouter implements IBuiltInExtensionPoint {

Expand Down Expand Up @@ -75,10 +74,11 @@ public Set<String> routeToNodes(SimpleRouterContext context, DataMetaData dataMe
Table auditTable = auditTables.get(tableName);
if (auditTable == null) {
auditTable = toAuditTable(table);
auditTables.put(tableName, auditTable);
if (parameterService.is(ParameterConstants.AUTO_CONFIGURE_DATABASE)) {
platform.alterTables(true, auditTable);
}
auditTable = platform.getTableFromCache(auditTable.getCatalog(), auditTable.getSchema(), auditTable.getName(), false);
auditTables.put(tableName, auditTable);
}
DatabaseInfo dbInfo = platform.getDatabaseInfo();
String auditTableName = auditTable.getQualifiedTableName(dbInfo.getDelimiterToken(),
Expand Down Expand Up @@ -115,12 +115,9 @@ public Set<String> routeToNodes(SimpleRouterContext context, DataMetaData dataMe
}

protected Table toAuditTable(Table table) {
IDatabasePlatform platform = engine.getDatabasePlatform();
Table auditTable = table.copy();
String tableName = engine.getDatabasePlatform().alterCaseToMatchDatabaseDefaultCase(table.getName());
if (!FormatUtils.isMixedCase(tableName)) {
tableName = tableName.toUpperCase();
}
auditTable.setName(String.format("%s_AUDIT", tableName));
auditTable.setName(String.format("%s_%s", auditTable.getName(), platform.alterCaseToMatchDatabaseDefaultCase("AUDIT")));
Column[] columns = auditTable.getColumns();
auditTable.removeAllColumns();
auditTable.addColumn(new Column(COLUMN_AUDIT_ID, true, Types.BIGINT, 0, 0));
Expand All @@ -131,9 +128,10 @@ protected Table toAuditTable(Table table) {
column.setPrimaryKey(false);
column.setAutoIncrement(false);
auditTable.addColumn(column);
}
}
auditTable.removeAllForeignKeys();
auditTable.removeAllIndices();
platform.alterCaseToMatchDatabaseDefaultCase(auditTable);
return auditTable;
}

Expand Down
2 changes: 1 addition & 1 deletion symmetric-core/src/main/resources/symmetric-schema.xml
Expand Up @@ -43,7 +43,7 @@
<column name="data_loader_type" type="VARCHAR" size="50" required="true" default="default" description="Identify the type of data loader this channel should use. Allows for the default dataloader to be swapped out via configuration for more efficient platform specific data loaders."/>
<column name="description" type="VARCHAR" size="255" description="Description on the type of data carried in this channel."/>
<column name="queue" type="VARCHAR" size="25" default="default" required="true" description="User provided queue name for channel to operate on. Creates multi-threaded channels. Defaults to 'default' thread"/>
<column name="max_network_kbps" type="DECIMAL" size="10,3" default="0.000" required="true" description="The maximum network transfer rate in kilobytes per second. Zero or negative means unlimited. When throttling the channel, make sure the channel is on its own queue or within a queue of channels that are throttled at the same rate. This is currently only implemented when staging is enabled."/>
<column name="max_network_kbps" type="DECIMAL" size="10,3" default="0.000" required="true" description="The maximum network transfer rate in kilobytes per second. Zero or negative means unlimited. Channels running in serial or parallel can have an effect on how much bandwidth can be used and when a channel will be processed. This is currently only implemented when staging is enabled."/>
<column name="data_event_action" type="CHAR" size="1" required="false" description="For a node group link with a data event action of B (both), select how to send changes to the target node group. (P = Push, W = Wait for Pull)" />
<column name="create_time" type="TIMESTAMP" description="Timestamp when this entry was created." />
<column name="last_update_by" type="VARCHAR" size="50" description="The user who last updated this entry." />
Expand Down

0 comments on commit 2714b43

Please sign in to comment.