Comments (5)
If you want to explicitly use Column Families, you should pass the descriptors when you open the db, in return you will get back a set of handles that you can reuse for get/put.
Otherwise, if you don't want to explicitly use Column Families, you can just call -
byte[] value = db.get(KEY);
...
db.put(KEY, value);
from rocksdb.
I thought that was the case, but I recall receiving exception saying that column family canβt be null when using the get (KEY) API. Let me try again.
from rocksdb.
@adamretter I updated the code as per your suggestion to
try {
byte[] value = db.get(KEY);
if (value == null) {
value = ByteBuffer.allocate(4).putInt(1).array();
} else {
value = ByteBuffer.allocate(4).putInt(ByteBuffer.wrap(value).getInt() + 1).array();
}
db.put(KEY, value);
return "SUCCESS";
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
I still get SIGSEGV
. If i'm not using column families explicitly in my API calls, do I still need to register the default column family upon DB open?
from rocksdb.
@vsrivatsan89 I just took a closer look at your earlier code:
try (final Options options = new Options().setCreateIfMissing(true)) {
try (final RocksDB db = RocksDB.open(options, "/mnt/test")) {
log.info("Successfully loaded RocksDB");
return db;
} catch (RocksDBException e) {
log.info("Exception in loading RocksDB");
throw new RuntimeException(e);
}
}
This is invalid! Your code will call db.close()
and then options.close()
before returning the db
object.
from rocksdb.
@adamretter Bah! Sorry about the silly mistake and wasting your time. Thank you for your patience.
from rocksdb.
Related Issues (20)
- Documentation is unclear about manual_wal_flush with WriteOptions::sync and without two_write_queues HOT 1
- Changes in noise in regression test results
- Missing documentation - How To Backup RocksDB page HOT 2
- delta snapshots computation HOT 9
- How can I get the default CF_handle by C API? HOT 2
- A question about the use of kTypeMerge in BlobDB. HOT 1
- How to delete .log file HOT 2
- RocksJava - Options cannot be instantiated directly HOT 1
- Opening LevelDB with corrupted MANIFEST-0* file HOT 6
- when to use checkpoint vs opening rocksdb in read only mode HOT 4
- CancelAllBackgroundWork: Flush of unpersisted data waits for stall conditions to clear and delays db close HOT 2
- Installation documentation for OSX is out of date HOT 3
- ArenaTest.UnmappedAllocation fails when "transparent hugepage" is enabled.
- API request: SeekForBase
- Master branch unable to find zstd HOT 1
- unexplained sudden increase in memory usage HOT 14
- DirectIO WAL Write does not honor DBOptions.use_fsync HOT 2
- New LZ4 encoding HOT 1
- release 8.10.2 on maven central HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocksdb.