-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory layer #217
base: master
Are you sure you want to change the base?
Directory layer #217
Conversation
Codecov Report
@@ Coverage Diff @@
## master #217 +/- ##
==========================================
+ Coverage 76.58% 79.53% +2.95%
==========================================
Files 18 24 +6
Lines 3041 4672 +1631
==========================================
+ Hits 2329 3716 +1387
- Misses 712 956 +244
Continue to review full report at Codecov.
|
ce614fe
to
17129a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick review of the code. Looks like you are making good progress 😀
foundationdb/src/directory/mod.rs
Outdated
|
||
let mut new_nodes = self.find_nodes(&trx, new_path.to_owned()).await?; | ||
// assert that parent of the new node exists | ||
if new_nodes.get(new_nodes.len() - 2).is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic if len() < 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I backported the code from the Go binding, and I'm wondering why we cannot move on the root-node. I'll definitely add more restrictions 😄
foundationdb/src/directory/node.rs
Outdated
for fdb_value in fdb_values { | ||
let subspace = Subspace::from_bytes(fdb_value.key()); | ||
// stripping from subspace | ||
let sub_directory: Vec<u8> = self.node_subspace.unpack(subspace.bytes())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You unpack bytes to bytes? hum...
What does fdb_value.key() content is?
Why not unpacking the string directly?
Cpp code does: subdir.unpack(subdirRange[i].key).getString(0)
Which in rust should be equivalent to self.node_subspace.unpack::<(String,)>(key)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not unpacking the string directly?
That is a good question indeed 🤔 I will change this, thanks!
EDIT: after testing, I know why I did this: got a PackError(BadCode { found: 1, expected: Some(2) })
when trying to unpack to (String,). I think 1
stands for the const BYTES: u8 = 0x01; so I must have stored everything in bytes. The keys are generated with subspace.pack(something_in_string.bytes())
, and I did not used the turbofish syntax (love the name 🤣), because I was crafting key's bytes by hand, like I'm used to do in HBase.
I will make some changes and properly create keys that can be easily deserialize. Go's binding is doing this:
tr.Set(parentNode.Sub(_SUBDIRS, path[len(path)-1]), prefix)
And Sub is accepting a TupleElement, so I should be OK regarding binding's compat 😎
Thanks a lot 👍
Thanks for the early review @Speedy37 👍 |
920918a
to
6948175
Compare
I'm having difficulties to grasp the idea of the |
Turns out, my first implementation and mental representation of the Previous commits were not compatible with other bindings, so everything has been manually checked with the |
Great work :) For the bindingtester, you can add the test to https://github.com/Clikengo/foundationdb-rs/blob/master/scripts/run_bindingtester.sh so the CI runs it. test-name is directory I think |
ef0e236
to
852f993
Compare
57afd9a
to
711edff
Compare
Just wanted to share that I'm finally passing a seed 🥳
TODO list updated |
Wow awesome work.
…________________________________
From: Pierre Zemb ***@***.***>
Sent: Tuesday, March 30, 2021 9:58:50 AM
To: Clikengo/foundationdb-rs ***@***.***>
Cc: garren smith ***@***.***>; Mention ***@***.***>
Subject: Re: [Clikengo/foundationdb-rs] [WIP] directory layer (#217)
Just wanted to share that I'm finally passing a seed 🥳
Test with seed 1330929912 and concurrency 1 had 0 incorrect result(s) and 0 error(s) at API version 610
Completed directory test with random seed 1330929912 and 10 operations
TODO list updated
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#217 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABL2ASLWKSI5SNPJPZ2PL3TGGADVANCNFSM4VPL3QPA>.
|
Hey 👋 Last week, as I was digging into some issues on my implementation, I had the idea to go through Flow´s implementation(to be honest, I was only looking at the Go/Java´s code 👅) After discovering that Rust async is closer to Flow than I thought, I decided to erase everything and just backport the Flow´s implementation, which will be more maintainable in my opinion 😄 However, I stumble across two issues related to async and
/// An iterator of keyvalues owned by a foundationDB future
pub struct FdbValuesIter {
f: Rc<FdbFutureHandle>,
keyvalues: *const fdb_sys::FDBKeyValue,
len: i32,
pos: i32,
} and the first two fields are the one not |
Hi, Nice work 👏 About the Send issue, I see 2 ways to try to fix it :
I would personally go for 1 I think. |
Thanks a lot @Speedy37, option 1 worked perfectly 🚀 |
0e8281a
to
a9e07cd
Compare
I finished my first iteration of backporting Flow´s code, now I´m working on making tests passes 😄 |
Most of my tests are passing on most seeds, except when I'm using the |
Still digging 😞 I am experiencing quite some difficulties fixing the last bugs, as fixing one seed is creating new bugs in seeds that used to pass 👅 Most of my mistakes seems to be related to:
I could use some help 😇 If someone is willing to help me, I've marked some faulty seeds here. |
Unblocked, thanks to @Geal 🎉 Got a dedicated computer searching for faulty seed with 10k ops. I will fix them and cleanup the code 😄 |
Provides structures for managing directories in FoundationDB. The FoundationDB API provides directories as a tool for managing related Subspaces. Directories are a recommended approach for administering applications. Each application should create or open at least one directory to manage its subspaces. For general guidance on directory usage, see the discussion in the Developer Guide. Directories are identified by hierarchical paths analogous to the paths in a Unix-like file system. A path is represented as a List of strings. Each directory has an associated subspace used to store its content. The layer maps each path to a short prefix used for the corresponding subspace. In effect, directories provide a level of indirection for access to subspaces.
The bindingtester have been running for 24h+ with 10k ops without finding a faulty seed 😄 I squashed the commits, ready to be reviewed 🎉 As mentionned before, I tried to be as close as possible from the Flow code, but it can be changed. |
I was looking for this functionality today. I see that was a large amount of work. Has been in review for nearly a year. What would be next step for the merge? |
Hi @pierrebelzile 👋 Please note that the development of the crate has moved to the dedicated Github org. The fork is including the directory feature, and several others. Support for FDB 7.1 is also on its way. More info can be found here on why we had to hard fork can be found here. |
Thanks. Can't believe I missed that. Great news and thanks for the work! :) |
This is the PR draft to resolves #27 and based on the initial work done by @garrensmith available on #186.
I wrote some basic tests, but here's a TODO list:
Node
part,layer
verification on the last node before opening,list
,move
,delete
,Add validation that the binding is compatible with othersMy rust is feeling a bit rusty, so feel free to comment 😄
EDIT: I discovered bindingTester while searching for directory validation.