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.
This commit is contained in:
Gian Merlino 2016-03-01 17:49:17 -08:00
parent 612e327426
commit 004028b887
3 changed files with 14 additions and 8 deletions

View File

@ -57,7 +57,7 @@
</scm>
<properties>
<metamx.java-util.version>0.27.7</metamx.java-util.version>
<metamx.java-util.version>0.27.9</metamx.java-util.version>
<apache.curator.version>2.9.1</apache.curator.version>
<jetty.version>9.2.5.v20141112</jetty.version>
<jersey.version>1.19</jersey.version>

View File

@ -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
);
}

View File

@ -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<MetadataStorageConnectorConfig> config;
private final Supplier<MetadataStorageTablesConfig> tablesConfigSupplier;
private final Predicate<Throwable> 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> T retryTransaction(final TransactionCallback<T> callback)
public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries)
{
final Callable<T> call = new Callable<T>()
{
@ -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<byte[]>()
@ -512,6 +513,7 @@ public abstract class SQLMetadataConnector implements MetadataStorageConnector
)
);
}
@Override
public void createAuditTable()
{