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

Refactoring of FileState loading for Prospector #1558

Merged
merged 1 commit into from
May 4, 2016

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented May 3, 2016

Previously the file state was loaded from disk every time a new file was found. The state from the registry file is now only loaded once during startup and from the one the prospector internal in memory state is used. This is more efficient and prevents race conditions.

This can have one side affect. In case a shared file system is not available during a restart and becomes available later, all files are read from the start again as the state for these files was not loaded. Only the state for files which are found during startup (rotated or not) are loaded.

This is related to #1022

Changes:

  • Registry only loaded once during startup
  • File Stats are only read once and reuse during one scan
  • No state for empty files is written
  • Additional tests to confirm changes were added

More cleanup and variable renaming is needed in a next step, as parts in registrar and prospector can now be simplified.

Previously the file state was loaded from disk every time a new file was found. The state from the registry file is now only loaded once during startup and from the one the prospector internal in memory state is used. This is more efficient and prevents race conditions.

This can have one side affect. In case a shared file system is not available during a restart and becomes available later, all files are read from the start again as the state for these files was not loaded. Only the state for files which are found during startup (rotated or not) are loaded.

This is related to elastic#1022

Changes:
* Registry only loaded once during startup
* File Stats are only read once and reuse during one scan
* No state for empty files is written
* Additional tests to confirm changes were added

logp.Info("Load previous states from registry into memory")

for path, fileinfo := range p.getFiles() {
Copy link

Choose a reason for hiding this comment

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

so we do not read files from registry that have not been found on startup? What happens if file re-appears?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Starts from the beginning. See also discussion here: #1022 (comment)

@ruflin
Copy link
Contributor Author

ruflin commented May 3, 2016

jenkins, test it

@tsg tsg merged commit ca5972a into elastic:master May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants