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

bug: opendal state store may not operate atomically #15154

Closed
BugenZhao opened this issue Feb 20, 2024 · 5 comments
Closed

bug: opendal state store may not operate atomically #15154

BugenZhao opened this issue Feb 20, 2024 · 5 comments
Assignees
Labels
component/meta Meta related issue. component/storage Storage type/bug Something isn't working
Milestone

Comments

@BugenZhao
Copy link
Member

Operations on S3/OSS are always atomic. For example, we'll never get partial objects uploaded to the object store.

However, this is not true for all opendal services by default. We may get the data corrupted if users are using opendal state store like hummock+fs://... This may lead to unexpected results as we also leverage state store for Hummock metadata management.

It turns out that we should manually enable atomicity guarantee by setting the atomic_write_dir config when building services.
https://docs.rs/opendal/latest/opendal/services/struct.Fs.html#method.atomic_write_dir

@BugenZhao BugenZhao added type/bug Something isn't working component/meta Meta related issue. component/storage Storage labels Feb 20, 2024
@github-actions github-actions bot added this to the release-1.7 milestone Feb 20, 2024
@wcy-fdu wcy-fdu self-assigned this Feb 20, 2024
@hzxa21
Copy link
Collaborator

hzxa21 commented Feb 20, 2024

If atmoic_write_dir is not set, is it possible to have a object that is present in metadata (e.g. HummockVersion) but absent in the object store (e.g. HDFS)?

@BugenZhao
Copy link
Member Author

If atmoic_write_dir is not set, is it possible to have a object that is present in metadata (e.g. HummockVersion) but absent in the object store (e.g. HDFS)?

I think it depends. If a future cancellation or node crash occurs during the procedure, and there is also no defensive programming on the next startup, things could get wrong.

The recent issue reported by a user is getting an empty file at the version_checkpoint_path on the file system. Note that an empty slice is also a valid proto3 encoding, we finally panicked at unwrapping a required protobuf field and failed to make any progress. I suppose there was a failure when updating the checkpoint object in write_checkpoint.

version: HummockVersion::from_persisted_protobuf(checkpoint.version.as_ref().unwrap()),

self.object_store
.upload(&self.version_checkpoint_path, buf.into())
.await?;

@hzxa21
Copy link
Collaborator

hzxa21 commented Feb 20, 2024

If atmoic_write_dir is not set, is it possible to have a object that is present in metadata (e.g. HummockVersion) but absent in the object store (e.g. HDFS)?

I think it depends. If a future cancellation or node crash occurs during the procedure, and there is also no defensive programming on the next startup, things could get wrong.

The recent issue reported by a user is getting an empty file at the version_checkpoint_path on the file system. Note that an empty slice is also a valid proto3 encoding, we finally panicked at unwrapping a required protobuf field and failed to make any progress. I suppose there was a failure when updating the checkpoint object in write_checkpoint.

version: HummockVersion::from_persisted_protobuf(checkpoint.version.as_ref().unwrap()),

self.object_store
.upload(&self.version_checkpoint_path, buf.into())
.await?;

I see. I understand that this issue will cause the file content of an object to be empty or incorrect. We are debugging another case reported by a user when there is an object that is present in HummockVersion but absent in HDFS. I guess it is not relevant to this issue?

@BugenZhao
Copy link
Member Author

I see. I understand that this issue will cause the file content of an object to be empty or incorrect. We are debugging another case reported by a user when there is an object that is present in HummockVersion but absent in HDFS. I guess it is not relevant to this issue?

I have no idea. 😕

@wcy-fdu
Copy link
Contributor

wcy-fdu commented Feb 26, 2024

fixed in #15155

@wcy-fdu wcy-fdu closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/meta Meta related issue. component/storage Storage type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants