Revert "Add trace logging when aquiring and releasing operation locks for replication requests"

This reverts commit 4e996ca9f5.
This commit is contained in:
Areek Zillur 2016-11-10 18:35:25 -05:00
parent 0219a211d3
commit 5b4c3fb1ac
4 changed files with 7 additions and 36 deletions

View File

@ -112,12 +112,13 @@ public class ReplicationOperation<
totalShards.incrementAndGet();
pendingActions.incrementAndGet();
primaryResult = primary.perform(request);
if (logger.isTraceEnabled()) {
logger.trace("[{}] op [{}] completed on primary for request [{}]", primaryId, opType, request);
}
final ReplicaRequest replicaRequest = primaryResult.replicaRequest();
if (replicaRequest != null) {
assert replicaRequest.primaryTerm() > 0 : "replicaRequest doesn't have a primary term";
if (logger.isTraceEnabled()) {
logger.trace("[{}] op [{}] completed on primary for request [{}]", primaryId, opType, request);
}
// we have to get a new state after successfully indexing into the primary in order to honour recovery semantics.
// we have to make sure that every operation indexed into the primary after recovery start will also be replicated
// to the recovery target. If we use an old cluster state, we may miss a relocation that has started since then.

View File

@ -366,14 +366,6 @@ public abstract class TransportReplicationAction<
executeOnReplicas, replicasProxy, clusterService::state, logger, actionName
);
}
@Override // used for trace logging when acquiring or releasing operation lock
public String toString() {
return "AsyncPrimaryAction" +
"[request=" + request + "]"
+ "[targetAllocationId=" + targetAllocationID + "]"
+ "[taskId=" + replicationTask.getId() + "]";
}
}
protected class PrimaryResult implements ReplicationOperation.PrimaryResult<ReplicaRequest> {
@ -568,14 +560,6 @@ public abstract class TransportReplicationAction<
replica.acquireReplicaOperationLock(request.primaryTerm, this, executor);
}
@Override // used for trace logging when acquiring or releasing operation lock
public String toString() {
return "AsyncReplicaAction"
+ "[request=" + request + "]"
+ "[targetAllocationId=" + targetAllocationID + "]"
+ "[taskId=" + task.getId() + "]";
}
/**
* Listens for the response on the replica and sends the response back to the primary.
*/
@ -897,11 +881,6 @@ public abstract class TransportReplicationAction<
public void onFailure(Exception e) {
onReferenceAcquired.onFailure(e);
}
@Override
public String toString() {
return onReferenceAcquired.toString();
}
};
indexShard.acquirePrimaryOperationLock(onAcquired, executor);

View File

@ -53,9 +53,6 @@ public class IndexShardOperationsLock implements Closeable {
@Override
public void close() {
closed = true;
if (logger.isTraceEnabled()) {
logger.trace("operation lock on [{}] closed", shardId);
}
}
/**
@ -123,7 +120,7 @@ public class IndexShardOperationsLock implements Closeable {
Releasable releasable;
try {
synchronized (this) {
releasable = tryAcquire(onAcquired.toString());
releasable = tryAcquire();
if (releasable == null) {
// blockOperations is executing, this operation will be retried by blockOperations once it finishes
if (delayedOperations == null) {
@ -145,18 +142,12 @@ public class IndexShardOperationsLock implements Closeable {
onAcquired.onResponse(releasable);
}
@Nullable private Releasable tryAcquire(String resource) throws InterruptedException {
@Nullable private Releasable tryAcquire() throws InterruptedException {
if (semaphore.tryAcquire(1, 0, TimeUnit.SECONDS)) { // the untimed tryAcquire methods do not honor the fairness setting
AtomicBoolean closed = new AtomicBoolean();
if (logger.isTraceEnabled()) {
logger.trace("acquired operation lock on [{}] for resource [{}]", shardId, resource);
}
return () -> {
if (closed.compareAndSet(false, true)) {
semaphore.release(1);
if (logger.isTraceEnabled()) {
logger.trace("released operation lock on [{}] for resource [{}]", shardId, resource);
}
}
};
}

View File

@ -485,7 +485,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
* This test is a superset of tests run in the Jepsen test suite, with the exception of versioned updates
*/
@TestLogging("_root:DEBUG,org.elasticsearch.action.index:TRACE,org.elasticsearch.action.get:TRACE,discovery:TRACE,org.elasticsearch.cluster.service:TRACE,"
+ "org.elasticsearch.indices.recovery:TRACE,org.elasticsearch.indices.cluster:TRACE,org.elasticsearch.index.shard:TRACE")
+ "org.elasticsearch.indices.recovery:TRACE,org.elasticsearch.indices.cluster:TRACE")
public void testAckedIndexing() throws Exception {
final int seconds = !(TEST_NIGHTLY && rarely()) ? 1 : 5;