EntityOwnershipShard can break the usual shard rule of only one 3PC
running at one time, causing the retrying write attempting to modify
an already sealed modification.
Change-Id: Iaa56b68a30f9191f7aa14428f39d4d7524aeb09d
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
private Shard shard;
private CohortEntry(final ReadWriteShardDataTreeTransaction transaction, final short clientVersion) {
private Shard shard;
private CohortEntry(final ReadWriteShardDataTreeTransaction transaction, final short clientVersion) {
this.transaction = Preconditions.checkNotNull(transaction);
this.transactionId = transaction.getIdentifier();
this.clientVersion = clientVersion;
this.transaction = Preconditions.checkNotNull(transaction);
this.transactionId = transaction.getIdentifier();
this.clientVersion = clientVersion;
+ boolean isSealed() {
+ return cohort != null;
+ }
+
Optional<SortedSet<String>> getParticipatingShardNames() {
return cohort != null ? cohort.getParticipatingShardNames() : Optional.empty();
}
Optional<SortedSet<String>> getParticipatingShardNames() {
return cohort != null ? cohort.getParticipatingShardNames() : Optional.empty();
}
*/
void handleBatchedModifications(final BatchedModifications batched, final ActorRef sender, final Shard shard) {
CohortEntry cohortEntry = cohortCache.get(batched.getTransactionId());
*/
void handleBatchedModifications(final BatchedModifications batched, final ActorRef sender, final Shard shard) {
CohortEntry cohortEntry = cohortCache.get(batched.getTransactionId());
- if (cohortEntry == null) {
+ if (cohortEntry == null || cohortEntry.isSealed()) {
cohortEntry = CohortEntry.createOpen(dataTree.newReadWriteTransaction(batched.getTransactionId()),
batched.getVersion());
cohortCache.put(cohortEntry.getTransactionId(), cohortEntry);
cohortEntry = CohortEntry.createOpen(dataTree.newReadWriteTransaction(batched.getTransactionId()),
batched.getVersion());
cohortCache.put(cohortEntry.getTransactionId(), cohortEntry);