Skip to content

Commit 9ba2124

Browse files
committed
fix(directory): properly handle list with nested directory partition
1 parent 1e46135 commit 9ba2124

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

foundationdb-bindingtester/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ The following configurations are tested and should pass without any issue:
1515

1616
## Directory faulty seed
1717

18-
* Completed directory test with random seed 2807298642 and 849 operations (bad layer, path and list child)
18+
* Completed directory test with random seed 3642303358 and 6538 operations (should fire directory errors)

foundationdb/src/directory/directory_layer.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,27 +564,34 @@ impl DirectoryLayer {
564564
trx: &Transaction,
565565
path: Vec<String>,
566566
) -> Result<Vec<String>, DirectoryError> {
567+
println!("listing path {:?} with self.path={:?}", &path, &self.path);
567568
self.check_version(trx, false).await?;
568569

569570
let node = self.find(trx, path.to_owned()).await?;
570571
if !node.exists() {
571572
return Err(DirectoryError::PathDoesNotExists);
572573
}
573-
if node.is_in_partition(false) {
574+
if node.is_in_partition(true) {
574575
let subspace_node = match node.subspace {
575576
// not reachable because `self.find` is creating a node with a subspace.
576577
None => unreachable!("node's subspace is not set"),
577578
Some(ref s) => s.clone(),
578579
};
579580

580-
let directory_partition = self.contents_of_node(
581+
match self.contents_of_node(
581582
subspace_node,
582583
node.current_path.to_owned(),
583584
node.layer.to_owned(),
584-
)?;
585-
return directory_partition
586-
.list(trx, node.get_partition_subpath())
587-
.await;
585+
)? {
586+
DirectoryOutput::DirectorySubspace(_) => unreachable!("already in partition"),
587+
DirectoryOutput::DirectoryPartition(directory_partition) => {
588+
return directory_partition
589+
.directory_subspace
590+
.directory_layer
591+
.list(trx, node.get_partition_subpath())
592+
.await
593+
}
594+
};
588595
}
589596

590597
Ok(node.list_sub_folders(trx).await?)

0 commit comments

Comments
 (0)