MCPcopy Create free account
hub / github.com/bytedance/terarkdb / flush

Method flush

java/src/test/java/org/rocksdb/FlushTest.java:23–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 public TemporaryFolder dbFolder = new TemporaryFolder();
22
23 @Test
24 public void flush() throws RocksDBException {
25 try(final Options options = new Options()
26 .setCreateIfMissing(true)
27 .setMaxWriteBufferNumber(10)
28 .setMinWriteBufferNumberToMerge(10);
29 final WriteOptions wOpt = new WriteOptions()
30 .setDisableWAL(true);
31 final FlushOptions flushOptions = new FlushOptions()
32 .setWaitForFlush(true)) {
33 assertThat(flushOptions.waitForFlush()).isTrue();
34
35 try(final RocksDB db = RocksDB.open(options,
36 dbFolder.getRoot().getAbsolutePath())) {
37 db.put(wOpt, "key1".getBytes(), "value1".getBytes());
38 db.put(wOpt, "key2".getBytes(), "value2".getBytes());
39 db.put(wOpt, "key3".getBytes(), "value3".getBytes());
40 db.put(wOpt, "key4".getBytes(), "value4".getBytes());
41 assertThat(db.getProperty("rocksdb.num-entries-active-mem-table"))
42 .isEqualTo("4");
43 db.flush(flushOptions);
44 assertThat(db.getProperty("rocksdb.num-entries-active-mem-table"))
45 .isEqualTo("0");
46 }
47 }
48 }
49}

Calls 10

openMethod · 0.95
setDisableWALMethod · 0.80
setWaitForFlushMethod · 0.80
isTrueMethod · 0.80
waitForFlushMethod · 0.80
getPropertyMethod · 0.80
setCreateIfMissingMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected