Skip to content

Commit

Permalink
Remove inactive_time from sym_trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Nov 17, 2009
1 parent 46d76b0 commit c9b6c52
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 73 deletions.
14 changes: 1 addition & 13 deletions symmetric/src/docbook/user-guide/admin/ch07-administration.xml
Expand Up @@ -20,19 +20,7 @@ set channel_id = 'price',
last_update_by = 'jsmith',
last_update_time = current_timestamp
where source_table_name = 'price_changes';
]]></programlisting>

The Trigger entry can be inactivated, which would drop the triggers (and any functions
used by them) from the database. For example, dropping all the triggers used by the
client node group would be accomplished with the following statement:

<programlisting>
<![CDATA[update SYM_TRIGGER
set inactive_time = current_timestamp,
last_update_by = 'jsmith',
last_update_time = current_timestamp
where source_node_group_id = 'client';
]]></programlisting>
]]></programlisting>
All configuration should be managed centrally at the registration node. If enabled, configuration
changes will be synchronized out to client nodes. When trigger changes reach the client
nodes the Sync Triggers process will run automatically.
Expand Down
Expand Up @@ -867,17 +867,6 @@
<entry></entry>
<entry>Timestamp when this entry was created.</entry>
</row>
<row>
<entry>inactive_time</entry>
<entry>timestamp</entry>
<entry>Y</entry>
<entry></entry>
<entry></entry>
<entry>
Timestamp when this entry was inactivated, which stops capturing of
data changes.
</entry>
</row>
<row>
<entry>last_update_by</entry>
<entry>varchar(50)</entry>
Expand Down
Expand Up @@ -173,14 +173,6 @@
<entry></entry>
<entry>The date and time when this entry was recorded.</entry>
</row>
<row>
<entry>inactive_time</entry>
<entry>timestamp</entry>
<entry>Y</entry>
<entry></entry>
<entry></entry>
<entry>The date and time when a Trigger was inactivated.</entry>
</row>
</tbody>
</tgroup>
</table>
Expand Down
10 changes: 0 additions & 10 deletions symmetric/src/main/java/org/jumpmind/symmetric/model/Trigger.java
Expand Up @@ -84,8 +84,6 @@ public class Trigger {
*/
private String txIdExpression = null;

private Date inactiveTime;

private Date createTime;

private Date lastUpdateTime;
Expand Down Expand Up @@ -312,14 +310,6 @@ public void setTriggerId(String triggerId) {
}
}

public Date getInactiveTime() {
return inactiveTime;
}

public void setInactiveTime(Date inactiveTime) {
this.inactiveTime = inactiveTime;
}

