From 684ebe67a42c5f38f1cd1e041e341860a4be717d Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 25 Jul 2008 06:11:45 +0000 Subject: Run update repair locally and also do in background, to ensure it sticks. --- .../carbonado/repo/replicated/ReplicationTrigger.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java index 0b9770f..29af101 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java @@ -152,7 +152,12 @@ class ReplicationTrigger extends Trigger { if (!master.tryUpdate()) { // Master record does not exist. To ensure consistency, // delete record from replica. - repair(replica); + if (tryDeleteReplica(replica)) { + // Replica was inconsistent, but caller might be in a + // transaction and rollback the repair. Run repair + // again in separate thread to ensure it sticks. + repair(replica); + } throw abortTry(); } } else { @@ -161,7 +166,12 @@ class ReplicationTrigger extends Trigger { } catch (PersistNoneException e) { // Master record does not exist. To ensure consistency, // delete record from replica. - repair(replica); + if (tryDeleteReplica(replica)) { + // Replica was inconsistent, but caller might be in a + // transaction and rollback the repair. Run repair + // again in separate thread to ensure it sticks. + repair(replica); + } throw e; } } -- cgit v1.2.3