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

Update superblock when changing replication #4975

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zehweh
Copy link
Contributor

@zehweh zehweh commented Nov 2, 2023

What problem are we solving?

.vif file and superblock are not in sync, see issue #4944

With this PR, the superblock gets updated when the replication is changed using weed shell

It is basically the code from seaweedfs/unmaintained/change_superblock/change_superblock.go

I'm not sure if ConfigureVolume() is the best place to do this or if VolumeConfigure() in volume_grpc_admin.go if better.
So feel free to make changes :)

@@ -557,6 +559,25 @@ func (s *Store) ConfigureVolume(i needle.VolumeId, replication string) error {
if err != nil {
return fmt.Errorf("volume %d failed to save vif: %v", i, err)
}
// update superblock
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please refactor this to a function, and just print a warning instead of failing in the middle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, refactoring this into a function makes sense.
But I don't see why printing a warning here makes sense. If a problem occurs while loading or saving the ".vif", it fails with an error, so updating the superblock should be done the same way?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be only one source of truth, which is the .vif file.

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

Successfully merging this pull request may close these issues.

None yet

2 participants