/** * Creates and initializes a rocks block store. * * @param args block store args */ public RocksBlockStore(BlockStoreArgs args) { mBaseDir = args.getConfiguration().get(PropertyKey.MASTER_METASTORE_DIR); RocksDB.loadLibrary(); try { initDb(); } catch (RocksDBException e) { throw new RuntimeException(e); } }
RocksDB.loadLibrary();
RocksDB.loadLibrary(); boolean createIfMissing = ObjectReader.getBoolean(config.get(DaemonConfig.STORM_ROCKSDB_CREATE_IF_MISSING), false);
@Before public void setUp() { // remove any previously created cache instance StringMetadataCache.cleanUp(); RocksDB.loadLibrary(); }
/** * 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); } }
public RocksDBState() { RocksDB.loadLibrary(); }
private enum LibraryState { NOT_LOADED, LOADING, LOADED }
/** * Creates a new instance of the RocksDBCacheFactory class. * * @param config The configuration to use. */ public RocksDBCacheFactory(RocksDBConfig config) { Preconditions.checkNotNull(config, "config"); this.config = config; this.caches = new HashMap<>(); this.closed = new AtomicBoolean(); RocksDB.loadLibrary(); log.info("{}: Initialized.", LOG_ID); }
public RocksDbStrings(Path termsPath) { RocksDB.loadLibrary(); try { terms = RocksDB.openReadOnly(termsPath.toString()); } catch (RocksDBException e) { // says "if error happens in underlying native library", can't possible hope to handle that. throw new RuntimeException(e); } }
RocksDBNormalizerModel(Path dbPath) { RocksDB.loadLibrary(); try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) { db = RocksDB.openReadOnly(options, dbPath.toString()); } catch (RocksDBException e) { throw new RuntimeException(e); } }
public RocksDbIdentifiers(Path identifiersPath) { RocksDB.loadLibrary(); try (Options options = new Options().setInfoLogLevel(InfoLogLevel.ERROR_LEVEL)) { indices = RocksDB.openReadOnly(options, identifiersPath.toString()); } catch (RocksDBException e) { throw new RuntimeException(e); } }
static void initialize() throws Exception { RocksDB.loadLibrary(); options = new Options().setCreateIfMissing(true); try { ensureDirectories(); transientStateDB = RocksDB.open(options, transientPath.toString()); failedStateDB = RocksDB.open(options, failedPath.toString()); } catch (RocksDBException | IOException e) { e.printStackTrace(); throw new Exception(e); } }
@Override public SuffixDataStore createSuffixDataStore(int id) { RocksDB.loadLibrary(); try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) { Files.createDirectories(dbPath); RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getSuffixesName(id)).toString()); rocksDBS.add(rocksDB); return new RocksDbSuffixDataStore(rocksDB); } catch (RocksDBException | IOException e) { throw new RuntimeException(e); } }
@Override public KnownWordsDataStore createKnownWordsDataStore(int id) { RocksDB.loadLibrary(); try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) { Files.createDirectories(dbPath); RocksDB rocksDB = RocksDB.open(options, dbPath.resolve(getWordsName(id)).toString()); rocksDBS.add(rocksDB); RocksDB candidatesDB = RocksDB.open(options, dbPath.resolve(getCandidatesName(id)).toString()); rocksDBS.add(candidatesDB); return new RocksDbKnownWordsDataStore(rocksDB, candidatesDB); } catch (RocksDBException | IOException e) { throw new RuntimeException(e); } }
public RocksDBSenseVectors(Path path, boolean forWriting) { RocksDB.loadLibrary(); if (forWriting) { try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()) { rocksDB = RocksDB.open(options, path.toString()); } catch (RocksDBException e) { throw new RuntimeException(e); } } else { try { rocksDB = RocksDB.openReadOnly(path.toString()); } catch (RocksDBException e) { throw new RuntimeException(e); } } }
@Override public void setup(final BenchmarkParams b) throws IOException { super.setup(b); wkb = new UnsafeBuffer(new byte[keySize]); wvb = new UnsafeBuffer(new byte[valSize]); loadLibrary(); final Options options = new Options(); options.setCreateIfMissing(true); options.setCompressionType(NO_COMPRESSION); try { db = open(options, tmp.getAbsolutePath()); } catch (final RocksDBException ex) { throw new IOException(ex); } }
public synchronized RocksDBDataIndexTable getDataIndexTable( final String tableName, final short adapterId) { if (indexWriteOptions == null) { RocksDB.loadLibrary(); final int cores = Runtime.getRuntime().availableProcessors(); indexWriteOptions = new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores); indexReadOptions = new Options().setIncreaseParallelism(cores); } final String directory = subDirectory + "/" + tableName; return dataIndexTableCache.get( (DataIndexCacheKey) keyCache.get(directory, d -> new DataIndexCacheKey(d, adapterId))); }
public synchronized RocksDBIndexTable getIndexTable( final String tableName, final short adapterId, final byte[] partition, final boolean requiresTimestamp) { if (indexWriteOptions == null) { RocksDB.loadLibrary(); final int cores = Runtime.getRuntime().availableProcessors(); indexWriteOptions = new Options().setCreateIfMissing(true).prepareForBulkLoad().setIncreaseParallelism(cores); indexReadOptions = new Options().setIncreaseParallelism(cores); } final String directory = subDirectory + "/" + tableName; return indexTableCache.get( (IndexCacheKey) keyCache.get( directory, d -> new IndexCacheKey(d, adapterId, partition, requiresTimestamp))); }
public DBSharder(String dbpath, Long timestamp) throws RocksDBException { log = LoggerFactory.getLogger(DBSharder.class); RocksDB.loadLibrary(); options = new Options(); env = options.getEnv(); env.setBackgroundThreads(2); options.setEnv(env); options.setCreateIfMissing(true); options.setDbLogDir(dbpath + "/logs/"); options.setMergeOperator(new StringAppendOperator()); db = RocksDB.open(options, dbpath + "/" + timestamp); }
public synchronized RocksDBMetadataTable getMetadataTable(final MetadataType type) { if (metadataOptions == null) { RocksDB.loadLibrary(); metadataOptions = new Options().setCreateIfMissing(true).optimizeForSmallDb(); } final String directory = subDirectory + "/" + type.name(); return metadataTableCache.get( keyCache.get(directory, d -> new CacheKey(d, type.equals(MetadataType.STATS)))); }