opendal icon indicating copy to clipboard operation
opendal copied to clipboard

bug(fs): Listing only lists directories and not objects

Open amunra opened this issue 1 year ago • 10 comments

We're using OpenDAL as an abstraction across different services.

We expect things to behave the same across S3, Azure and the filesystem, however we found that it isn't really always the case.

One instance is listing a path.

  • In Azure & S3, listing returns back paths to objects.
  • On the filesystem, objects aren't listed, instead only directories.

amunra avatar Jan 09 '24 14:01 amunra

Are you talking about op.list_with(path).recursive(true)?

Xuanwo avatar Jan 09 '24 14:01 Xuanwo

Would you like to share the opendal verison and your file tree layout and the code to list them?

Xuanwo avatar Jan 09 '24 14:01 Xuanwo

Java code:

    @NotNull
    public static Set<String> listFiles(BlockingOperator client) {
        return client.list("/").stream()
                .map((entry) -> entry.path)
                .collect(Collectors.toSet());
    }

I'm pretty pressed between tasks at the moment and can't produce a full repro, but we dedicate a fresh new directory in our tests and read and write that directory via OpenDAL exclusively.

At certain points we list to assert side-effects and those assertions fail when using fs rather than S3 or Azure.

We've worked around this by checking for object existence by doing a read and the object is there, so I suspect it's a list issue rather than anything else.

Apologies for not being able to provide more context at this point.

Versions.

The software that writes uses:

# Cargo.toml
opendal = "0.42.0"

The software that tests uses:

<!-- pom.xml -->
<dependency>
    <groupId>org.apache.opendal</groupId>
    <artifactId>opendal-java</artifactId>
    <version>0.42.0</version>
    <scope>test</scope>
</dependency>

amunra avatar Jan 09 '24 14:01 amunra

Thanks a lot.

list(/) should return all entires under /. For example:

/
/file_a
/dir_b/file_c

The returning list should be ["file_a", "dir_b/"]. Are you saying that fs only returns dir_b/ but missed file_a? Will this changed after upgrading to our latest 0.44.1?

Xuanwo avatar Jan 09 '24 14:01 Xuanwo

it returns list of top-level directories for fs schema, e.g. from your example we see:

/
/file_a
/dir_b

bluestreak01 avatar Jan 09 '24 17:01 bluestreak01

it returns list of top-level directories for fs schema, e.g. from your example we see:

  • / should not be returned
  • file_a is a file, it's ok to be listed here.
  • dir_b should be present, but it's path should be dir_b/.

I will try to reproduce this and create a behavior test for this.

Xuanwo avatar Jan 10 '24 03:01 Xuanwo

The directory structure is

Permissions Size User      Date Modified Name
drwxr-xr-x     - manjusaka 11 1月  01:43 /tmp/opendal
drwxr-xr-x     - manjusaka 11 1月  01:43 ├── demo
.rw-r--r--     0 manjusaka 11 1月  01:43 │  └── abc
.rw-r--r--     0 manjusaka 11 1月  01:43 └── demo2

The java code

       System.out.println( blockingOp().list("opendal/").stream()
           .map((entry) -> entry.path)
           .collect(Collectors.toSet()));

the results is

[opendal/demo2, opendal/demo/]

Zheaoli avatar Jan 10 '24 18:01 Zheaoli

Hi @amunra, would you like to try 0.45 for verify?

Xuanwo avatar Feb 05 '24 16:02 Xuanwo

Thanks!

It may take me a little while to get back on this one.

At the moment we're stuck with 0.42.0 since we've encountered some yet-undiagnosed bug with S3 with newer releases which only happens with live S3 instances and not our s3s-fs—based mock infra.

amunra avatar Feb 05 '24 17:02 amunra

It may take me a little while to get back on this one.

Got it.

At the moment we're stuck with 0.42.0 since we've encountered some yet-undiagnosed bug with S3 with newer releases which only happens with live S3 instances and not our s3s-fs—based mock infra.

Please let me know if any help we can provide.

Xuanwo avatar Feb 05 '24 17:02 Xuanwo

Hi, I'm going to close this issue now. Feel free to reopen it if the problem persists.

Xuanwo avatar Mar 12 '25 13:03 Xuanwo