Skip to content

Commit

Permalink
parameterised log message, final variable migration, removing unused …
Browse files Browse the repository at this point in the history
…methods
  • Loading branch information
nischalkumar committed Jun 29, 2021
1 parent 87cc864 commit 8156764
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import com.apple.foundationdb.KeyValue;
import com.apple.foundationdb.LocalityUtil;
import com.apple.foundationdb.async.CloseableAsyncIterator;
import com.apple.foundationdb.async.AsyncIterator;
import com.apple.foundationdb.async.CloseableAsyncIterator;
import com.apple.foundationdb.directory.DirectorySubspace;
import com.google.common.base.Preconditions;
import org.janusgraph.diskstorage.BackendException;
Expand Down Expand Up @@ -75,11 +75,6 @@ private static FoundationDBTx getTransaction(StoreTransaction txh) {

@Override
public synchronized void close() throws BackendException {
try {
//if(isOpen) db.close();
} catch (Exception e) {
throw new PermanentBackendException(e);
}
if (isOpen) manager.removeDatabase(this);
isOpen = false;
}
Expand Down Expand Up @@ -168,7 +163,7 @@ public RecordIterator<KeyValueEntry> getSliceAsync(KVQuery query, StoreTransacti

return new FoundationDBRecordAsyncIterator(db, tx, rangeQuery, result, query.getKeySelector());
} catch (Exception e) {
log.error("getSliceAsync db=%s, tx=%s with exception", name, txh, e);
log.error("getSliceAsync db={}, tx={} with exception", name, txh, e);
throw new PermanentBackendException(e);
}
}
Expand Down Expand Up @@ -259,6 +254,9 @@ public void delete(StaticBuffer key, StoreTransaction txh) throws BackendExcepti
}
}

/* this method is not called within JanusGraph, it's used for bulk access in Spark jobs.
For more: Please check: {@link https://github.com/JanusGraph/janusgraph-foundationdb/pull/48#discussion_r498917927}
*/
public List<StaticBuffer> getBoundaryKeys() {
List<StaticBuffer> keys = new ArrayList<>();
try (CloseableAsyncIterator<byte[]> it = LocalityUtil.getBoundaryKeys(manager.db, db.range().begin, db.range().end)) {
Expand All @@ -275,4 +273,6 @@ public List<StaticBuffer> getBoundaryKeys() {
static StaticBuffer getBuffer(byte[] entry) {
return new StaticArrayBuffer(entry);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
*/
public class FoundationDBRangeQuery {

private KVQuery originalQuery;
private final KVQuery originalQuery;
private KeySelector startKeySelector;
private KeySelector endKeySelector;
private int limit;
private final int limit;

public FoundationDBRangeQuery(Subspace db, KVQuery kvQuery) {
originalQuery = kvQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ public class FoundationDBTx extends AbstractStoreTransaction {

private final Database db;

private List<Insert> inserts = Collections.synchronizedList(new ArrayList<>());
private List<byte[]> deletions = Collections.synchronizedList(new ArrayList<>());
private final List<Insert> inserts = Collections.synchronizedList(new ArrayList<>());
private final List<byte[]> deletions = Collections.synchronizedList(new ArrayList<>());

private int maxRuns = 1;

public enum IsolationLevel {SERIALIZABLE, READ_COMMITTED_NO_WRITE, READ_COMMITTED_WITH_WRITE}

private final IsolationLevel isolationLevel;

private AtomicInteger txCtr = new AtomicInteger(0);
private final AtomicInteger txCtr = new AtomicInteger(0);

private static AtomicInteger transLocalIdCounter = new AtomicInteger(0);
private int transactionId = 0;
private static final AtomicInteger transLocalIdCounter = new AtomicInteger(0);
private final int transactionId;

public FoundationDBTx(Database db, Transaction t, BaseTransactionConfig config, IsolationLevel isolationLevel) {
super(config);
Expand Down Expand Up @@ -149,7 +149,7 @@ public synchronized void rollback() throws BackendException {


private void logFDBException(Throwable t) {
if (t != null && t instanceof FDBException) {
if (t instanceof FDBException) {
FDBException fe = (FDBException) t;
if (log.isDebugEnabled()) {
log.debug("Catch FDBException code= {}, isRetryable={}, isMaybeCommitted={}, "
Expand Down Expand Up @@ -449,8 +449,8 @@ public void clear(final byte[] key) {


private class Insert {
private byte[] key;
private byte[] value;
private final byte[] key;
private final byte[] value;

public Insert(final byte[] key, final byte[] value) {
this.key = key;
Expand Down

0 comments on commit 8156764

Please sign in to comment.