-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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] filer.sync cannot sync emptying chunks correctly if file modified by different clusters #3328
Comments
creeew
changed the title
[BUG] filer.sync cannot sync content correctly when sync emptying chunks
[BUG] filer.sync cannot sync emptying chunks correctly if file modified by different clusters
Jul 18, 2022
I am confused by |
Here's the test case, filer_sink compare old and new entry to get the deleted chunk, but in clusterA cannot delete all chunks if clusterB emptied it's chunks.
|
Thanks for the nice unit test! I added a fix and also add the test to the repo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
ClusterA and ClusterB, using filer.sync to sync files to each other.
In ClusterA's filer mount directory:
touch hello.txt
echo "hello from A" >> hello.txt
In ClusterB's filer mount directory:
echo "hello from B" >> hello.txt
In ClusterA's filer mount directory:
echo "hello from A again" >> hello.txt
In ClusterB's filer mount directory:
echo "hello from B again" > hello.txt
Result:
In ClusterB hello.txt content is "hello from B again",
but in ClusterA hello.txt content is
"
hello from B again
hello from A again"
"
System Setup
Expected behavior
In the last command, echo "hello from B again" > hello.txt, using echo > will overwrite the file content.
We expect the file hello.txt's content is "hello from B again" in ClusterA and ClusterB.
Additional context
command "echo "xx" > file" would produce two event notifications
The bug is caused by the first step: empty file content eventNotification. The ClusterB's emptying all chunks metadata event notify to ClusterA. ClusterA cannot empty all chunks if ClusterA's chunks contain fids uploaded by itself.
ClusterA received empty metadata event from ClusterB:
oldEntry got chunks [fid:1 sid:11, fid2, fid3 sid33], newEntry got nothing chunks
compare old and new chunks to get the deleted chunks
https://github.com/chrislusf/seaweedfs/blob/56ec89625a5d4a66e3b1c810544afd93f449842e/weed/replication/sink/filersink/filer_sink.go#L194
deletedChunks are [fid:1 sid:11, fid2, fid3 sid33]
In ClusterA existingChunks are [fid:11, fid:22 sid:2, fid:33]
existingChunks need to delete deletedChunks by this codes
https://github.com/chrislusf/seaweedfs/blob/56ec89625a5d4a66e3b1c810544afd93f449842e/weed/replication/sink/filersink/filer_sink.go#L202
In this code, matching deleted chunks by source file id, existingChunks are [fid:11, fid:33] after deleting.
We are looking forward emptying all chunks but we got leftover chunks in ClusterA.
The text was updated successfully, but these errors were encountered: