S3FileSystem.checksum always returns cached value
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1k
- Forks
- 305
- Avg merge
- 22h 37m
- Merged PRs (30d)
- 4
Description
Hi,
Encountered this unexpected behavior when using the checksum method to monitor changes in a file in a long-running app.
Description
S3FileSystem.checksum returns the same value for an object, even after the object has changed
Reproduce steps
- Create object
s3://MY_BUCKET/MY_OBJECTon s3 - Run
import s3fs
fs=s3fs.S3FileSystem()
fs.checksum("s3://MY_BUCKET/foo")
- Overwrite the object with new contents (not using
fs, but using e.g. the aws cli) - In the same Python process as above, run
fs.checksum("s3://MY_BUCKET/MY_OBJECT")
The results from 2 and 4 are identical, even though the file has changed.
Cause
It seems that checksum uses the default implementation of fsspec.AbstractFileSystem, which in turn creates the checksum from the output of fs.ls(detail=True). Since in the S3FileSystem implementation this gets passed a default argument refresh=False, the checksum is always computed on cached results.
Proposed solution
checksum should be implemented in S3FileSystem, in such a way that it always checks the actual state of the object, or at least provides the option to do so.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at S3FileSystem.checksum and compare it with fsspec.AbstractFileSystem's default checksum implementation, then trace fs.ls(detail=True) and its refresh=False default. Reproduce the external overwrite in one Python process; done means a later checksum can reflect the changed object, or an explicit refresh option is documented and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100