@Override public void put(String key, Object value) throws FailStoreException { String valueString = JSON.toJSONString(value); WriteOptions writeOpts = new WriteOptions(); try { writeOpts.setSync(true); writeOpts.setDisableWAL(true); db.put(writeOpts, key.getBytes("UTF-8"), valueString.getBytes("UTF-8")); } catch (Exception e) { throw new FailStoreException(e); } finally { writeOpts.dispose(); } }
@Override public void put(String key, Object value) throws FailStoreException { String valueString = JSON.toJSONString(value); WriteOptions writeOpts = new WriteOptions(); try { writeOpts.setSync(true); writeOpts.setDisableWAL(true); db.put(writeOpts, key.getBytes("UTF-8"), valueString.getBytes("UTF-8")); } catch (Exception e) { throw new FailStoreException(e); } finally { writeOpts.dispose(); } }
/** * Creates and initializes a rocks block store. * * @param args inode store arguments */ public RocksInodeStore(InodeStoreArgs args) { mConf = args.getConf(); mBaseDir = mConf.get(PropertyKey.MASTER_METASTORE_DIR); RocksDB.loadLibrary(); mDisableWAL = new WriteOptions().setDisableWAL(true); mReadPrefixSameAsStart = new ReadOptions().setPrefixSameAsStart(true); try { initDb(); } catch (RocksDBException e) { throw new RuntimeException(e); } }
this.kvStateInformation = new LinkedHashMap<>(); this.writeOptions = new WriteOptions().setDisableWAL(true);
public StdSession(HugeConfig conf) { this.closed = false; boolean bulkload = conf.get(RocksDBOptions.BULKLOAD_MODE); this.batch = new WriteBatch(); this.writeOptions = new WriteOptions(); this.writeOptions.setDisableWAL(bulkload); //this.writeOptions.setSync(false); }
/** * If true, writes will not first go to the write ahead log, * and the write may got lost after a crash. * * @param flag a boolean flag to specify whether to disable * write-ahead-log on writes. * @return the instance of the current WriteOptions. */ public WriteOptions setDisableWAL(final boolean flag) { setDisableWAL(nativeHandle_, flag); return this; }
private WriteOptions dataWriteOptions() { if (dataWriteOptions == null) dataWriteOptions = new WriteOptions().setDisableWAL(false); return dataWriteOptions; }
public RocksdbMap() { dbDir = Files.createTempDir(); try { this.db = RocksDB.open(dbDir.getAbsolutePath()); writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); writeOptions.setSync(false); } catch (RocksDBException e) { throw new RuntimeException(e); } }
@Override public void delete(String keySpace, byte[] key) { ByteArray handleName = new ByteArray(keySpace); Preconditions.checkNotNull(cfHandles.get(handleName)); try { dataBatches.get(handleName).remove(new ByteArray(key)); WriteOptions writeOptions = new WriteOptions().setDisableWAL(true); rocksDB.delete(cfHandles.get(handleName), writeOptions, key); } catch(RocksDBException ex) { logger.error("Problem deleting RocksDB record, keySpace: " + keySpace + ", key: " + Hex.encodeHexString(key)); throw new RuntimeException(ex); } }
/** * Creates the RocksDB WriteOptions to use. Since we use RocksDB as an in-process cache with disk spillover, * we do not care about the data being persisted to disk for recovery purposes. As such: * * Write-Ahead-Log is disabled (2.8x performance improvement) * * Sync is disabled - does not wait for a disk flush before returning from the write call (50x or more improvement). */ private WriteOptions createWriteOptions() { return new WriteOptions() .setDisableWAL(true) .setSync(false); }
/** * Builds RocksDb {@link WriteOptions}. * * @param sync * As of RocksDB v3.10.1, no data lost if process crashes even if sync==false. Data * lost only when server/OS crashes. So it's relatively safe to set sync=false for * fast write * @param disableWAL * @return */ public static WriteOptions buildWriteOptions(boolean sync, boolean disableWAL) { WriteOptions writeOptions = new WriteOptions(); writeOptions.setSync(sync).setDisableWAL(disableWAL); return writeOptions; }
/** * Creates a new {@code RocksDBListState}. * * @param namespaceSerializer The serializer for the namespace. * @param stateDesc The state identifier for the state. This contains name * and can create a default state value. */ public RocksDBListState(ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, ListStateDescriptor<V> stateDesc, RocksDBKeyedStateBackend<K> backend) { super(columnFamily, namespaceSerializer, stateDesc, backend); this.valueSerializer = stateDesc.getElementSerializer(); writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); }
/** * Creates a new {@code RocksDBValueState}. * * @param namespaceSerializer The serializer for the namespace. * @param stateDesc The state identifier for the state. This contains name * and can create a default state value. */ public RocksDBValueState(ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc, RocksDBKeyedStateBackend<K> backend) { super(columnFamily, namespaceSerializer, stateDesc, backend); this.valueSerializer = stateDesc.getSerializer(); writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); }
public StdSession(HugeConfig conf) { this.closed = false; boolean bulkload = conf.get(RocksDBOptions.BULKLOAD_MODE); this.batch = new WriteBatch(); this.writeOptions = new WriteOptions(); this.writeOptions.setDisableWAL(bulkload); //this.writeOptions.setSync(false); }
RocksDBMapIterator(final RocksDB db, final byte[] keyPrefixBytes) { this.db = db; this.keyPrefixBytes = keyPrefixBytes; }
private RocksDB db() { if (_db == null) { writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); writeOptions.setSync(false); readOptions = new ReadOptions(); readOptions.setFillCache(false).setVerifyChecksums(false); _db = _dbSupplier.get(); } return _db; }
/** * Creates a new {@code RocksDBReducingState}. * * @param namespaceSerializer The serializer for the namespace. * @param stateDesc The state identifier for the state. This contains name * and can create a default state value. */ public RocksDBReducingState(ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc, RocksDBKeyedStateBackend<K> backend) { super(columnFamily, namespaceSerializer, stateDesc, backend); this.valueSerializer = stateDesc.getSerializer(); this.reduceFunction = stateDesc.getReduceFunction(); writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); }
private RocksDB db() { if (_db == null) { writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); writeOptions.setSync(false); readOptions = new ReadOptions(); readOptions.setFillCache(true).setVerifyChecksums(false); _db = _dbSupplier.get(); } return _db; }
/** * Creates a new {@code RocksDBFoldingState}. * * @param namespaceSerializer The serializer for the namespace. * @param stateDesc The state identifier for the state. This contains name * and can create a default state value. */ public RocksDBFoldingState(ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, FoldingStateDescriptor<T, ACC> stateDesc, RocksDBKeyedStateBackend<K> backend) { super(columnFamily, namespaceSerializer, stateDesc, backend); this.valueSerializer = stateDesc.getSerializer(); this.foldFunction = stateDesc.getFoldFunction(); writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); }
@Override public void put(String key, Object value) throws FailStoreException { String valueString = JSON.toJSONString(value); WriteOptions writeOpts = new WriteOptions(); try { writeOpts.setSync(true); writeOpts.setDisableWAL(true); db.put(writeOpts, key.getBytes("UTF-8"), valueString.getBytes("UTF-8")); } catch (Exception e) { throw new FailStoreException(e); } finally { writeOpts.dispose(); } }