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

caching or versioning problem with multiple Kibana instances #7055

Closed
LeeDr opened this issue Apr 26, 2016 · 12 comments
Closed

caching or versioning problem with multiple Kibana instances #7055

LeeDr opened this issue Apr 26, 2016 · 12 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:uiSettings impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)

Comments

@LeeDr
Copy link

LeeDr commented Apr 26, 2016

If you have 2 or more instances of Kibana sharing the same .kibana index, they can clobber each other's changes with values they have in cache.

To Reproduce;

  1. Start 2 instances of Kibana either on different machines or on different ports. I'm running #1 on port 5601 and #2 on port 5602 on the same machine.
  2. Go to Settings > Advanced on both instances
  3. on #1 change discover:sampleSize (Default: 500) to 499
  4. on #2 change discover:sampleSize (Default: 500) to 501
  5. on #1 change courier:maxSegmentCount (Default: 30) to 29
  6. refresh both instances, and/or check the config object http://localhost:9200/.kibana/config/_search

Expected discover:sampleSize (Default: 500) to be 501 since it was the last change made to that setting.

Actual discover:sampleSize (Default: 500) to 499 (probably because #1 had 499 cached when it wrote the courier:maxSegmentCount so it wrote the whole config object)

If possible, it should know the version of the config object it has cached.

When it tries to write the object it should check the version first and, if later, show the user an error if it is a later version, and refresh the page to show the current version. The user can try to save again, or has to make their change again and save again.

OR

When it tries to write the object it should check the version first and, if later, get the latest version and re-apply the change and try to save it again (again checking the version).

OR

When it tries to write the object the write should include the next version and fail if that version already exist in Elasticsearch? Not sure which of these functionalities is possible. Then handle the error by getting the latest version, and re-applying the change. This could be the best performing solution because it only takes one round-trip in most cases.

@LeeDr LeeDr added bug Fixes for quality problems that affect the customer experience P3 labels Apr 26, 2016
@epixa epixa added P2 and removed P3 labels Apr 26, 2016
LeeDr pushed a commit to LeeDr/kibana that referenced this issue Aug 30, 2016
LeeDr pushed a commit to LeeDr/kibana that referenced this issue Aug 30, 2016
airow pushed a commit to airow/kibana that referenced this issue Feb 16, 2017
airow pushed a commit to airow/kibana that referenced this issue Feb 16, 2017
@epixa epixa removed the P2 label Apr 25, 2017
@LeeDr
Copy link
Author

LeeDr commented Aug 15, 2018

#21947 fixes the issue for index patterns. If a user tries to save a change and their version is not the latest (someone else changed the index pattern while they still had a copy in their cache) then their save is rejected with a message telling them to refresh the page and try again.

We still have the issue on other saved object types.

@timroes timroes added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages and removed :Management DO NOT USE labels Nov 27, 2018
@timroes timroes added Feature:Saved Objects Team:Operations Team label for Operations Team and removed Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages labels Jun 21, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@timroes timroes removed the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Jun 21, 2021
@tylersmalley tylersmalley added 1 and removed 1 labels Oct 11, 2021
@tylersmalley
Copy link
Contributor

@LeeDr is this still valid, or can we close? If it's still valid we should move to the Core team.

@exalate-issue-sync exalate-issue-sync bot added impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort labels Feb 16, 2022
@LeeDr
Copy link
Author

LeeDr commented Feb 17, 2022

I think this is still valid. Here's another example;

  1. Two users open the same Lens visualization
  2. user 1 makes a change and saves it
  3. user 2 makes a different change and saves it. This overwrites user 1's change

Concrete example with eCommerce sample data

  1. Two users open Avg. items sold lens visualization
  2. user 1 changes it from a metric to a "Bar vertical stacked" and clicks Save
  3. user 2 changes it from a metric that they still see, to a "Bar vertical" and saves it

In these cases, user 2 doesn't have any idea that they are working from a stale version of the visualization and overwriting other changes. It could even be multiple different changes that get overwritten.

Compared to the case of index-patterns (data views), when you try to save a change to a stale version the UI tells you that you have to refresh (and re-do your changes) before saving.

@tylersmalley
Copy link
Contributor

Reading through the issue, I don't even think this is a core thing. I think that each application will need to figure out how to handle this. I do know that the saved objects have the ability to track the version so they can prevent a write if the underlying value originally read changed... Which is what I think is happening here.

@tylersmalley tylersmalley added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc and removed loe:small Small Level of Effort impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. EnableJiraSync Team:Operations Team label for Operations Team labels Mar 16, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@tylersmalley
Copy link
Contributor

Reassigning to core, didn't realize they owned Advanced Settings. This feels like an advanced settings specific bug.

@exalate-issue-sync exalate-issue-sync bot added impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort labels Mar 17, 2022
@Bamieh
Copy link
Member

Bamieh commented Mar 18, 2022

I wonder if we can use the documents _version field in elasticsearch for optimistic locking (https://www.elastic.co/blog/elasticsearch-versioning-support)

@pgayvallet
Copy link
Contributor

pgayvallet commented Mar 18, 2022

I wonder if we can use the documents _version field in elasticsearch for optimistic locking

We're doing that already. We're using the if_* fields for SOs already (if_seq_no and if_primary_term) for optimistic concurrency control, based on the document's version. If the option is provided by API consumers, that is.

Problem with the uiSettings is more that it's an higher level API and the SO APIs are just the underlying implementation, so there isn't an easy way to keep track of the version of the config object the settings were coming from, especially on the UI.

Looking at the issue's description, it may be more that we're updating more settings than necessary when saving in the advanced settings page?

on #1 change discover:sampleSize (Default: 500) to 499
on #2 change discover:sampleSize (Default: 500) to 501
on #1 change courier:maxSegmentCount (Default: 30) to 29

I would expect the second save operation on instance 1 to only update the setting(s) that were not previously saved (e.g here, only courier:maxSegmentCount)

Actually I thought we were already doing that. Given this is an issue from 2016, it's probably worth checking that this isn't fixed already.

regarding the second use case from @LeeDr in #7055 (comment)

Two users open the same Lens visualization
user 1 makes a change and saves it
user 2 makes a different change and saves it. This overwrites user 1's change

The SO apis already allow consumers to pass a version option to avoid this very scenario

e.g for update:

export interface SavedObjectsUpdateOptions<Attributes = unknown> extends SavedObjectsBaseOptions {
/** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */
version?: string;

And this version field is exposed on every savedObject returned from our APIs:

export interface SavedObject<T = unknown> {
/** The ID of this Saved Object, guaranteed to be unique for all objects of the same `type` */
id: string;
/** The type of Saved Object. Each plugin can define it's own custom Saved Object types. */
type: string;
/** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */
version?: string;

it's just that our API consumers are almost never using it.

@afharo
Copy link
Member

afharo commented Jul 18, 2022

Based on Pierre's comment, I've changed the labels to UI Settings as it seems that SO APIs allow the concurrency checks as long as version is provided, so we may probably need to change it on UI Settings.

@majagrubic majagrubic added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Feb 1, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@majagrubic majagrubic removed the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Feb 1, 2023
@vadimkibana
Copy link
Contributor

Not sure why it was assigned to Shared UX, but reading through the issue it looks to me that the behaviour is actually expected. If an app wants to prevent this behaviour, there is an option to do optimistic concurrency control (conditional updates).

cee-chen added a commit that referenced this issue Aug 21, 2023
`v86.0.0`⏩`v87.1.0`

⚠️ The biggest set of type changes in this PR come from the breaking
change that makes `pageSize` and `pageSizeOptions` now optional props
for `EuiBasicTable.pagination`, `EuiInMemoryTable.pagination` and
`EuiDataGrid.pagination`.

This caused several other components that were cloning EUI's pagination
type to start throwing type warnings about `pageSize` being optional.
Where I came across these errors, I modified the extended types to
require `pageSize`. These types and their usages may end up changing
again in any case once the Shared UX team looks into
#56406.

---

## [`87.1.0`](https://github.com/elastic/eui/tree/v87.1.0)

- Updated the underlying library powering `EuiAutoSizer`. This primarily
affects typing around the `disableHeight` and `disableWidth` props
([#6798](elastic/eui#6798))
- Added new `EuiAutoSize`, `EuiAutoSizeHorizontal`, and
`EuiAutoSizeVertical` types to support `EuiAutoSizer`'s now-stricter
typing ([#6798](elastic/eui#6798))
- Updated `EuiDatePickerRange` to support `compressed` display
([#7058](elastic/eui#7058))
- Updated `EuiFlyoutBody` with a new `scrollableTabIndex` prop
([#7061](elastic/eui#7061))
- Added a new `panelMinWidth` prop to `EuiInputPopover`
([#7071](elastic/eui#7071))
- Added a new `inputPopoverProps` prop for `EuiRange`s and
`EuiDualRange`s with `showInput="inputWithPopover"` set
([#7082](elastic/eui#7082))

**Bug fixes**

- Fixed `EuiToolTip` overriding instead of merging its
`aria-describedby` tooltip ID with any existing `aria-describedby`s
([#7055](elastic/eui#7055))
- Fixed `EuiSuperDatePicker`'s `compressed` display
([#7058](elastic/eui#7058))
- Fixed `EuiAccordion` to remove tabbable children from sequential
keyboard navigation when the accordion is closed
([#7064](elastic/eui#7064))
- Fixed `EuiFlyout`s to accept custom `aria-describedby` IDs
([#7065](elastic/eui#7065))

**Accessibility**

- Removed the default `dialog` role and `tabIndex` from push
`EuiFlyout`s. Push flyouts, compared to overlay flyouts, require manual
accessibility management.
([#7065](elastic/eui#7065))

## [`87.0.0`](https://github.com/elastic/eui/tree/v87.0.0)

- Added beta `componentDefaults` prop to `EuiProvider`, which will allow
configuring certain default props globally. This list of components and
defaults is still under consideration.
([#6923](elastic/eui#6923))
- `EuiPortal`'s `insert` prop can now be configured globally via
`EuiProvider.componentDefaults`
([#6941](elastic/eui#6941))
- `EuiFocusTrap`'s `crossFrame` and `gapMode` props can now be
configured globally via `EuiProvider.componentDefaults`
([#6942](elastic/eui#6942))
- `EuiTablePagination`'s `itemsPerPage`, `itemsPerPageOptions`, and
`showPerPageOptions` props can now be configured globally via
`EuiProvider.componentDefaults`
([#6951](elastic/eui#6951))
- `EuiBasicTable`, `EuiInMemoryTable`, and `EuiDataGrid` now allow
`pagination.pageSize` to be undefined. If undefined, `pageSize` defaults
to `EuiTablePagination`'s `itemsPerPage` component default.
([#6993](elastic/eui#6993))
- `EuiBasicTable`, `EuiInMemoryTable`, and `EuiDataGrid`'s
`pagination.pageSizeOptions` will now fall back to
`EuiTablePagination`'s `itemsPerPageOptions` component default.
([#6993](elastic/eui#6993))
- Updated `EuiHeaderLinks`'s `gutterSize` spacings
([#7005](elastic/eui#7005))
- Updated `EuiHeaderAlert`'s stacking styles
([#7005](elastic/eui#7005))
- Added `toolTipProps` to `EuiListGroupItem` that allows customizing
item tooltips. ([#7018](elastic/eui#7018))
- Updated `EuiBreadcrumbs` to support breadcrumbs that toggle popovers
via `popoverContent` and `popoverProps`
([#7031](elastic/eui#7031))
- Improved the contrast ratio of disabled titles within `EuiSteps` and
`EuiStepsHorizontal` to meet WCAG AA guidelines.
([#7032](elastic/eui#7032))
- Updated `EuiSteps` and `EuiStepsHorizontal` to highlight and provide a
more clear visual indication of the current step
([#7048](elastic/eui#7048))

**Bug fixes**

- Single uses of `<EuiHeaderSectionItem side="right" />` now align right
as expected without needing a previous `side="left"` sibling.
([#7005](elastic/eui#7005))
- `EuiPageTemplate` now correctly displays `panelled={true}`
([#7044](elastic/eui#7044))

**Breaking changes**

- `EuiTablePagination`'s default `itemsPerPage` is now `10` (was
previously `50`). This can be configured through
`EuiProvider.componentDefaults`.
([#6993](elastic/eui#6993))
- `EuiTablePagination`'s default `itemsPerPageOptions` is now `[10, 25,
50]` (was previously `[10, 20, 50, 100]`). This can be configured
through `EuiProvider.componentDefaults`.
([#6993](elastic/eui#6993))
- Removed `border` prop from `EuiHeaderSectionItem` (unused since
Amsterdam theme) ([#7005](elastic/eui#7005))
- Removed `borders` object configuration from `EuiHeader.sections`
([#7005](elastic/eui#7005))

**CSS-in-JS conversions**

- Converted `EuiHeaderAlert` to Emotion; Removed unused
`.euiHeaderAlert__dismiss` CSS
([#7005](elastic/eui#7005))
- Converted `EuiHeaderSection`, `EuiHeaderSectionItem`, and
`EuiHeaderSectionItemButton` to Emotion
([#7005](elastic/eui#7005))
- Converted `EuiHeaderLinks` and `EuiHeaderLink` to Emotion; Removed
`$euiHeaderLinksGutterSizes` Sass variables
([#7005](elastic/eui#7005))
- Removed `$euiHeaderBackgroundColor` Sass variable; use
`$euiColorEmptyShade` instead
([#7005](elastic/eui#7005))
- Removed `$euiHeaderChildSize` Sass variable; use `$euiSizeXXL` instead
([#7005](elastic/eui#7005))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:uiSettings impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)
Projects
None yet
Development

No branches or pull requests