Skip to content

GitMaintenanceStep: Throw if stopped while Git is running#1072

Merged
derrickstolee merged 2 commits intomicrosoft:masterfrom
derrickstolee:maintenance-throw
Apr 26, 2019
Merged

GitMaintenanceStep: Throw if stopped while Git is running#1072
derrickstolee merged 2 commits intomicrosoft:masterfrom
derrickstolee:maintenance-throw

Conversation

@derrickstolee
Copy link
Contributor

@derrickstolee derrickstolee commented Apr 26, 2019

The GitMaintenanceStep throws a StoppingException if the
RunGitCommand() method is run after a Stop() call. However,
it doesn't throw when the Stop() call happens during the
Git process. This requires extra handling of the Stopping
boolean after receiving a response from RunGitCommand().
Such extra handling was added in #1064, but would not
be necessary with this change.

The better thing to do is to throw the StoppingException
after the Git process completes.

Add a unit test that verifies we automatically skip the
remainder of a PerformMaintenance() method in a subclass.

Looking through the error logs, all logged instances of a
failure during 'commit-graph verify' or 'multi-pack-index verify'
are actually due to this issue. Otherwise we would see errors
from GitMaintenanceStep saying "Git process {command} failed with errors:"
and those messages do no appear in the logs.

@derrickstolee derrickstolee requested a review from jeschu1 April 26, 2019 13:04
The GitMaintenanceStep throws a StoppingException if the
RunGitCommand() method is run after a Stop() call. However,
it doesn't throw when the Stop() call happens during the
Git process. This requires extra handling of the Stopping
boolean after receiving a response from RunGitCommand().
The better thing to do is to throw the StoppingException
after the Git process completes.

Add a unit test that verifies we automatically skip the
remainder of a PerformMaintenance() method in a subclass.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Copy link
Member

@jeschu1 jeschu1 left a comment

Choose a reason for hiding this comment

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

With Suggestion noted

Copy link
Member

@kewillford kewillford left a comment

Choose a reason for hiding this comment

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

Approved with one suggestion.

The GitMaintenanceStepTests have three subclasses of
GitMaintenanceStep to invoke the Stop() method at different
times and report which blocks were reached.

Instead, use an enum to specify when we should call
Stop() and use the same subclass in all methods.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee derrickstolee merged commit 690ba2b into microsoft:master Apr 26, 2019
@jrbriggs jrbriggs added this to the M151 milestone May 1, 2019
@jrbriggs jrbriggs added affects: live-site Improving our ability to diagnose and fix the product type: bug labels May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects: live-site Improving our ability to diagnose and fix the product type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants