Skip to content

Commit

Permalink
Remove pending locks assertions from TRA
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontedor committed Mar 29, 2016
1 parent 85d3d51 commit 0e5b22a
Showing 1 changed file with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,31 +793,6 @@ void finishBecauseUnavailable(ShardId shardId, String message) {
}
}


static ConcurrentMap<IndexShardReference, String> openShardReferences;

static boolean setupShardReferenceAssertions() {
openShardReferences = new ConcurrentHashMap<>();
return true;
}

static boolean addShardReference(IndexShardReference ref, String desc) {
String prev = openShardReferences.put(ref, desc);
if (prev != null) {
throw new AssertionError("shard ref " + ref + " is added twice. current [" + desc + "] prev [" + prev + "]");
}
return true;
}

static boolean removeShardReference(IndexShardReference ref) {
assert openShardReferences.remove(ref) != null : "failed to find ref [" + ref + "]";
return true;
}

static {
assert setupShardReferenceAssertions();
}

/**
* returns a new reference to {@link IndexShard} to perform a primary operation. Released after performing primary operation locally
* and replication of the operation to all replica shards is completed / failed (see {@link ReplicationPhase}).
Expand All @@ -826,7 +801,6 @@ protected IndexShardReference getIndexShardReferenceOnPrimary(ShardId shardId, R
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
IndexShard indexShard = indexService.getShard(shardId.id());
IndexShardReference ref = IndexShardReferenceImpl.createOnPrimary(indexShard);
assert addShardReference(ref, "primary: " + request.toString() + " " + ref.routingEntry());
return ref;
}

Expand All @@ -838,7 +812,6 @@ protected IndexShardReference getIndexShardReferenceOnReplica(ShardId shardId, l
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
IndexShard indexShard = indexService.getShard(shardId.id());
IndexShardReference ref = IndexShardReferenceImpl.createOnReplica(indexShard, primaryTerm);
assert addShardReference(ref, "primary term: " + primaryTerm + " " + ref.routingEntry());
return ref;
}

Expand Down Expand Up @@ -1173,7 +1146,6 @@ static IndexShardReferenceImpl createOnReplica(IndexShard indexShard, long prima
@Override
public void close() {
operationLock.close();
assert removeShardReference(this);
}

@Override
Expand Down

0 comments on commit 0e5b22a

Please sign in to comment.