-
Notifications
You must be signed in to change notification settings - Fork 20
parameterised log message, final variable migration, removing unused methods #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -75,11 +75,6 @@ private static FoundationDBTx getTransaction(StoreTransaction txh) { | |
|
||
@Override | ||
public synchronized void close() throws BackendException { | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant code as nothing was inside try catch. also no 82-83 do not call foundation db. |
||
//if(isOpen) db.close(); | ||
} catch (Exception e) { | ||
throw new PermanentBackendException(e); | ||
} | ||
if (isOpen) manager.removeDatabase(this); | ||
isOpen = false; | ||
} | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. migrating to slf4j parameterized logging |
||
log.error("getSliceAsync db={}, tx={} with exception", name, txh, e); | ||
throw new PermanentBackendException(e); | ||
} | ||
} | ||
|
@@ -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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved. Please let me know if i need to. update the comment. |
||
List<StaticBuffer> keys = new ArrayList<>(); | ||
try (CloseableAsyncIterator<byte[]> it = LocalityUtil.getBoundaryKeys(manager.db, db.range().begin, db.range().end)) { | ||
|
@@ -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 |
---|---|---|
|
@@ -25,10 +25,10 @@ | |
*/ | ||
public class FoundationDBRangeQuery { | ||
|
||
private KVQuery originalQuery; | ||
private final KVQuery originalQuery; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both these attributes could be final |
||
private KeySelector startKeySelector; | ||
private KeySelector endKeySelector; | ||
private int limit; | ||
private final int limit; | ||
|
||
public FoundationDBRangeQuery(Subspace db, KVQuery kvQuery) { | ||
originalQuery = kvQuery; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<>()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these attributes can be final |
||
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); | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
FDBException fe = (FDBException) t; | ||
if (log.isDebugEnabled()) { | ||
log.debug("Catch FDBException code= {}, isRetryable={}, isMaybeCommitted={}, " | ||
|
@@ -449,8 +449,8 @@ public void clear(final byte[] key) { | |
|
||
|
||
private class Insert { | ||
private byte[] key; | ||
private byte[] value; | ||
private final byte[] key; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both the attributes could be final |
||
private final byte[] value; | ||
|
||
public Insert(final byte[] key, final byte[] value) { | ||
this.key = key; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing ununsed imports