Skip to content

Commit d607e18

Browse files
feeblefakieKodaiD
andauthored
Backport to branch(3) : Remove unnecessary loggings in statement handlers (#2475)
Co-authored-by: Kodai Doki <[email protected]>
1 parent 850bccc commit d607e18

File tree

6 files changed

+2
-27
lines changed

6 files changed

+2
-27
lines changed

core/src/main/java/com/scalar/db/storage/cassandra/BatchHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public void handle(List<? extends Mutation> mutations)
7373
CoreError.CASSANDRA_OPERATION_FAILED_IN_BATCH.buildMessage(writeType), e);
7474
}
7575
} catch (RuntimeException e) {
76-
logger.warn(e.getMessage(), e);
7776
throw new RetriableExecutionException(
7877
CoreError.CASSANDRA_ERROR_OCCURRED_IN_BATCH.buildMessage(e.getMessage()), e);
7978
}

core/src/main/java/com/scalar/db/storage/cassandra/MutateStatementHandler.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
import com.scalar.db.exception.storage.RetriableExecutionException;
1616
import javax.annotation.Nonnull;
1717
import javax.annotation.concurrent.ThreadSafe;
18-
import org.slf4j.Logger;
19-
import org.slf4j.LoggerFactory;
2018

2119
/** An abstraction for handler classes for mutate statements */
2220
@ThreadSafe
2321
public abstract class MutateStatementHandler extends StatementHandler {
24-
private static final Logger logger = LoggerFactory.getLogger(MutateStatementHandler.class);
25-
2622
public MutateStatementHandler(Session session) {
2723
super(session);
2824
}
@@ -48,7 +44,6 @@ public ResultSet handle(Operation operation) throws ExecutionException {
4844
}
4945
return results;
5046
} catch (WriteTimeoutException e) {
51-
logger.warn("Write timeout happened during mutate operation", e);
5247
if (e.getWriteType() == WriteType.CAS) {
5348
// retry needs to be done if applications need to do the operation exactly
5449
throw new RetriableExecutionException(
@@ -71,7 +66,6 @@ public ResultSet handle(Operation operation) throws ExecutionException {
7166
CoreError.CASSANDRA_WRITE_TIMEOUT_WITH_OTHER_WRITE_TYPE_IN_MUTATION.buildMessage(), e);
7267
}
7368
} catch (RuntimeException e) {
74-
logger.warn(e.getMessage(), e);
7569
throw new RetriableExecutionException(
7670
CoreError.CASSANDRA_ERROR_OCCURRED_IN_MUTATION.buildMessage(e.getMessage()), e);
7771
}

core/src/main/java/com/scalar/db/storage/cassandra/SelectStatementHandler.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import java.util.stream.IntStream;
3434
import javax.annotation.Nonnull;
3535
import javax.annotation.concurrent.ThreadSafe;
36-
import org.slf4j.Logger;
37-
import org.slf4j.LoggerFactory;
3836

3937
/**
4038
* A handler class for select statement
@@ -43,8 +41,6 @@
4341
*/
4442
@ThreadSafe
4543
public class SelectStatementHandler extends StatementHandler {
46-
private static final Logger logger = LoggerFactory.getLogger(SelectStatementHandler.class);
47-
4844
/**
4945
* Constructs {@code SelectStatementHandler} with the specified {@code Session}
5046
*
@@ -60,7 +56,6 @@ public ResultSet handle(Operation operation) throws ExecutionException {
6056
try {
6157
return handleInternal(operation);
6258
} catch (RuntimeException e) {
63-
logger.error(e.getMessage(), e);
6459
throw new ExecutionException(
6560
CoreError.CASSANDRA_ERROR_OCCURRED_IN_SELECTION.buildMessage(e.getMessage()), e);
6661
}
@@ -294,8 +289,7 @@ private Ordering getOrdering(Scan.Ordering ordering) {
294289
case DESC:
295290
return QueryBuilder.desc(quoteIfNecessary(ordering.getColumnName()));
296291
default:
297-
logger.warn("Unsupported ordering specified. Using Order.ASC");
298-
return QueryBuilder.asc(quoteIfNecessary(ordering.getColumnName()));
292+
throw new AssertionError("Unsupported ordering is specified: " + ordering.getOrder());
299293
}
300294
}
301295

core/src/main/java/com/scalar/db/storage/cassandra/StatementHandler.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@
1414
import com.scalar.db.exception.storage.ExecutionException;
1515
import javax.annotation.Nonnull;
1616
import javax.annotation.concurrent.ThreadSafe;
17-
import org.slf4j.Logger;
18-
import org.slf4j.LoggerFactory;
1917

2018
/** A handler class for statements */
2119
@ThreadSafe
2220
public abstract class StatementHandler {
23-
private static final Logger logger = LoggerFactory.getLogger(StatementHandler.class);
2421
protected final Session session;
2522
protected final StatementCache cache;
2623

@@ -119,8 +116,7 @@ public static ConsistencyLevel convert(Operation operation, Consistency consiste
119116
return ConsistencyLevel.QUORUM;
120117
}
121118
default:
122-
logger.warn("Unsupported consistency is specified. SEQUENTIAL is being used instead");
123-
return ConsistencyLevel.QUORUM;
119+
throw new AssertionError("Unsupported consistency is specified: " + consistency);
124120
}
125121
}
126122

core/src/main/java/com/scalar/db/storage/cosmos/BatchHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import java.util.ArrayList;
1313
import java.util.List;
1414
import javax.annotation.concurrent.ThreadSafe;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
1715

1816
/**
1917
* A handler for a batch
@@ -22,7 +20,6 @@
2220
*/
2321
@ThreadSafe
2422
public class BatchHandler {
25-
private static final Logger logger = LoggerFactory.getLogger(BatchHandler.class);
2623
private static final String MUTATION_STORED_PROCEDURE = "mutate.js";
2724
private final CosmosClient client;
2825
private final TableMetadataManager metadataManager;
@@ -88,7 +85,6 @@ private void executeStoredProcedure(
8885
}
8986

9087
private void throwException(CosmosException exception) throws ExecutionException {
91-
logger.error(exception.getMessage(), exception);
9288
int statusCode = exception.getSubStatusCode();
9389

9490
if (statusCode == CosmosErrorCode.PRECONDITION_FAILED.get()) {

core/src/main/java/com/scalar/db/storage/cosmos/MutateStatementHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212
import java.util.ArrayList;
1313
import java.util.List;
1414
import javax.annotation.concurrent.ThreadSafe;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
1715

1816
/** An abstraction for handler classes for mutate statements */
1917
@ThreadSafe
2018
public abstract class MutateStatementHandler extends StatementHandler {
21-
private static final Logger logger = LoggerFactory.getLogger(MutateStatementHandler.class);
2219
private static final String MUTATION_STORED_PROCEDURE = "mutate.js";
2320

2421
public MutateStatementHandler(CosmosClient client, TableMetadataManager metadataManager) {
@@ -60,7 +57,6 @@ protected void executeStoredProcedure(Mutation mutation, TableMetadata tableMeta
6057
}
6158

6259
private void throwException(CosmosException exception) throws ExecutionException {
63-
logger.error(exception.getMessage());
6460
int statusCode = exception.getSubStatusCode();
6561

6662
if (statusCode == CosmosErrorCode.PRECONDITION_FAILED.get()) {

0 commit comments

Comments
 (0)