Integrated changes due to review bei ankgup87
This commit is contained in:
parent
b8ce526487
commit
a1bae76c87
@ -92,7 +92,11 @@ public class ReadOptions extends RocksObject {
|
|||||||
*/
|
*/
|
||||||
public ReadOptions setSnapshot(Snapshot snapshot) {
|
public ReadOptions setSnapshot(Snapshot snapshot) {
|
||||||
assert(isInitialized());
|
assert(isInitialized());
|
||||||
setSnapshot(nativeHandle_, snapshot.nativeHandle_);
|
if (snapshot != null) {
|
||||||
|
setSnapshot(nativeHandle_, snapshot.nativeHandle_);
|
||||||
|
} else {
|
||||||
|
setSnapshot(nativeHandle_, 0l);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
private native void setSnapshot(long handle, long snapshotHandle);
|
private native void setSnapshot(long handle, long snapshotHandle);
|
||||||
|
@ -69,6 +69,11 @@ public class SnapshotTest
|
|||||||
// null
|
// null
|
||||||
assert(db.get(readOptions, "newkey".getBytes())
|
assert(db.get(readOptions, "newkey".getBytes())
|
||||||
== null);
|
== null);
|
||||||
|
// setting null to snapshot in ReadOptions leads
|
||||||
|
// to no Snapshot being used.
|
||||||
|
readOptions.setSnapshot(null);
|
||||||
|
assert(new String(db.get(readOptions,
|
||||||
|
"newkey".getBytes())).equals("newvalue"));
|
||||||
// release Snapshot
|
// release Snapshot
|
||||||
db.releaseSnapshot(snapshot);
|
db.releaseSnapshot(snapshot);
|
||||||
// Close database
|
// Close database
|
||||||
|
Loading…
x
Reference in New Issue
Block a user