-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Migrate registry from previous incorrect path #10486
Conversation
71aceda
to
8060df4
Compare
8060df4
to
a9d4955
Compare
journalbeat/checkpoint/checkpoint.go
Outdated
return err | ||
} | ||
|
||
err = helper.SafeFileRotate(c.file, c.file+".bak") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should close the files before calling SafeFileRotate
. Also check that Close
does not error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Donz.
journalbeat/checkpoint/checkpoint.go
Outdated
|
||
err = f.Close() | ||
if err != nil { | ||
return fmt.Errorf("error closing old registry file: %+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you still need to close target
if this one fails.'
Why do we need to copy anyways? Isn't SafeFileRotate in order to move the file good enough?
The use of SafeFileRotate
suggests a backup file is written and then rotated to c.file
. When is c.file+".bak"
written?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a mistake from me. I removed it, because it was unnecessary.
err = target.Close() | ||
if err != nil { | ||
return fmt.Errorf("error closing new registry file: %+v", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the copy is not 'safe' without extra call to target.Sync()
. Some filesystems (without journaling) also require a sync operation on the parent directory in order to sync file + directory meta data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Donz.
b9b2f74
to
6fc47dd
Compare
6166aaf
to
5c73b8e
Compare
pf, _ := os.Open(p) | ||
if err != nil { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; pf, err := os.Open(p)
.
All relevant tests are green. |
In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings. This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x. (cherry picked from commit 9499811)
In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings. This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x. (cherry picked from commit 9499811)
In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings. This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x. (cherry picked from commit 9499811)
In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings. This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x.
…rrect path (elastic#10597) In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings. This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x. (cherry picked from commit 9499811)
In 6.x Journalbeat placed its registry file under the wrong path ignoring the data.path settings.
This patch lets users migrate from registries under such paths when upgrading from 6.x to 7.x.