job-config-history-plugin icon indicating copy to clipboard operation
job-config-history-plugin copied to clipboard

[JENKINS-41844] Make hasDuplicateHistory efficient

Open fbelzunc opened this issue 6 years ago • 12 comments

This is the easiest part to fix JENKINS-41844

With the default values on this PR it seems hasDuplicateHistory continue working properly even on slow filesystems

More PRs will come to fix JENKINS-41844

fbelzunc avatar Nov 29 '18 14:11 fbelzunc

@Jochen-A-Fuerbacher hellom are you sure the failure tests are related to this PR? I think there might be environment related - Those tests corretly run on my local environment.

fbelzunc avatar Nov 29 '18 15:11 fbelzunc

Hello @fbelzunc,

sorry for taking so long to answer. I took a look into the test failures. The tests also fail on my environment. Reason is, that you create a symlink in the history dir and three of the tests check the file count in the history dir. So they fail because there's one more file, now: the symlink. Please fix the three tests. Thanks.

Jochen-A-Fuerbacher avatar Mar 13 '19 08:03 Jochen-A-Fuerbacher

Hello @fbelzunc,

please comment here, if you are finish with your changes. Thanks.

Jochen-A-Fuerbacher avatar Apr 03 '19 07:04 Jochen-A-Fuerbacher

@Jochen-A-Fuerbacher Not for the moment, I am using symlinks and I will need to go away from this approach. I will ping you once I am done. Thanks for the follow-up!

fbelzunc avatar Apr 03 '19 07:04 fbelzunc

@Jochen-A-Fuerbacher I think I am done, however, I think this is an important change in the plugin and I am a bit worried about cases I might not be contemplating.

Basically, I am

  • Introducing/updating a symbolic link each time a new history is created.
  • When checking if there are duplicated histories, I fall-back to the previous behavior in case there is not still a symlink or in case there was an issue reading the symlink

One of the reasons why I am worried is because in Windows environments, it seems the symlinks do not work - see https://issues.jenkins-ci.org/browse/JENKINS-37862

I short, I would like to know if in your opinion this PR is using - or not the right approach. I know this is a BIG issue on big organizations, so that is the reason why I am trying to address the issues.

What do you think?

fbelzunc avatar Apr 30 '19 12:04 fbelzunc

@fbelzunc There's a bug in your PR: If you have the purger enabled (global Jenkins configuration -> Job Config History -> Advanced -> Max number of days to keep history entries set to some value) and all matching history entries get deleted, the symlink doesn't get updated to the last available history entry (which is older than the previous existing history entries). You need to modify the JobConfigHistoryPurger class as well.

The rest of your PR looks good. As I am not a Windows user, I cannot simply verify the impact of your PR on Windows environments.

Jochen-A-Fuerbacher avatar May 10 '19 07:05 Jochen-A-Fuerbacher

@fbelzunc did you already have the time to look at this again?

darxriggs avatar Jul 15 '19 17:07 darxriggs

I will try to get back to this next week.

fbelzunc avatar Jul 23 '19 12:07 fbelzunc

@Jochen-A-Fuerbacher I am deleting now the symblink in case it is needed, but I am not updating it. Why? Because...

  • when there are still entries without being deleted, the symblink should be pointing to the most recent one already.
  • In any case, if the symblink is deleted it should be recreated after adding a new entry, or after passing through hasDuplicated.

fbelzunc avatar Aug 06 '19 14:08 fbelzunc

I will re-review everything tomorrow, but I still don't understand why this change does not have an impact on the maximum number of configuration history entries to keep. I did not see on the code where we are taking care of this.

fbelzunc avatar Aug 06 '19 15:08 fbelzunc

@fbelzunc , @Jochen-A-Fuerbacher , hello! Any updates on this issue?

gulyaev13 avatar Nov 14 '19 13:11 gulyaev13

@fbelzunc Are you working on this, yet?

Jochen-A-Fuerbacher avatar Feb 15 '20 16:02 Jochen-A-Fuerbacher