myui / btree4j Goto Github PK
View Code? Open in Web Editor NEWDisk-based B+-tree written in Pure Java
License: Apache License 2.0
Disk-based B+-tree written in Pure Java
License: Apache License 2.0
for (int i = 0; i < 1000; i++) {
Value k = new Value(i);
btree.addValue(k, i);
}
IndexConditionBW bw = new IndexConditionBW(new Value(100), new Value(128));
btree.search(bw, callback) will throw exception
throw new IllegalStateException("range scan failed... bug?");
if there are duplicate keys then btree.getValue(dupKey) only gives one value, how to get all?
Hey MyUi,
less an issue, but more a question: How ACID compliant are the methods on the tree (especially atomicity)?
If for example the JVM shuts down (planned or as a fault) during the following method call
btree.addValue(k, v);
would then there be a risk that the whole tree might (a) or parts of the tree (b) might be corrupt or is there no such risk (c)? Any hints regarding the ACID level compliance in the description would be greatly appreciated.
Kind regards,
Borbarad13
Hi,
This is pretty easy to produce: Modify the BtreeIndexTest.testBtreeIndex test. Increase the repeat in the invokeTest method (multiply by 10)
final int repeat = 10000000;
=>
java.lang.IllegalStateException: range scan failed... bug?
at btree4j.BTree.scanRange(BTree.java:365)
at btree4j.BTree.search(BTree.java:333)
at btree4j.BTreeIndex.search(BTreeIndex.java:136)
at btree4j.BTreeIndexTest.invokeTest(BTreeIndexTest.java:181)
at btree4j.BTreeIndexTest.testBTreeIndex(BTreeIndexTest.java:147)
...
By the way, thanks for the great work ๐.
Change the package structure as
Based on my past work
https://github.com/myui/gridool/tree/master/gridool/src/memcached/src/gridool/memcached
or
https://github.com/netty/netty/tree/master/codec-memcache/src/main/java/io/netty/handler/codec/memcache
https://github.com/couchbase/couchbase-jvm-core/tree/master/src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache
Since log4j is deprecated, use SLF4j or java.util.logging for the logging scheme.
I have tried the following code:
BTreeIndex btree = new BTreeIndex(indexFile, false);
btree.init(false);
Random rand = new Random();
for (int i = 0; i < 10000000; i++) {
long nt = System.nanoTime(), val = rand.nextLong();
Value key = new Value(String.valueOf(nt) + val);
Value value = new Value(val);
if (i % 10000 == 0) {
System.out.println(i + " " + key + " " + btree.addValue(key, value));
} else {
btree.addValue(key, value);
}
}
Then in another method I open index file and try to search for keys:
BTreeIndex btree = new BTreeIndex(indexFile, false);
Value val = btree.getValue(new Value("205388120935395-497341292157541218"));
System.out.println(Primitives.getLong(val.getData()));
On first few million, it works, but then throws NullPointerException inside Value class. Am I doing something wrong?
Why don't you remove unnecessary nodes when they become under-occupied? How are you going to deal with a large number of useless branch nodes in tree?
BTreeNode.write and read operation should be atomic for a better Durability (sudden shutdown etc).
To do that, undo log is required.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.