Skip to content
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

The FsBackend only writes partial bytes and doesn't raise any errors #3052

Closed
WenyXu opened this issue Sep 13, 2023 · 3 comments
Closed

The FsBackend only writes partial bytes and doesn't raise any errors #3052

WenyXu opened this issue Sep 13, 2023 · 3 comments

Comments

@WenyXu
Copy link
Member

WenyXu commented Sep 13, 2023

We designed some chaos tests, which simulate what problems will occur when the disk is full.

Prepares

fallocate -l 512K disk.img 
mkfs disk.img 
mkdir ./td
sudo mount -o loop td.img ./td
chmod a+wr ./td

Codes

#[tokio::test(flavor = "multi_thread")]
async fn object_store_write() {
    let mut builder = object_store::services::Fs::default();
    let root_dir = "/tmp/chaos/td/";

    let _ = builder.root(root_dir);
    let store = ObjectStore::new(builder).unwrap().finish();

    // XKB
    let data = [96u8; 1024 * 512]; // The writable was smaller than 512KB
    store.write("/test", data.to_vec()).await.unwrap();
}

The test was expected to raise no space errors, but it didn't.

test tests::standalone_read_write::object_store_write ... ok

However, if we check the written file, it only contains partial bytes.

➜  td ls -lh  
total 448K
drwx------ 2 root root  16K Sep 13 08:28 lost+found
-rw-rw-r-- 1 weny weny 428K Sep 13 09:10 test

See also: tokio-rs/tokio#6005

@Xuanwo
Copy link
Member

Xuanwo commented Sep 13, 2023

Thanks for the report! I will take a look and add a test in CI for fs.

@WenyXu
Copy link
Member Author

WenyXu commented Sep 13, 2023

Thanks for the report! I will take a look and add a test in CI for fs.

Let me submit a PR for quick-fix.

@Xuanwo
Copy link
Member

Xuanwo commented Sep 14, 2023

This issus has been fixed by @WenyXu in #3053. We will continue the work at #3062

@Xuanwo Xuanwo closed this as completed Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants