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

log-backup: add mutual execution for log truncating. #49414

Closed
YuJuncen opened this issue Dec 13, 2023 · 2 comments · Fixed by #49469
Closed

log-backup: add mutual execution for log truncating. #49414

YuJuncen opened this issue Dec 13, 2023 · 2 comments · Fixed by #49469
Labels
affects-6.5 affects-7.1 affects-7.5 component/br This issue is related to BR of TiDB. type/enhancement The issue or PR belongs to an enhancement.

Comments

@YuJuncen
Copy link
Contributor

Enhancement

Sometimes, if we are running parallel truncating tasks, we may encounter some strange things: say, a meta file being truncated in one truncate task, but yet another one also wants to delete it. The latter one may finish with a failed deletion and will greatly confuse our users.

@YuJuncen YuJuncen added type/enhancement The issue or PR belongs to an enhancement. affects-6.5 affects-7.1 affects-7.5 labels Dec 13, 2023
@YuJuncen
Copy link
Contributor Author

A simple lock like backup.lock might be good enough. Except for some rare race conditions.

@YuJuncen
Copy link
Contributor Author

For a more general case, we can make interfaces like:

type Locker interface {
  Lock(ctx context.Context, path string, hint string) (UnlockFunc, error)
}

type UnlockFunc func(ctx context.Context) error

And implement the basic backup.lock version for general external storage.
Then we can implement platform-specified version for each storage implementation. Say, ObjectLock for S3, flock for POSIX FS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 affects-7.1 affects-7.5 component/br This issue is related to BR of TiDB. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants