How to export/import current conflict handlers when you need to reconfigure Replicate
Problem Description
Your Replicate environment contains user-modified conflict handlers on table level and you need to re-run *-all.sh for various reasons. *-all.sh drops and re-creates dbvrep repositories so you lose your configuration by default but there is a way how to export & import conflict handlers settings.
Solution
Current configuration
dbvrep> list prepare
List of prepared schemas:
none
List of prepared tables:
DBVREPCH.DBRSCOMMON_HEARTBEAT -> DBVREPCHTGT (schema rename)
DBVREPCH.DBRSOBJ$ -> DBVREPCHTGT (schema rename)
DBVREPCH.DBRSUSER$ -> DBVREPCHTGT (schema rename)
SCOTT.M1 -> SCOTT.M2 (table rename) (DDL)
dbvrep> show_conflict_handlers for table scott.m1
The table called SCOTT.M1 on source is handled on apply (APPLY) as follows:
The table is renamed to SCOTT.M2.
UPDATE (error): handler: RETRY logging: LOG
UPDATE (no_data): handler: RETRY logging: LOG
UPDATE (too_many): handler: RETRY logging: LOG
DELETE (error): handler: RETRY logging: LOG
DELETE (no_data): handler: RETRY logging: LOG
DELETE (too_many): handler: RETRY logging: LOG
INSERT (error): handler: RETRY logging: LOG
TRANSACTION (error): handler: RETRY logging: LOG
Let's change some conflict handler
dbvrep> set_conflict_handlers for table scott.m1 for update on no_data to overwrite nolog
Connecting to running apply: [The table called SCOTT.M1 on source is handled on apply (APPLY) as follows:
The table is renamed to SCOTT.M2.
UPDATE (error): handler: RETRY logging: LOG
UPDATE (no_data): handler: OVERWRITE logging: NOLOG
UPDATE (too_many): handler: RETRY logging: LOG
DELETE (error): handler: RETRY logging: LOG
DELETE (no_data): handler: RETRY logging: LOG
DELETE (too_many): handler: RETRY logging: LOG
INSERT (error): handler: RETRY logging: LOG
TRANSACTION (error): handler: RETRY logging: LOG]
dbvrep> show_conflict_handlers for table scott.m1
The table called SCOTT.M1 on source is handled on apply (APPLY) as follows:
The table is renamed to SCOTT.M2.
UPDATE (error): handler: RETRY logging: LOG
UPDATE (no_data): handler: OVERWRITE logging: NOLOG
UPDATE (too_many): handler: RETRY logging: LOG
DELETE (error): handler: RETRY logging: LOG
DELETE (no_data): handler: RETRY logging: LOG
DELETE (too_many): handler: RETRY logging: LOG
INSERT (error): handler: RETRY logging: LOG
TRANSACTION (error): handler: RETRY logging: LOG
Now shutdown processes
dbvrep> shutdown all
Dbvisit Replicate APPLY process shutting down.
Dbvisit Replicate MINE process shutting down.
dbvrep> exit
Before you exetute *-all.sh, you have to backup DBRSAPPLY_CONFLICT_HANDLERS residing in the target database
And you can proceed to run setup wizard and/or execute *-all.sh
Once completed, start dbvrep console and prepare table if not already configured in setup wizard
You can verify that conflict handlers are set to their default values
Now import old DBRSAPPLY_CONFLICT_HANDLERS as temporary table
Connect as target repository owner and merge data
Now verify the settings in dbvrep console
Example:
We will add export/import of conflict handlers in next releases.