diff --git a/dingo-dist/conf/executor.yaml b/dingo-dist/conf/executor.yaml index 095e525d7b..5fe4280939 100644 --- a/dingo-dist/conf/executor.yaml +++ b/dingo-dist/conf/executor.yaml @@ -14,9 +14,9 @@ variable: autoIncrementIncrement: 1 autoIncrementOffset: 1 store: - bufferSize: 8388608 + bufferSize: 67108864 bufferNumber: 2 - fileSize: 2097152 + fileSize: 67108864 security: cipher: keyPath: /opt/dingo/conf/dingodb.jks diff --git a/dingo-store-local/src/main/java/io/dingodb/store/local/Configuration.java b/dingo-store-local/src/main/java/io/dingodb/store/local/Configuration.java index 421241c360..662cb9e47e 100644 --- a/dingo-store-local/src/main/java/io/dingodb/store/local/Configuration.java +++ b/dingo-store-local/src/main/java/io/dingodb/store/local/Configuration.java @@ -41,9 +41,9 @@ public static Configuration instance() { private String path; - private int bufferSize = 8388608; + private int bufferSize = 67108864; private int bufferNumber = 2; - private int fileSize = 2097152; + private int fileSize = 67108864; public static String path() { return INSTANCE.path; } diff --git a/dingo-store-local/src/main/java/io/dingodb/store/local/StoreInstance.java b/dingo-store-local/src/main/java/io/dingodb/store/local/StoreInstance.java index cf7734e6e3..91f6de3095 100644 --- a/dingo-store-local/src/main/java/io/dingodb/store/local/StoreInstance.java +++ b/dingo-store-local/src/main/java/io/dingodb/store/local/StoreInstance.java @@ -22,6 +22,7 @@ import lombok.AllArgsConstructor; import lombok.SneakyThrows; import org.rocksdb.RocksIterator; +import org.rocksdb.WriteOptions; import java.util.Iterator; import java.util.List; @@ -37,6 +38,7 @@ public class StoreInstance implements io.dingodb.store.api.StoreInstance { public final CommonId regionId; + private static final WriteOptions writeOptions = new WriteOptions().setDisableWAL(true); @Override public CommonId id() { @@ -50,21 +52,21 @@ public boolean put(KeyValue row) { if (StoreService.db.get(row.getKey()) != null) { return false; } - StoreService.db.put(nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES)); + StoreService.db.put(writeOptions, nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES)); return true; } @Override @SneakyThrows public boolean delete(byte[] key) { - StoreService.db.delete(key); + StoreService.db.delete(writeOptions, key); return true; } @Override @SneakyThrows public void deletePrefix(byte[] prefix) { - StoreService.db.deleteRange(prefix, nextKey(prefix)); + StoreService.db.deleteRange(writeOptions, prefix, nextKey(prefix)); } @Override diff --git a/dingo-store-local/src/main/java/io/dingodb/store/local/StoreService.java b/dingo-store-local/src/main/java/io/dingodb/store/local/StoreService.java index fe5f3cf075..9e3e14091e 100644 --- a/dingo-store-local/src/main/java/io/dingodb/store/local/StoreService.java +++ b/dingo-store-local/src/main/java/io/dingodb/store/local/StoreService.java @@ -48,17 +48,11 @@ public class StoreService implements io.dingodb.store.api.StoreService { FileUtils.deleteIfExists(dbPath); FileUtils.createDirectories(dbPath); Options options = new Options(); - options.setNumLevels(1); options.setCreateIfMissing(true); - options.setDisableAutoCompactions(true); options.setWriteBufferSize(Configuration.instance().getBufferSize()); options.setMaxWriteBufferNumber(Configuration.instance().getBufferNumber()); options.setTargetFileSizeBase(Configuration.instance().getFileSize()); - WriteOptions writeOptions = new WriteOptions(); - writeOptions.setDisableWAL(true); rocksdb = RocksDB.open(options, path); - WriteBatch batch = new WriteBatch(); - rocksdb.write(writeOptions, batch) ; } catch (Exception e) { log.info("No local db.", e); }