public boolean isSyncOnIncomingBatch() {
return syncOnIncomingBatch;
}
Expand Down
Expand Up @@ -382,11 +382,11 @@ public void saveTrigger(Trigger trigger) {
trigger.getNameForInsertTrigger(), trigger.getNameForDeleteTrigger(),
trigger.getSyncOnUpdateCondition(), trigger.getSyncOnInsertCondition(),
trigger.getSyncOnDeleteCondition(), trigger.getTxIdExpression(), trigger.getExcludedColumnNames(),
trigger.getInactiveTime(), trigger.getLastUpdateBy(), trigger.getLastUpdateTime(),
trigger.getLastUpdateBy(), trigger.getLastUpdateTime(),
trigger.getTriggerId() }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.SMALLINT, Types.SMALLINT, Types.SMALLINT, Types.SMALLINT, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.TIMESTAMP, Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR })) {
Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR })) {
trigger.setCreateTime(trigger.getLastUpdateTime());
jdbcTemplate.update(getSql("insertTriggerSql"), new Object[] { trigger.getSourceCatalogName(),
trigger.getSourceSchemaName(), trigger.getSourceTableName(), trigger.getChannelId(),
Expand All @@ -395,11 +395,11 @@ public void saveTrigger(Trigger trigger) {
trigger.getNameForUpdateTrigger(), trigger.getNameForInsertTrigger(),
trigger.getNameForDeleteTrigger(), trigger.getSyncOnUpdateCondition(),
trigger.getSyncOnInsertCondition(), trigger.getSyncOnDeleteCondition(),
trigger.getTxIdExpression(), trigger.getExcludedColumnNames(), trigger.getCreateTime(), null,
trigger.getTxIdExpression(), trigger.getExcludedColumnNames(), trigger.getCreateTime(),
trigger.getLastUpdateBy(), trigger.getLastUpdateTime(), trigger.getTriggerId() }, new int[] {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT, Types.SMALLINT,
Types.SMALLINT, Types.SMALLINT, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.TIMESTAMP, Types.TIMESTAMP,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.TIMESTAMP,
Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR });
}
}
Expand Down Expand Up @@ -669,7 +669,6 @@ public TriggerRouter mapRow(java.sql.ResultSet rs, int arg1) throws java.sql.SQL
trig.getTrigger().setTriggerId(rs.getString("trigger_id"));
trig.getTrigger().setChannelId(rs.getString("channel_id"));
trig.getTrigger().setSourceTableName(rs.getString("source_table_name"));
trig.getTrigger().setInactiveTime(rs.getTimestamp("inactive_time"));
trig.getTrigger().setSyncOnInsert(rs.getBoolean("sync_on_insert"));
trig.getTrigger().setSyncOnUpdate(rs.getBoolean("sync_on_update"));
trig.getTrigger().setSyncOnDelete(rs.getBoolean("sync_on_delete"));
Expand Down
Expand Up @@ -69,7 +69,7 @@
</entry>
<entry key="selectTriggerRouterPrefixSql">
<value>select
t.trigger_id,t.channel_id,t.source_table_name,t.inactive_time,t.sync_on_insert,t.sync_on_update,t.sync_on_delete,r.sync_on_insert as r_sync_on_insert,r.sync_on_update as r_sync_on_update,r.sync_on_delete as r_sync_on_delete,t.sync_on_incoming_batch,t.excluded_column_names,
t.trigger_id,t.channel_id,t.source_table_name,t.sync_on_insert,t.sync_on_update,t.sync_on_delete,r.sync_on_insert as r_sync_on_insert,r.sync_on_update as r_sync_on_update,r.sync_on_delete as r_sync_on_delete,t.sync_on_incoming_batch,t.excluded_column_names,
t.name_for_delete_trigger,t.name_for_insert_trigger,t.name_for_update_trigger,t.source_schema_name,t.source_catalog_name,
t.sync_on_insert_condition,t.sync_on_update_condition,t.sync_on_delete_condition,t.tx_id_expression,t.create_time as t_create_time,
t.last_update_time as t_last_update_time, t.last_update_by as t_last_update_by,
Expand All @@ -88,19 +88,19 @@
</entry>
<entry key="activeTriggersForSourceNodeGroupSql">
<value>
where r.source_node_group_id = ? and t.inactive_time is null
where r.source_node_group_id = ?
</value>
</entry>
<entry key="activeTriggersForReloadSql">
<value>
where r.source_node_group_id = ? and
r.target_node_group_id = ? and t.channel_id != ? and t.inactive_time is null order by
r.target_node_group_id = ? and t.channel_id != ? order by
tr.initial_load_order
</value>
</entry>
<entry key="inactiveTriggersForSourceNodeGroupSql">
<value>
where r.source_node_group_id = ? and t.inactive_time is not null
where r.source_node_group_id = ?
</value>
</entry>
<entry key="allTriggerHistSql">
Expand Down Expand Up @@ -139,8 +139,8 @@
(source_catalog_name,source_schema_name,source_table_name,channel_id,sync_on_update,sync_on_insert,sync_on_delete,
sync_on_incoming_batch,name_for_update_trigger,name_for_insert_trigger,name_for_delete_trigger,
sync_on_update_condition,sync_on_insert_condition,sync_on_delete_condition,tx_id_expression,excluded_column_names,
create_time,inactive_time,last_update_by,last_update_time,trigger_id)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
create_time,last_update_by,last_update_time,trigger_id)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
</value>
</entry>
<entry key="updateTriggerSql">
Expand All @@ -150,8 +150,7 @@
channel_id=?,sync_on_update=?,sync_on_insert=?,sync_on_delete=?,
sync_on_incoming_batch=?,name_for_update_trigger=?,name_for_insert_trigger=?,
name_for_delete_trigger=?,sync_on_update_condition=?,sync_on_insert_condition=?,
sync_on_delete_condition=?,tx_id_expression=?,excluded_column_names=?,
inactive_time=?,last_update_by=?,last_update_time=?
sync_on_delete_condition=?,tx_id_expression=?,excluded_column_names=?,last_update_by=?,last_update_time=?
where trigger_id=?
</value>
</entry>
Expand Down
1 change: 0 additions & 1 deletion symmetric/src/main/resources/symmetric-schema.xml
Expand Up @@ -128,7 +128,6 @@
<column name="tx_id_expression" type="VARCHAR" size="500" description="Override the default expression for the transaction identifier that groups the data changes that were committed together." />
<column name="excluded_column_names" type="CLOB" description="Specify a comma-delimited list of columns that should not be synchronized from this table." />
<column name="create_time" type="TIMESTAMP" required="true" description="Timestamp when this entry was created." />
<column name="inactive_time" type="TIMESTAMP" description="Timestamp when this entry was inactivated, which stops capturing of data changes." />
<column name="last_update_by" type="VARCHAR" size="50" description="The user who last updated this entry." />
<column name="last_update_time" type="TIMESTAMP" required="true" description="Timestamp when a user last updated this entry." />
</table>
Expand Down
Expand Up @@ -206,8 +206,7 @@ public void testSyncIncomingBatch() throws Exception {

}

@Ignore
@Test
//@Test
public void testLargeNumberOfEventsToManyNodes() {
resetBatches();

Expand Down
Expand Up @@ -98,7 +98,7 @@ public void testSchemaSync() throws Exception {
int expectedCount = origCount
+ getJdbcTemplate()
.update(
"update sym_trigger set last_update_time=? where inactive_time is null and trigger_id in (select trigger_id from sym_trigger_router where router_id in (select router_id from sym_router where source_node_group_id=?))",
"update sym_trigger set last_update_time=? where trigger_id in (select trigger_id from sym_trigger_router where router_id in (select router_id from sym_router where source_node_group_id=?))",
new Object[] { lastUpdateTime.getTime(), TestConstants.TEST_ROOT_NODE_GROUP });

service.syncTriggers();
Expand Down Expand Up @@ -186,20 +186,6 @@ public void testDisableTriggers() throws Exception {
+ EXPECTED_INSERT2_CSV_ENDSWITH);
}

@Test
public void inactivateTriggersTest() throws Exception {
JdbcTemplate jdbcTemplate = getJdbcTemplate();
jdbcTemplate.update("update sym_trigger set inactive_time=current_timestamp where source_table_name='"
+ TEST_TRIGGERS_TABLE + "'");
getSymmetricEngine().syncTriggers();

Assert.assertEquals(1, insert(INSERT3_VALUES, jdbcTemplate, getDbDialect()));
String csvString = getNextDataRow();
Assert.assertNotSame(UNEXPECTED_INSERT3_CSV_ENDSWITH, csvString,
"Data was captured when it should not have been");

}

@Test
public void testBinaryColumnTypesForOracle() {
IDbDialect dialect = getDbDialect();
Expand Down

0 comments on commit c9b6c52

Please sign in to comment.