Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class FoundationDBClient extends DB {
private static final String EXTERNAL_CLIENT_DIRECTORY_DEFAULT = ".";
private static final String TRACE_DIRECTORY = "foundationdb.tracedirectory";
private static final String TRACE_DIRECTORY_DEFAULT = "";
private static final String RETRY_LIMIT = "foundationdb.retrylimit";
private static final String RETRY_LIMIT_DEFAULT = "5";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should default to zero (retry forever). FDB often goes unavailable for minutes at a time during load, which would create holes in the keyspace. In turn, it's likely that YCSB's verify will notice, and declare the database corrupted.

private static final String SET_TRANSACTION_TRACE = "foundationdb.settransactiontrace";
private static final String SET_TRANSACTION_TRACE_DEFAULT = "";
private static final String TRANSACTION_TRACE_FRACTION = "foundationdb.transactiontracefraction";
Expand Down Expand Up @@ -92,6 +94,8 @@ public void init() throws DBException {
= Integer.parseInt(props.getProperty(CLIENT_THREADS_PER_VERSION, CLIENT_THREADS_PER_VERSION_DEFAULT));
String externalClientDirectory
= props.getProperty(EXTERNAL_CLIENT_DIRECTORY, EXTERNAL_CLIENT_DIRECTORY_DEFAULT);
int retryLimit
= Integer.parseInt(props.getProperty(RETRY_LIMIT, RETRY_LIMIT_DEFAULT));
String traceDirectory = props.getProperty(TRACE_DIRECTORY, TRACE_DIRECTORY_DEFAULT);
String traceFormat = props.getProperty(TRACE_FORMAT, TRACE_FORMAT_DEFAULT);
logger.info("API Version: {}", apiVersion);
Expand All @@ -110,8 +114,8 @@ public void init() throws DBException {
if (clientThreadsPerVersion != 0) {
logger.info("Threads per version: {}", clientThreadsPerVersion);
fdb.options().setClientThreadsPerVersion(clientThreadsPerVersion);
if (externalClientDirectory == EXTERNAL_CLIENT_DIRECTORY_DEFAULT) {
throw new IllegalArgumentException(EXTERNAL_CLIENT_DIRECTORY + " must be set because "
if (externalClientDirectory == EXTERNAL_CLIENT_DIRECTORY_DEFAULT) {
throw new IllegalArgumentException(EXTERNAL_CLIENT_DIRECTORY + " must be set because "
+ CLIENT_THREADS_PER_VERSION + " is set.");
}
fdb.options().setExternalClientDirectory(externalClientDirectory);
Expand All @@ -127,6 +131,8 @@ public void init() throws DBException {
dbs = new Database[clusterFiles.length];
for (int i = 0; i < clusterFiles.length; i++) {
dbs[i] = fdb.open(clusterFiles[i]);
// Retry transactions a fixed number of times so that threads never get stuck in infinite retry loops.
dbs[i].options().setTransactionRetryLimit(retryLimit);
if (datacenterId != "") {
logger.info("Datacenter ID: {}", datacenterId);
dbs[i].options().setDatacenterId(datacenterId);
Expand Down Expand Up @@ -201,7 +207,7 @@ private void setupTransactionTraceOptions(Transaction tr, String trIdentifier) {
tr.options().setLogTransaction();
tr.options().setServerRequestTracing();
}

private void batchInsert(int dbIndex) {
try {
dbs[dbIndex].run(tr -> {
Expand Down