/** * Construct the <code>RocksDbKeyValueReader</code> with store's name, * database's path and Samza's config * * @param storeName name of the RocksDb defined in the config file * @param dbPath path to the db directory * @param config Samza's config */ public RocksDbKeyValueReader(String storeName, String dbPath, Config config) { // get the key serde and value serde from the config JavaStorageConfig storageConfig = new JavaStorageConfig(config); JavaSerializerConfig serializerConfig = new JavaSerializerConfig(config); keySerde = getSerdeFromName(storageConfig.getStorageKeySerde(storeName), serializerConfig); valueSerde = getSerdeFromName(storageConfig.getStorageMsgSerde(storeName), serializerConfig); // get db options Options options = RocksDbOptionsHelper.options(config, 1, new File(dbPath), StorageEngineFactory.StoreMode.ReadWrite); // open the db RocksDB.loadLibrary(); try { db = RocksDB.openReadOnly(options, dbPath); } catch (RocksDBException e) { throw new SamzaException("can not open the rocksDb in " + dbPath, e); } }
long blockCacheSize = getBlockCacheSize(storeConfig, numTasksForContainer); int blockSize = storeConfig.getInt(ROCKSDB_BLOCK_SIZE_BYTES, 4096); BlockBasedTableConfig tableOptions = new BlockBasedTableConfig();
long blockCacheSize = getBlockCacheSize(storeConfig, numTasksForContainer); int blockSize = storeConfig.getInt(ROCKSDB_BLOCK_SIZE_BYTES, 4096); BlockBasedTableConfig tableOptions = new BlockBasedTableConfig();
/** * Construct the <code>RocksDbKeyValueReader</code> with store's name, * database's path and Samza's config * * @param storeName name of the RocksDb defined in the config file * @param dbPath path to the db directory * @param config Samza's config */ public RocksDbKeyValueReader(String storeName, String dbPath, Config config) { // get the key serde and value serde from the config JavaStorageConfig storageConfig = new JavaStorageConfig(config); JavaSerializerConfig serializerConfig = new JavaSerializerConfig(config); keySerde = getSerdeFromName(storageConfig.getStorageKeySerde(storeName), serializerConfig); valueSerde = getSerdeFromName(storageConfig.getStorageMsgSerde(storeName), serializerConfig); // get db options Options options = RocksDbOptionsHelper.options(config, 1); // open the db RocksDB.loadLibrary(); try { db = RocksDB.openReadOnly(options, dbPath); } catch (RocksDBException e) { throw new SamzaException("can not open the rocksDb in " + dbPath, e); } }
long blockCacheSize = getBlockCacheSize(storeConfig, numTasksForContainer); int blockSize = storeConfig.getInt(ROCKSDB_BLOCK_SIZE_BYTES, 4096); BlockBasedTableConfig tableOptions = new BlockBasedTableConfig();
/** * Construct the <code>RocksDbKeyValueReader</code> with store's name, * database's path and Samza's config * * @param storeName name of the RocksDb defined in the config file * @param dbPath path to the db directory * @param config Samza's config */ public RocksDbKeyValueReader(String storeName, String dbPath, Config config) { // get the key serde and value serde from the config JavaStorageConfig storageConfig = new JavaStorageConfig(config); JavaSerializerConfig serializerConfig = new JavaSerializerConfig(config); keySerde = getSerdeFromName(storageConfig.getStorageKeySerde(storeName), serializerConfig); valueSerde = getSerdeFromName(storageConfig.getStorageMsgSerde(storeName), serializerConfig); // get db options Options options = RocksDbOptionsHelper.options(config, 1); // open the db RocksDB.loadLibrary(); try { db = RocksDB.openReadOnly(options, dbPath); } catch (RocksDBException e) { throw new SamzaException("can not open the rocksDb in " + dbPath, e); } }