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: Anti-Entropy loops endlessly with empty shard #21275

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

davidby-influx
Copy link
Contributor

The anti-entropy service will loop trying to copy an empty shard to a
data node missing that shard. This fix is one of two changes that
correctly create an empty shard on a new node.

Fixes: #21273

This fix will set the LastModified date of an empty shard directory to the
modification time of that directory, instead of to the Unix epoch.

The anti-entropy service will loop trying to copy an empty shard to a
data node missing that shard.  This fix is one of two changes that
correctly create an empty shard on a new node. This fix will set the
LastModified date of an empty shard directory to the modificaiton time
of that directory, instead of to the Unix epoch.

Fixes: #21273
}
if isEmpty {
if fi, err := os.Stat(f.dir); err == nil {
f.lastModified = fi.ModTime().UTC()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it need to account for tombstones? I'm not sure. TSMReader appears to: https://github.com/influxdata/influxdb/blob/master-1.x/tsdb/engine/tsm1/reader.go#L527

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it does account for tombstones. In the loop here, res.r.LastModfied() checks the tombstones, so the directory modification time is only used if the readerC channel is completely empty.

Copy link
Contributor

@dgnorton dgnorton left a comment

Choose a reason for hiding this comment

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

lgtm

@davidby-influx davidby-influx merged commit 7f300dc into master-1.x Apr 23, 2021
@davidby-influx davidby-influx deleted the DSB_repeatrepair_1824 branch April 23, 2021 16:06
davidby-influx added a commit that referenced this pull request Apr 23, 2021
The anti-entropy service will loop trying to copy an empty shard to a
data node missing that shard.  This fix is one of two changes that
correctly create an empty shard on a new node. This fix will set the
LastModified date of an empty shard directory to the modification time
of that directory, instead of to the Unix epoch.

Fixes: #21273
(cherry picked from commit 7f300dc)
davidby-influx added a commit that referenced this pull request Apr 26, 2021
The anti-entropy service will loop trying to copy an empty shard to a
data node missing that shard.  This fix is one of two changes that
correctly create an empty shard on a new node. This fix will set the
LastModified date of an empty shard directory to the modification time
of that directory, instead of to the Unix epoch.

Fixes: #21273
(cherry picked from commit 7f300dc)
davidby-influx added a commit that referenced this pull request Apr 27, 2021
The anti-entropy service will loop trying to copy an empty shard to a
data node missing that shard.  This fix is one of two changes that
correctly create an empty shard on a new node. This fix will set the
LastModified date of an empty shard directory to the modification time
of that directory, instead of to the Unix epoch.

Fixes: #21273
(cherry picked from commit 7f300dc)
@davidby-influx davidby-influx mentioned this pull request Apr 27, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anti-Entropy loops endlessly with empty shard
2 participants