IBM Support

Duplicate rowid exists in _t_repl_state table

Question & Answer


Question

How do you resolve duplicate rowids on t_repl_state table

Cause

Could be some type of corruption within the catalog table; somehow the duplicate rows got put in the replication master.

Answer

To fix the problem we need to remove the duplicate entries from "_t_repl_state" table. Follow the steps below to remove duplicate entries:

1.) Find the DBID associated with a count of duplicate rows

SYSTEM.ADMIN(ADMIN)=> select dbid,count(*) from _t_repl_state group by dbid having count(*)>2 order by 2 desc;
DBID | COUNT
------------+-------
1563557898 | 4

2.) Find the duplicate recoreds that have same rowid

select rowid,* from _t_repl_state where dbid= 1563557898;


ROWID | SETID | DBID | NODEID | SOURCEID | CSN | FINAL_CSN | DB_STATE | COMMIT_TS | CREATE_TS | MODIFY_TS | LAST_HEARTBEAT_TS | LAST_PRUNED_CSN | LAST_PRUNED_COMMIT_TS
---------+-------+------------+--------+----------+-------+-----------+----------+------------------+------------------+------------------+-------------------+-----------------+-----------------------
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6532339 | 18897 | 1563557898 | 23858 | 16989 | 22130 | | 1 | 1460654312157218 | 1455027418836022 | 1460654312157218 | 1460667161353614 | 21768 | 1460569842220794
(4 rows)

3. ) Insert another duplicate records to get a unique rowid

insert into _t_repl_state select * from _t_repl_state where setid=18897 and dbid=1563557898 and nodeid=16989 limit 1;
INSERT 0 1

ROWID | SETID | DBID | NODEID | SOURCEID | CSN | FINAL_CSN | DB_STATE | COMMIT_TS | CREATE_TS | MODIFY_TS | LAST_HEARTBEAT_TS | LAST_PRUNED_CSN | LAST_PRUNED_COMMIT_TS
---------+-------+------------+--------+----------+-------+-----------+----------+------------------+------------------+------------------+-------------------+-----------------+-----------------------
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6143671 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6532572 | 18897 | 1563557898 | 16989 | 16989 | 22130 | | 1 | 1460653194956045 | 1455027425020579 | 1460653194956045 | 0 | 0 | 0
6532604 | 18897 | 1563557898 | 23858 | 16989 | 22130 | | 1 | 1460654312157218 | 1455027418836022 | 1460654312157218 | 1460667401354157 | 21768 | 1460569842220794
(5 rows)

4.) Delete previous duplicate records using rowid

delete from _t_repl_state where rowid=6143671 and setid=18897 and dbid=1563557898 and nodeid=16989;
DELETE 3


ROWID | SETID | DBID | NODEID | SOURCEID | CSN | FINAL_CSN | DB_STATE | COMMIT_TS | CREATE_TS | MODIFY_TS | LAST_HEARTBEAT_TS | LAST_PRUNED_CSN | LAST_PRUNED_COMMIT_TS
---------+-------+------------+--------+----------+-------+-----------+----------+------------------+------------------+------------------+-------------------+-----------------+-----------------------
6532805 | 18897 | 1563557898 | 23858 | 16989 | 22130 | | 1 | 1460654312157218 | 1455027418836022 | 1460654312157218 | 1460667581353697 | 21768 | 1460569842220794
6532572 | 18897 | 1563557898 | 16989 | 16989 | 22143 | | 1 | 1460667595741576 | 1455027425020579 | 1460667595741576 | 0 | 0 | 0
(2 rows)

This should have taken care of the duplicate rows


[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Administration","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
17 October 2019

UID

swg21981364