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

ticdc redo log seems to use S3 in an inefficient style #5924

Closed
4 tasks done
Tracked by #5920
hicqu opened this issue Jun 20, 2022 · 1 comment · Fixed by #6262
Closed
4 tasks done
Tracked by #5920

ticdc redo log seems to use S3 in an inefficient style #5924

hicqu opened this issue Jun 20, 2022 · 1 comment · Fixed by #6262
Labels
question Further information is requested. type/enhancement The issue or PR belongs to an enhancement.

Comments

@hicqu
Copy link
Contributor

hicqu commented Jun 20, 2022

Before asking a question, make sure you have

What is your question?

The code is in cdc/redo/writer/file.go.

In Writer.Flush, Writer.writeToS3 will be finally called.

func (w *Writer) writeToS3(ctx context.Context, name string) error {
    fileData, err := os.ReadFile(name)
    return cerror.WrapError(cerror.ErrS3StorageAPI, w.storage.WriteFile(ctx, filepath.Base(name), fileData))
}

So if writeToS3 is called multiple times on one local file, same content will be put to S3 multiple times. It will waste lots of network traffic resource.

And, writeToS3 is called with a temp path. After a S3 log file is rotated, it will be renamed with Write.renameInS3(path.tmp, path). However S3 doesn't have a built-in rename API, so the rename operation is very expensive. We can check it here.

Please help me to confirm whether my investigation is correct or not, thanks!

@hicqu hicqu added the question Further information is requested. label Jun 20, 2022
@ti-chi-bot ti-chi-bot added the type/enhancement The issue or PR belongs to an enhancement. label Jun 20, 2022
@zhaoxinyu
Copy link
Contributor

closed by #6262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants