Comments (5)
Hmm, yeah. The C++ Next
method is annotated with a REQUIRES: Valid()
comment. Valid()
is indeed returning false
here, so calling Next
is not permitted:
I suppose the problem here might simply be that in a C++ API it is typically considered to be perfectly acceptable for something to segfault if a user disregards such requirements whereas in Rust it would be considered unsound for a function that isn't marked as unsafe
.
I suspect that the Rust interface for the raw iterator might have to be changed to automatically perform valid
calls before next
and prev
. Alternatively the next
and prev
functions could be marked as unsafe
. It looks like a similar check is already in place in key
and value
. Will probably eat a bit of CPU cycles for no good reason to also do it in next
/prev
, though not sure whether it'd be significant.
from rust-rocksdb.
Atomic loading a null 0x0 address? Looks like a rocksdb bug. Does this occur if testing with c++ rocksdb of the same version?
from rust-rocksdb.
@athre0z good catch 👍🏻
from rust-rocksdb.
In cpp I've got the same result:
#include <rocksdb/db.h>
using namespace rocksdb;
int main() {
DB *db = nullptr;
Options options;
options.create_if_missing = true;
auto status = DB::Open(options, "/tmp/dddd", &db);
assert(status.ok());
auto iter = db->NewIterator(ReadOptions());
iter->Next();
return 0;
}
Result:
Current executable set to 'с++/cmake-build-debug/cpp-playground' (arm64).
(lldb) r
Process 9702 launched: 'с++/cmake-build-debug/cpp-playground' (arm64)
Process 9702 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001010246fc librocksdb.8.dylib`rocksdb::(anonymous namespace)::SkipListRep::Iterator::Next() + 4
librocksdb.8.dylib`rocksdb::(anonymous namespace)::SkipListRep::Iterator::Next:
-> 0x1010246fc <+4>: ldapr x8, [x8]
0x101024700 <+8>: str x8, [x0, #0x10]
0x101024704 <+12>: ret
librocksdb.8.dylib`rocksdb::(anonymous namespace)::SkipListRep::Iterator::~Iterator:
0x101024708 <+0>: stp x20, x19, [sp, #-0x20]!
Target 0: (cpp-playground) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x00000001010246fc librocksdb.8.dylib`rocksdb::(anonymous namespace)::SkipListRep::Iterator::Next() + 4
frame #1: 0x0000000100f5b6d0 librocksdb.8.dylib`rocksdb::MemTableIterator::Next() + 64
frame #2: 0x0000000100f5b718 librocksdb.8.dylib`rocksdb::MemTableIterator::NextAndGetResult(rocksdb::IterateResult*) + 36
frame #3: 0x0000000100f1f034 librocksdb.8.dylib`rocksdb::DBIter::Next() + 308
frame #4: 0x00000001000054b4 cpp-playground`main at main.cpp:27:11
frame #5: 0x000000018cf7d058 dyld`start + 2224
from rust-rocksdb.
Valid call seems very cheap, just returning a flag:
https://github.com/facebook/rocksdb/blob/543191f2eacadf14e3aa6ff9a08f85a8ad82da95/db/db_iter.h#L144
from rust-rocksdb.
Related Issues (20)
- Build broken for 0.8.3+7.4.4 HOT 1
- Is WriteBatchWithIndex supported? HOT 4
- `delete_range` and `delete_range_cf` not implemented for `TransactionDB` or `OptimisticTransactionDB` HOT 3
- multi-threaded-cf feature produces incompatible API--does not adhere to docs.rust-lang.org guidelines
- write_opt consumes WriteBatch
- Request to be added as a maintainer HOT 4
- Why librocksdb-sys recompilation not cached?
- plan to new release version? HOT 6
- [security] cargo audit found vulnerabilities HOT 1
- is FlushOptions missing Send and Sync impl's?
- enabling the jemalloc feature doesn't actually enable jemalloc HOT 12
- error: failed to run custom build command for `librocksdb-sys v0.8.0+7.4.4` (arch linux) HOT 6
- Fail to build on Windows msys2 rust (x86_64-pc-windows-gnu toolchain) HOT 1
- flush isn't exposed for TransactionDB
- compaction_filter on a column family not triggered HOT 1
- Failed to build using Clang-18
- why `share_table_files` option is not support?
- TransactionDB `open_default` panic HOT 5
- Support for RocksDB 9.X HOT 1
- Way to ensure checkpoint is completed? 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 rust-rocksdb.