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

[ILM] Show forcemerge in hot when rollover is searchable snapshot is enabled #85292

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Dec 8, 2020

Summary

  • Implement stakeholder feedback to show forcemerge in hot even when Searchable Snapshot (SS) is on
  • Fix bug with validation on policy that does not have rollover and does not block saving when rollover is enabled with no values
Gif of SS

SS-field

@jloleysens jloleysens added Feature:ILM v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Dec 8, 2020
@jloleysens jloleysens requested a review from a team as a code owner December 8, 2020 15:48
@elasticmachine
Copy link
Contributor

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

@jloleysens jloleysens changed the title [ILM] Always show forcemerge in hot [ILM] Show forcemerge in hot when rollover is enabled Dec 8, 2020
Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Code LGTM. Tested locally. Great catch on the validation bug! Is there a test that we could add that might have caught this?

message: i18nTexts.editPolicy.errors.maximumSizeRequiredMessage,
},
]);
return path === ROLLOVER_FORM_PATHS.maxAge
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might be a little easier to read using if...else instead of a nested ternary.

Copy link
Contributor

Choose a reason for hiding this comment

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

A switch/case could also work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cjcenizal in this case the switch statement would look something like:

    switch (true) {
      case 1 === 1:
        return 'ok';
      case 2 === 2:
        return 'ok then';
      default:
        return 'not ok';
    }

Just curious to hear thoughts on that pattern where we have true as the deciding condition and predicate expressions per case. IMO it might be less easy to grok for the majority of readers because it is less common - WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My take is it does look pretty neat though!

Copy link
Contributor

Choose a reason for hiding this comment

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

@jloleysens I was thinking something more like this unless I'm missing something:

switch (path) {
  case ROLLOVER_FORM_PATHS.maxAge:
    return {
      code: ROLLOVER_EMPTY_VALIDATION,
      message: i18nTexts.editPolicy.errors.maximumAgeRequiredMessage,
    };

  case ROLLOVER_FORM_PATHS.maxDocs:
    return {
      code: ROLLOVER_EMPTY_VALIDATION,
      message: i18nTexts.editPolicy.errors.maximumDocumentsRequiredMessage,
    };

  default:
    return {
      code: ROLLOVER_EMPTY_VALIDATION,
      message: i18nTexts.editPolicy.errors.maximumSizeRequiredMessage,
    };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah OK, I had a different idea. Yours is simpler!

@jloleysens jloleysens changed the title [ILM] Show forcemerge in hot when rollover is enabled [ILM] Show forcemerge in hot when rollover is searchable snapshot is enabled Dec 9, 2020
@jloleysens
Copy link
Contributor Author

@alisonelizabeth thanks for the review! I've addressed your feedback in my latest commit.

Is there a test that we could add that might have caught this?

Yes, but I don't think adding a test at the level of this plugin is the correct place. This plugin does specify a test for the validation on rollover showing under expected conditions:

should show errors when trying to save with no max size, no max age and no max docs

That should theoretically have covered this, but because of how the form lib works with validation on submit, this was not caught. So I pivoted to using the form lib in a way that it does work, we should probably add a test case for this in the form lib - I'll open an issue for it.

@jloleysens
Copy link
Contributor Author

@alisonelizabeth issue here: #85383

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexLifecycleManagement 242.8KB 243.1KB +293.0B

Distributable file count

id before after diff
default 46960 47720 +760

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jloleysens jloleysens merged commit 7fc7fe3 into elastic:master Dec 9, 2020
@jloleysens jloleysens deleted the ilm/show-forcemerge-in-hot-and-fix-rollover-validation branch December 9, 2020 11:29
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 9, 2020
…enabled (elastic#85292)

* pivot to different rollover validation mechanism

* implement stakeholder feedback to show forcemerge in hot

* replace ternary with if..else statements

* make rollover validation test more comprehensive
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 9, 2020
…k-field-to-hot-phase

* 'master' of github.com:elastic/kibana: (429 commits)
  simplify popover open state logic (elastic#85379)
  [Logs UI][Metrics UI] Move actions to the kibana header (elastic#84648)
  [Search Source] Do not pick scripted fields if * provided (elastic#85133)
  [Search] Session SO polling (elastic#84225)
  [Transform] Replace legacy elasticsearch client (elastic#84932)
  [Uptime]Refactor header and action menu (elastic#83779)
  Fix agg select external link (elastic#85380)
  [ILM] Show forcemerge in hot when rollover is searchable snapshot is enabled (elastic#85292)
  clear using keyboard (elastic#85042)
  [GS] add tag and dashboard suggestion results (elastic#85144)
  [ML] API integration tests - skip GetAnomaliesTableData
  Add ECS field for event.code. (elastic#85109)
  [Functional][TSVB] Wait for markdown textarea to be cleaned (elastic#85128)
  skip flaky suite (elastic#62060)
  skip flaky suite (elastic#85098)
  Bump highlight.js to v9.18.5 (elastic#84296)
  Add `server.publicBaseUrl` config (elastic#85075)
  [Alerting & Actions ] More debug logging (elastic#85149)
  [Security Solution][Case] Manual attach alert to a case (elastic#82996)
  Loosen UUID regex to accept uuidv1 or uuidv4 (elastic#85338)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts
#	x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts
jloleysens added a commit that referenced this pull request Dec 10, 2020
…enabled (#85292) (#85393)

* pivot to different rollover validation mechanism

* implement stakeholder feedback to show forcemerge in hot

* replace ternary with if..else statements

* make rollover validation test more comprehensive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants