Skip to content

Commit a17a367

Browse files
committed
fix(directory): opening correctly nested directory partitions
1 parent d7a9f0c commit a17a367

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

foundationdb-bindingtester/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ The following configurations are tested and should pass without any issue:
1616
## Directory faulty seed
1717

1818
* Completed directory test with random seed 2807298642 and 849 operations (bad layer, path and list child)
19-
* Completed directory test with random seed 4125992805 and 1000 operations

foundationdb/src/directory/directory_layer.rs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ impl DirectoryLayer {
161161

162162
node.load_metadata(&trx).await?;
163163

164+
println!(
165+
"node under path {:?} exists ? {}, layer = {:?}",
166+
node.current_path,
167+
node.exists(),
168+
node.layer
169+
);
170+
164171
if !node.exists() || node.layer.eq(PARTITION_LAYER) {
165172
return Ok(node);
166173
}
@@ -231,6 +238,7 @@ impl DirectoryLayer {
231238
}
232239

233240
let node = self.find(trx, path.to_owned()).await?;
241+
println!("node exists? {}", node.exists());
234242

235243
if node.exists() {
236244
if node.is_in_partition(false) {
@@ -240,12 +248,24 @@ impl DirectoryLayer {
240248
None => unreachable!("node's subspace is not set"),
241249
Some(s) => s,
242250
};
243-
let dir_space =
244-
self.contents_of_node(subspace_node, node.current_path, node.layer)?;
245-
dir_space
246-
.create_or_open(trx, sub_path.to_owned(), prefix, layer)
247-
.await?;
248-
Ok(dir_space)
251+
match self.contents_of_node(subspace_node, node.current_path, node.layer)? {
252+
DirectoryOutput::DirectorySubspace(_) => unreachable!("already in partition"),
253+
DirectoryOutput::DirectoryPartition(directory_partition) => {
254+
let dir_space = directory_partition
255+
.directory_subspace
256+
.directory_layer
257+
.create_or_open_internal(
258+
trx,
259+
sub_path.to_owned(),
260+
prefix,
261+
layer,
262+
allow_create,
263+
allow_open,
264+
)
265+
.await?;
266+
Ok(dir_space)
267+
}
268+
}
249269
} else {
250270
self.open_internal(layer, &node, allow_open).await
251271
}

0 commit comments

Comments
 (0)