Skip to content

Conversation

@alisonelizabeth
Copy link
Contributor

This PR is continuation of #45193, and adds the ability to run snapshot retention without scheduling it.

Related ES API change: elastic/elasticsearch#47405

Release notes

This feature adds the ability to run snapshot retention without scheduling. This is useful to perform a manual invocation or to perform a one-off cleanup.

Note: This work is continuation of #45193, which added the Snapshot Retention UI to the Snapshot and Restore app.

Testing locally

  • Create a repository within SR. For a shared filesystem repo, you need to specify a path.repo when starting ES. For example:

    yarn es snapshot -E path.repo=/tmp/es-backups

    For more information, see the SR docs.

  • Create a policy with retention defined. Suggestion: Set up your policy to create a snapshot every minute, and configure retention to only retain a max of 2 snapshots.

  • Wait a few minutes for snapshots to be created. Once you have >2, run retention.

  • You should see that the snapshots were deleted, either by visiting the Snapshots tab or viewing the statistics on the policy details panel.

Screenshots

If a retention schedule is not configured:
Screen Shot 2019-10-02 at 2 18 28 PM

If retention schedule is configured:
Screen Shot 2019-10-02 at 2 18 50 PM

Run retention modal:
Screen Shot 2019-10-02 at 2 19 00 PM

@alisonelizabeth alisonelizabeth added release_note:enhancement v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Feature:Snapshot and Restore Elasticsearch snapshots and repositories UI v7.5.0 labels Oct 2, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alisonelizabeth
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alisonelizabeth
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

This looks great @alisonelizabeth

Thanks for putting this together. The code looks really clean and is easy to follow.

I did run into the following issue when testing per the instruction in the PR description:

Screenshot 2019-10-08 at 13 14 28

One other thing; do we want to take this opportunity to add Jest tests for the new functionality, WDYT?

<EuiSpacer />
</Fragment>
);
return renderRetentionPanel(retentionSettings.retentionSchedule);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

});
});

describe('executeRetentionHandler()', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not entirely sure I understand what coverage this test provides?

Copy link
Contributor Author

@alisonelizabeth alisonelizabeth Oct 8, 2019

Choose a reason for hiding this comment

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

good point, i removed this test for now.

@alisonelizabeth
Copy link
Contributor Author

@jloleysens thanks for the review!

It seems the API change is not in the latest snapshot for some reason. Do you mind building ES from source and trying again?

Also, I agree test coverage is important here. SR as a whole is lacking coverage. I added/updated some of the tests via #45193, but there is still more work to be done here. I opened a separate issue to track this: #47595

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Re-tested with ES built from source and it worked 😄

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Snapshot and Restore Elasticsearch snapshots and repositories UI release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v7.5.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants