Skip to content

Modify clean_removed handling#3827

Merged
7AC merged 2 commits intoelastic:masterfrom
ruflin:improved-clean-removed
Apr 18, 2017
Merged

Modify clean_removed handling#3827
7AC merged 2 commits intoelastic:masterfrom
ruflin:improved-clean-removed

Conversation

@ruflin
Copy link
Copy Markdown
Contributor

@ruflin ruflin commented Mar 28, 2017

Previously if a file could be found under the same name as a state, the state was not removed. But this could have been also an other file. With this change also the file itself is compared and if it is not the same file, the state will be removed. This has the affect that in case a file is renamed after monitoring the file finished, the state will be removed. In most cases this should not have any side affect.

The positive effect of this change is that there will be less left over states in the registry.

Closes elastic#3789

@ruflin ruflin added Filebeat Filebeat in progress Pull request is currently in progress. labels Mar 28, 2017
@ruflin ruflin force-pushed the improved-clean-removed branch 2 times, most recently from 1c223e5 to d774da1 Compare April 6, 2017 08:40
@ruflin ruflin added review and removed in progress Pull request is currently in progress. labels Apr 6, 2017
@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented Apr 6, 2017

@elastic/beats Would be good to hear your thoughts on this change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we be more strict here and check vs os.PathError?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea. What should we do in all other cases? Log an error and not remove the state?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yea that's probably the best we can do. os.PathError is all that can return right now but you never now..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could return here and check the error in the caller, and also remove the else

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed it to return directly if state is not finished but I kept the error handling local.

ruflin added 2 commits April 13, 2017 14:30
Previously if a file could be found under the same name as a state, the state was not removed. But this could have been also an other file. With this change also the file itself is compared and if it is not the same file, the state will be removed. This has the affect that in case a file is renamed after monitoring the file finished, the state will be removed. In most cases this should not have any side affect.

The positive effect of this change is that there will be less left over states in the registry.

Closes elastic#3789
@ruflin ruflin force-pushed the improved-clean-removed branch from d774da1 to f8f540b Compare April 13, 2017 12:37
Copy link
Copy Markdown
Contributor Author

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

review changes implemented and rebase on master

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed it to return directly if state is not finished but I kept the error handling local.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed

@7AC 7AC merged commit caf398f into elastic:master Apr 18, 2017
@ruflin ruflin deleted the improved-clean-removed branch April 18, 2017 17:11
@tsg tsg mentioned this pull request Jul 24, 2017
28 tasks
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.

2 participants