From 004028b887153dad60128ce875c382f2e2d85850 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 1 Mar 2016 17:49:17 -0800 Subject: [PATCH] Make first few allocatePendingSegment retries quiet. Some light retrying can happen during normal operation (SELECT -> INSERT races) and the ensuing log messages would be scary for users. --- pom.xml | 2 +- .../IndexerSQLMetadataStorageCoordinator.java | 6 +++++- .../io/druid/metadata/SQLMetadataConnector.java | 14 ++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 7cc761aef07..4d5472812fe 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ - 0.27.7 + 0.27.9 2.9.1 9.2.5.v20141112 1.19 diff --git a/server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java b/server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java index 03675a28aa5..6128b2db705 100644 --- a/server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java +++ b/server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java @@ -72,6 +72,8 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor { private static final Logger log = new Logger(IndexerSQLMetadataStorageCoordinator.class); + private static int ALLOCATE_SEGMENT_QUIET_TRIES = 3; + private final ObjectMapper jsonMapper; private final MetadataStorageTablesConfig dbTables; private final SQLMetadataConnector connector; @@ -490,7 +492,9 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor return newIdentifier; } - } + }, + ALLOCATE_SEGMENT_QUIET_TRIES, + SQLMetadataConnector.DEFAULT_MAX_TRIES ); } diff --git a/server/src/main/java/io/druid/metadata/SQLMetadataConnector.java b/server/src/main/java/io/druid/metadata/SQLMetadataConnector.java index 160a9ba320a..b0c7b1f690c 100644 --- a/server/src/main/java/io/druid/metadata/SQLMetadataConnector.java +++ b/server/src/main/java/io/druid/metadata/SQLMetadataConnector.java @@ -50,6 +50,8 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector private static final Logger log = new Logger(SQLMetadataConnector.class); private static final String PAYLOAD_TYPE = "BLOB"; + public static final int DEFAULT_MAX_TRIES = 10; + private final Supplier config; private final Supplier tablesConfigSupplier; private final Predicate shouldRetry; @@ -113,9 +115,8 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector return getDBI().withHandle(callback); } }; - final int maxTries = 10; try { - return RetryUtils.retry(call, myShouldRetry, maxTries); + return RetryUtils.retry(call, myShouldRetry, DEFAULT_MAX_TRIES); } catch (Exception e) { throw Throwables.propagate(e); @@ -127,7 +128,7 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector return retryWithHandle(callback, shouldRetry); } - public T retryTransaction(final TransactionCallback callback) + public T retryTransaction(final TransactionCallback callback, final int quietTries, final int maxTries) { final Callable call = new Callable() { @@ -137,9 +138,8 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector return getDBI().inTransaction(callback); } }; - final int maxTries = 10; try { - return RetryUtils.retry(call, shouldRetry, maxTries); + return RetryUtils.retry(call, shouldRetry, quietTries, maxTries); } catch (Exception e) { throw Throwables.propagate(e); @@ -443,7 +443,8 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector ) { final String selectStatement = String.format("SELECT %s FROM %s WHERE %s = :key", valueColumn, - tableName, keyColumn); + tableName, keyColumn + ); return getDBI().withHandle( new HandleCallback() @@ -512,6 +513,7 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector ) ); } + @Override public void createAuditTable() {