View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002362 | SymmetricDS | Bug | public | 2015-08-05 07:01 | 2022-08-05 20:02 |
Reporter | davemelo | Assigned To | elong | ||
Priority | urgent | ||||
Status | closed | Resolution | fixed | ||
Product Version | 3.7.19 | ||||
Target Version | 3.12.2 | Fixed in Version | 3.12.2 | ||
Summary | 0002362: Sending CLOB with USE_OLD_DATA as conflict in ORACLE throws ""inconsistent datatypes: expected - got CLOB"" | ||||
Description | This issue has referenced from: http://www.symmetricds.org/issues/view.php?id=2358 When a client sends to server a register with a CLOB and the conflict detection method for that table is USE_OLD_DATA, symmetrics puts a CLOB in WHERE clause, and that is not possible in ORACLE as you can read in this link: http://stackoverflow.com/a/12980560 Symmetrics when is syncronizing throws the error: inconsistent datatypes: expected - got CLOB". | ||||
Steps To Reproduce | Install symmetrics with the configuration file that I attached as error_config.txt. Try to send the data from Item table and you will see the error in console: [server] - DatabaseWriter - Failed to process a update event in batch 9. Failed sql was: update "ITEM" set "ITEM_DESC" = ? where "ITEM_ID" = ? and "ITEM_NAME" = ? and "ITEM_DESC" = ? Failed pk data was: "101" Failed row data was: "101","second","this one fails because it is an update" Failed old data was: "101","second","insert is fine" [server] - DataLoaderService - Failed to load batch 001-9 because: ORA-00932: inconsistent datatypes: expected - got CLOB | ||||
Additional Information | BUG is in the DefaultDatabaseWriter in the update and delete method(line 256 and line 403): Iterator<Column> it = lookupKeys.iterator(); while (it.hasNext()) { Column col = it.next(); if ((platform.isLob(col.getMappedTypeCode()) && data.isNoBinaryOldData())|| !platform.canColumnBeUsedInWhereClause(col)) { it.remove(); } } Probably the error is in the method platform.canColumnBeUsedInWhereClause that has the code: @Override public boolean canColumnBeUsedInWhereClause(Column column) { String jdbcTypeName = column.getJdbcTypeName(); return !column.isOfBinaryType() || "RAW".equals(jdbcTypeName); } Maybe the solution is to add CLOB type to this method as: return !column.isOfBinaryType() || "RAW".equals(jdbcTypeName) || "CLOB".equals(jdbcTypeName) | ||||
Tags | conflict manager, large objects | ||||
|
error_config.txt (4,331 bytes)
server.properties ----------------- engine.name=server db.driver=oracle.jdbc.driver.OracleDriver db.url=jdbc:oracle:thin:@localhost:1521:xe db.user=sym_server_test db.password=sym_server_test sync.url=http://localhost:8080/sync/server group.id=server external.id=000 job.purge.period.time.ms=7200000 job.routing.period.time.ms=5000 job.push.period.time.ms=10000 job.pull.period.time.ms=10000 client.properties ----------------- engine.name=client db.driver=oracle.jdbc.driver.OracleDriver db.url=jdbc:oracle:thin:@localhost:1521:xe db.user=sym_client_test db.password=sym_client_test registration.url=http://localhost:8080/sync/server group.id=client external.id=001 job.routing.period.time.ms=5000 job.push.period.time.ms=10000 job.pull.period.time.ms=10000 --------------- -- Sample table --------------- CREATE TABLE ITEM ( ITEM_ID NUMBER NOT NULL, ITEM_NAME VARCHAR(100), ITEM_DESC CLOB, CONSTRAINT ITEM_PK PRIMARY KEY (ITEM_ID) ); -------------------- -- sym tables config -------------------- insert into sym_node_group (node_group_id, description) values ('server', 'Server node'); insert into sym_node_group (node_group_id, description) values ('client', 'Client node'); insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('client', 'server', 'P'); insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('server', 'client', 'W'); insert into sym_node (node_id, node_group_id, external_id, sync_enabled) values ('000', 'server', '000', 1); insert into sym_node_identity values ('000'); insert into SYM_TRIGGER (TRIGGER_ID,SOURCE_TABLE_NAME,CHANNEL_ID,SYNC_ON_UPDATE,SYNC_ON_INSERT,SYNC_ON_DELETE,SYNC_ON_INCOMING_BATCH,USE_STREAM_LOBS,USE_CAPTURE_LOBS,USE_CAPTURE_OLD_DATA,USE_HANDLE_KEY_UPDATES,LAST_UPDATE_TIME,CREATE_TIME) values ('ITEM','ITEM','default','1','1','1','0','0','0','1','0',current_timestamp,current_timestamp); insert into sym_router (router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time) values('server_2_client', 'server', 'client', 'default',current_timestamp, current_timestamp); insert into sym_router (router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time) values('client_2_server', 'client', 'server', 'default',current_timestamp, current_timestamp); insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('ITEM','server_2_client', 100, current_timestamp, current_timestamp); insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('ITEM','client_2_server', 200, current_timestamp, current_timestamp); -- Conflict handling insert into SYM_CONFLICT (CONFLICT_ID,SOURCE_NODE_GROUP_ID,TARGET_NODE_GROUP_ID,TARGET_CHANNEL_ID,TARGET_TABLE_NAME,DETECT_TYPE,RESOLVE_TYPE,PING_BACK,RESOLVE_CHANGES_ONLY,RESOLVE_ROW_ONLY,CREATE_TIME,LAST_UPDATE_TIME) values ('1','client','server','default','ITEM','USE_OLD_DATA','IGNORE','SINGLE_ROW','0','1',current_timestamp,current_timestamp); --update SYM_CONFLICT set DETECT_TYPE = 'USE_OLD_DATA' where CONFLICT_ID = '1'; -- This config causes the error --update SYM_CONFLICT set DETECT_TYPE = 'USE_PK_DATA' where CONFLICT_ID = '1'; -- This config works fine --------------------------------- -- Sample data (insert on client) --------------------------------- INSERT INTO ITEM (ITEM_ID, ITEM_NAME, ITEM_DESC) VALUES (100, 'first', 'works fine with an insert'); INSERT INTO ITEM (ITEM_ID, ITEM_NAME, ITEM_DESC) VALUES (101, 'second', 'insert is fine'); UPDATE ITEM SET ITEM_DESC = 'this one fails because it is an update' WHERE ITEM_ID = 101; Error shown on server console ----------------------------- [server] - DatabaseWriter - Failed to process a update event in batch 9. Failed sql was: update "ITEM" set "ITEM_DESC" = ? where "ITEM_ID" = ? and "ITEM_NAME" = ? and "ITEM_DESC" = ? Failed pk data was: "101" Failed row data was: "101","second","this one fails because it is an update" Failed old data was: "101","second","insert is fine" [server] - DataLoaderService - Failed to load batch 001-9 because: ORA-00932: inconsistent datatypes: expected - got CLOB |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-08-05 07:01 | davemelo | New Issue | |
2015-08-05 07:01 | davemelo | File Added: error_config.txt | |
2019-04-23 19:16 | elong | Relationship added | related to 0002358 |
2019-04-23 19:17 | elong | Tag Attached: conflict manager | |
2019-04-23 19:17 | elong | Tag Attached: large objects | |
2022-08-05 20:00 | elong | Relationship added | related to 0004464 |
2022-08-05 20:02 | elong | Assigned To | => elong |
2022-08-05 20:02 | elong | Status | new => closed |
2022-08-05 20:02 | elong | Resolution | open => fixed |
2022-08-05 20:02 | elong | Fixed in Version | => 3.12.18 |
2022-08-05 20:02 | elong | Target Version | => 3.12.18 |