Critical bug fix for asyncdata data migration script

Links: http://www.dbatools.net/mytools/asyncdata_critical_bugfix01.html

    After several times under production environments (with thousands of concurrent connections), I did hit some critical bugs for this script. For example, lot's of unique constraint errors, it's hard to explain the reason here. I just want to tell you the changes needed to get the new version work.

    For you, just need to create a temporary table (Table TMP_ASYNCDATA) in the source database, with one column named "SEQUENCE$$". In Oracle, I create it using the following SQL.

CREATE GLOBAL TEMPORARY TABLE TMP_ASYNCDATA
(
   SEQUENCE$$ NUMBER(38)
);

    With the temp table, the script will process consistent messages during one batch time. The original logic is by sequence range, which is not correct under concurrent situations, because the sequence range is not continues, other sessions can insert message into this range during the batch, so when finally the script want to delete the processed messages, it delete unprocessed messages also.

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36