@Override public DBOptions createDBOptions() { return new DBOptions() .setIncreaseParallelism(4) .setUseFsync(false) .setMaxOpenFiles(-1); }
@Override public DBOptions createDbOptions(DBOptions currentOptions) { if (currentOptions == null) currentOptions = new DBOptions(); currentOptions.setCreateIfMissing(true); currentOptions.setCreateMissingColumnFamilies(true); //currentOptions.setMemTableConfig(new HashLinkedListMemTableConfig()); //currentOptions.setStatsDumpPeriodSec(300); //currentOptions.createStatistics(); currentOptions.setAllowOsBuffer(true); currentOptions.setMaxOpenFiles(-1); currentOptions.setMaxBackgroundFlushes(2); currentOptions.setMaxBackgroundCompactions(2); currentOptions.setAllowOsBuffer(false); return currentOptions; }
@Override public DBOptions createDBOptions() { return new DBOptions() .setUseFsync(false); }
/** * Builds RocksDb {@link DBOptions}. * * @param maxBackgroundFlushes * high priority threads, usually 1 or 2 would be enough * @param maxBackgroundCompactions * low priority threads, between 1 - num_cpu_cores * @param maxBackgroundThreads * {@code >= maxBackgroundFlushes, maxBackgroundCompactions} * @param maxLogFileSize * if equal to {@code 0}, write all logs to one file and roll by time * @return */ public static DBOptions buildDbOptions(int maxBackgroundFlushes, int maxBackgroundCompactions, int maxBackgroundThreads, long maxLogFileSize) { DBOptions dbOptions = new DBOptions(); dbOptions.setCreateIfMissing(true).setCreateMissingColumnFamilies(true) .setErrorIfExists(false); dbOptions.setMaxBackgroundFlushes(maxBackgroundFlushes) .setMaxBackgroundCompactions(maxBackgroundCompactions) .setIncreaseParallelism(maxBackgroundThreads); dbOptions.setAllowMmapReads(true).setAllowMmapWrites(true); dbOptions.setMaxOpenFiles(-1); dbOptions.setKeepLogFileNum(100).setLogFileTimeToRoll(3600) .setMaxLogFileSize(maxLogFileSize); return dbOptions; }
options.setLevelZeroFileNumCompactionTrigger(compactionTriggerNum); DBOptions dbOptions = new DBOptions(); dbOptions.setCreateMissingColumnFamilies(true); dbOptions.setCreateIfMissing(true); dbOptions.setMaxBackgroundFlushes(2); dbOptions.setMaxBackgroundCompactions(2); ColumnFamilyOptions familyOptions = new ColumnFamilyOptions(); familyOptions.setTargetFileSizeBase(fileSizeBase);
DBOptions.getDBOptionsFromProps(dbProperties) : new DBOptions(); if (dbOptions == null) { throw new StorageInitializationException("Unable to parse Data Base Options."); dbOptions.setCreateIfMissing(true); dbOptions.setCreateMissingColumnFamilies(true); dbOptions.createStatistics();
DBOptions dbOptions = new DBOptions() .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true) .setIncreaseParallelism(parallelism) .setMaxBackgroundCompactions(maxBackgroundCompactions) .setMaxBackgroundFlushes(maxBackgroundFlushes) .setWalSizeLimitMB(0L) .setMaxTotalWalSize(0L); dbOptions.setMaxSubcompactions(maxSubcompactions); ColumnFamilyOptions cfOptions = new ColumnFamilyOptions() .setCompactionStyle(CompactionStyle.LEVEL)
return RocksDB.open(options, rocksDbDir.toAbsolutePath().toString()); } else { final DBOptions options = new DBOptions() .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true) .setIncreaseParallelism(rocksThreads) .setMaxBackgroundCompactions(rocksThreads) .setInfoLogLevel(InfoLogLevel.INFO_LEVEL); dbOptions = options;
public void initDb(List<Integer> list) throws Exception { LOG.info("Begin to init rocksDB of {}", rootDir); DBOptions dbOptions = null; List<ColumnFamilyDescriptor> columnFamilyNames = new ArrayList<>(); columnFamilyNames.add(new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY)); for (Integer timeout : list) { columnFamilyNames.add(new ColumnFamilyDescriptor(String.valueOf(timeout).getBytes())); } List<Integer> ttlValues = new ArrayList<>(); // Default column family with infinite TTL // NOTE that the first must be 0, RocksDB.java API has this limitation ttlValues.add(0); // new column family with list second ttl ttlValues.addAll(list); try { dbOptions = new DBOptions().setCreateMissingColumnFamilies(true).setCreateIfMissing(true); List<ColumnFamilyHandle> columnFamilyHandleList = new ArrayList<>(); ttlDB = TtlDB.open(dbOptions, rootDir, columnFamilyNames, columnFamilyHandleList, ttlValues, false); for (int i = 0; i < ttlValues.size(); i++) { windowHandlers.put(ttlValues.get(i), columnFamilyHandleList.get(i)); } LOG.info("Successfully init rocksDB of {}", rootDir); } finally { if (dbOptions != null) { dbOptions.dispose(); } } }
final boolean safeToUseMMappedFiles = !isWindows; org.rocksdb.DBOptions dbOptions = new org.rocksdb.DBOptions(); dbOptions.setCreateIfMissing(true)// .setAdviseRandomOnOpen(true)// .setAllowMmapReads(safeToUseMMappedFiles)// .setAllowMmapWrites(safeToUseMMappedFiles)// .setBytesPerSync(64 * 1024 * 1024); (ba) -> new String(ba, Charsets.UTF_8)); } catch (RocksDBException e) { dbOptions.close(); throw Throwables.propagate(e);
); DBOptions options = new DBOptions() .setAllowConcurrentMemtableWrite(false) .setMaxOpenFiles(-1) .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true);
tableConfig.setChecksumType(DEFAULT_CHECKSUM_TYPE); dbOpts = new DBOptions(); dbOpts.setCreateIfMissing(true); dbOpts.setErrorIfExists(false); dbOpts.setInfoLogLevel(DEFAULT_LOG_LEVEL); dbOpts.setIncreaseParallelism(DEFAULT_PARALLELISM); dbOpts.setCreateMissingColumnFamilies(true);
); DBOptions options = new DBOptions() .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true);
protected ZeebeRocksDb<ColumnFamilyType> open( final File dbDirectory, List<byte[]> columnFamilyNames) { final ZeebeRocksDb<ColumnFamilyType> db; try { final List<AutoCloseable> closeables = new ArrayList<>(); final ColumnFamilyOptions columnFamilyOptions = createColumnFamilyOptions(); closeables.add(columnFamilyOptions); final List<ColumnFamilyDescriptor> columnFamilyDescriptors = createFamilyDescriptors(columnFamilyNames, columnFamilyOptions); final DBOptions dbOptions = new DBOptions() .setCreateMissingColumnFamilies(true) .setErrorIfExists(false) .setCreateIfMissing(true); closeables.add(dbOptions); db = ZeebeRocksDb.openZbDb( dbOptions, dbDirectory.getAbsolutePath(), columnFamilyDescriptors, closeables, columnFamilyTypeClass); } catch (final RocksDBException e) { throw new RuntimeException("Unexpected error occurred trying to open the database", e); } return db; }
try (final DBOptions dboptions = new DBOptions()) { dboptions.setCreateIfMissing(true); dboptions.setWalSizeLimitMB(0); dboptions.setWalTtlSeconds(WAL_TTL_SECONDS); LOGGER.debug("WAL settings: size: '{} MB', TTL: '{}' seconds", dboptions.walSizeLimitMB(), dboptions.walTtlSeconds());
/** * Gets the RocksDB {@link DBOptions} to be used for all RocksDB instances. */ public DBOptions getDbOptions() { // initial options from pre-defined profile DBOptions opt = predefinedOptions.createDBOptions(); // add user-defined options, if specified if (optionsFactory != null) { opt = optionsFactory.createDBOptions(opt); } // add necessary default options opt = opt.setCreateIfMissing(true); return opt; }
public RocksdbNodeStore(Supplier<RocksDB> db) { this._dbSupplier = db; this.batchOptions = new DBOptions(); }
public static RocksDbKeyValueService create(String dataDir, Map<String, String> dbOptions, Map<String, String> cfOptions, WriteOpts writeOpts, String comparator) { DBOptions dbOpts = new DBOptions().setCreateIfMissing(true); setReflectionOpts(dbOpts, dbOptions); ColumnFamilyOptions cfMetadataOpts = new ColumnFamilyOptions(); setReflectionOpts(cfMetadataOpts, cfOptions); ColumnFamilyOptions cfCommonOpts; switch (comparator) { case "atlasdb-v2": cfCommonOpts = new ColumnFamilyOptions().setComparator(RocksComparator.INSTANCE); break; case "atlasdb": cfCommonOpts = new ColumnFamilyOptions().setComparator(RocksOldComparator.INSTANCE); break; default: throw new IllegalArgumentException("Unknown comparator " + comparator); } setReflectionOpts(cfCommonOpts, cfOptions); return create(dataDir, dbOpts, cfMetadataOpts, cfCommonOpts, writeOpts); }
@Override public DBOptions createDBOptions() { return new DBOptions() .setUseFsync(false) .setDisableDataSync(true); }