diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2008-07-25 06:11:45 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2008-07-25 06:11:45 +0000 |
commit | 684ebe67a42c5f38f1cd1e041e341860a4be717d (patch) | |
tree | a859cba5bfc667c793fc40a5eb4d26092ea55c8d /src/main/java/com/amazon/carbonado/repo/replicated | |
parent | aedc0ad573440b541ed2e37d7d81bab32ef3172c (diff) |
Run update repair locally and also do in background, to ensure it sticks.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/replicated')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java | 14 |
1 files changed, 12 insertions, 2 deletions
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<S extends Storable> extends Trigger<S> { 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<S extends Storable> extends Trigger<S> { } 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;
}
}
|