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

fix writeIndex evaluation for aliases #31562

Merged
merged 2 commits into from
Jun 26, 2018
Merged

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Jun 25, 2018

AliasOrIndex.Alias#writeIndex was returning a write index when
an alias was pointing to only one index, regardless whether is_write_index was
set to false. This fixes that so that there is no write index in such a case
that an alias points to only one index with is_write_index=false.

AliasOrIndex.Alias#writeIndex was returning a write index when
an alias was pointing to only one index, regardless whether `is_write_index` was
set to `false`. This fixes that so that there is no write index in such a case
that an alias points to only one index with `is_write_index=false`.
@talevy talevy added >bug review :Data Management/Indices APIs APIs to create and manage indices and templates v7.0.0 v6.4.0 labels Jun 25, 2018
@talevy talevy requested a review from bleskes June 25, 2018 17:42
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

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

LGTM

writeIndices = referenceIndexMetaDatas.stream()
.filter(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).writeIndex()))
.collect(Collectors.toList());
} else if(Boolean.FALSE.equals(referenceIndexMetaDatas.get(0).getAliases().get(aliasName).writeIndex()) == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you but I find it more intuitive to collect all the explicit write indices (i.e. flag is true) regardless of size if that is empty we check if referenceIndexMetaDatas is of size 1 and if the first value has null for the flag, if so we set writeIndices to referenceIndexMetaDatas and be happy.

@talevy talevy merged commit c6012ed into elastic:master Jun 26, 2018
@talevy talevy deleted the fix-write-false branch June 26, 2018 00:17
talevy added a commit that referenced this pull request Jun 26, 2018
AliasOrIndex.Alias#writeIndex was returning a write index when
an alias was pointing to only one index, regardless whether `is_write_index` was
set to `false`. This fixes that so that there is no write index in such a case
that an alias points to only one index with `is_write_index=false`.
@talevy talevy removed the review label Jun 26, 2018
dnhatn added a commit that referenced this pull request Jun 26, 2018
* 6.x:
  Fix broken backport of #31578 by adjusting constructor (#31587)
  ingest: Add ignore_missing property to foreach filter (#22147) (#31578)
  Add package pre-install check for java binary (#31343)
  Docs: Clarify sensitive fields watcher encryption (#31551)
  Watcher: Remove never executed code (#31135)
  Improve test times for tests using `RandomObjects::addFields` (#31556)
  Revert "Remove RestGetAllAliasesAction (#31308)"
  REST high-level client: add simulate pipeline API (#31158)
  Get Mapping API to honour allow_no_indices and ignore_unavailable (#31507)
  Fix Mockito trying to mock IOException that isn't thrown by method (#31433) (#31527)
  [Test] Add full cluster restart test for Rollup (#31533)
  Enhance thread context uniqueness assertion
  fix writeIndex evaluation for aliases (#31562)
  Add x-opaque-id to search slow logs (#31539)
  Watcher: Fix put watch action (#31524)
  [DOCS] Significantly improve SQL docs
  turn GetFieldMappingsResponse to ToXContentObject (#31544)
  TEST: Unmute testHistoryUUIDIsGenerated
  Ingest Attachment: Upgrade Tika to 1.18 (#31252)
  TEST: Correct the assertion arguments order (#31540)
dnhatn added a commit that referenced this pull request Jun 26, 2018
* master:
  ingest: Add ignore_missing property to foreach filter (#22147) (#31578)
  Fix a formatting issue in the docvalue_fields documentation. (#31563)
  reduce log level at gradle configuration time
  [TEST] Close additional clients created while running yaml tests (#31575)
  Docs: Clarify sensitive fields watcher encryption (#31551)
  Watcher: Remove never executed code (#31135)
  Add support for switching distribution for all integration tests (#30874)
  Improve robustness of geo shape parser for malformed shapes (#31449)
  QA: Create xpack yaml features (#31403)
  Improve test times for tests using `RandomObjects::addFields` (#31556)
  [Test] Add full cluster restart test for Rollup (#31533)
  Enhance thread context uniqueness assertion
  [DOCS] Fix heading format errors (#31483)
  fix writeIndex evaluation for aliases (#31562)
  Add x-opaque-id to search slow logs (#31539)
  Watcher: Fix put watch action (#31524)
  Add package pre-install check for java binary (#31343)
  Reduce number of raw types warnings (#31523)
  Migrate scripted metric aggregation scripts to ScriptContext design (#30111)
  turn GetFieldMappingsResponse to ToXContentObject (#31544)
  Close xcontent parsers (partial) (#31513)
  Ingest Attachment: Upgrade Tika to 1.18 (#31252)
  TEST: Correct the assertion arguments order (#31540)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates v6.4.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants