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

fix: parse timestamp from the name of data dir for gc instead of the last update time #1667

Merged
merged 15 commits into from
Nov 7, 2023

Conversation

empiredan
Copy link
Contributor

@empiredan empiredan commented Oct 31, 2023

#1673

It's found that sometimes the data directories of replicas are removed
immediately after they are renamed with postfixes .err/.gar, though
actually both of gc_disk_error_replica_interval_seconds and
gc_disk_garbage_replica_interval_seconds have been configured
with at least one day.

The reason is that the base time for expiration time is the last write
time
, that is, st_mtime within struct stat returned by stat().
Once a long time has passed since the last write time, the data directory
will be removed immediately after it is renamed with postfixes .err/.gar.

To fix this problem, just use the timestamp within the directory name as
the base time that is generated when the data directory is renamed with
postfixes .err/.gar. The last update time would be used iff the timestamp
is NOT found within the directory name.

@github-actions github-actions bot added the cpp label Oct 31, 2023
@empiredan empiredan force-pushed the use-timestamp-for-dir-gc branch from d88b67a to aa5e062 Compare November 2, 2023 05:54
src/replica/disk_cleaner.cpp Show resolved Hide resolved
src/replica/disk_cleaner.cpp Outdated Show resolved Hide resolved
src/replica/disk_cleaner.cpp Outdated Show resolved Hide resolved
acelyc111
acelyc111 previously approved these changes Nov 6, 2023
src/replica/disk_cleaner.cpp Outdated Show resolved Hide resolved
src/replica/disk_cleaner.cpp Outdated Show resolved Hide resolved
@empiredan empiredan merged commit ee369d3 into apache:master Nov 7, 2023
77 checks passed
@empiredan empiredan added the type/bug-fix This PR fixes a bug. label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants