Skip to content

Conversation

@spinscale
Copy link
Contributor

This setting is supposed to ease index upgrades as it allows you
to check for a new setting called index.internal.version which
in turn can be configured in the index settings and has to be set
to '6' in order to be valid.

This setting is supposed to ease index upgrades as it allows you
to check for a new setting called `index.internal.version` which
in turn can be configured in the index settings and has to be set
to '6' in order to be valid.
Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

left some comments

private static final String INDEX_INTERNAL_FORMAT = "index.internal.format";
public static final Setting<Integer> INDEX_INTERNAL_FORMAT_SETTING =
Setting.intSetting(INDEX_INTERNAL_FORMAT, 0, Setting.Property.IndexScope);
static final int INTERNAL_INDEX_FORMAT_CURRENT = 6;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we make this a bit more generic and call it index.format and INTERNAL_INDEX_FORMAT_CURRENT should not be here. it's up to every user of this setting to define the current?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

private final Index index;
private final long version;
private final long[] primaryTerms;
private final int internalIndexFormat;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really have to make this a first class citizen or can we just leave it as a setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes more sense as a setting. fixed

* an internal index format description, allowing us to find out if this index is upgraded or needs upgrading
*/
private static final String INDEX_INTERNAL_FORMAT = "index.internal.format";
public static final Setting<Integer> INDEX_INTERNAL_FORMAT_SETTING =
Copy link
Contributor

Choose a reason for hiding this comment

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

also make this setting Setting.Property.Final

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooh, wasnt aware of that. great!

- Make the setting final
- Do not expose an own getter, just extract the setting via
IndexMetaData.getSettings() - also no need to put this into
hashCode()/equals()
- Make more generic and rename to `index.format`
- Allow the user to choose the correct value and just return
 that value
@spinscale
Copy link
Contributor Author

all comments made a ton of sense. incorporated.

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

left some comments

DiscoveryNodeFilters requireFilters, DiscoveryNodeFilters initialRecoveryFilters, DiscoveryNodeFilters includeFilters, DiscoveryNodeFilters excludeFilters,
Version indexCreatedVersion, Version indexUpgradedVersion,
int routingNumShards, int routingPartitionSize, ActiveShardCount waitForActiveShards) {
int routingNumShards, int routingPartitionSize, ActiveShardCount waitForActiveShards, int internalIndexFormat) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unused?


final String uuid = settings.get(SETTING_INDEX_UUID, INDEX_UUID_NA_VALUE);

int internalIndexFormat = INDEX_FORMAT_SETTING.get(settings);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unneeded see above

return new IndexMetaData(new Index(index, uuid), version, primaryTerms, state, numberOfShards, numberOfReplicas, tmpSettings, mappings.build(),
tmpAliases.build(), customs.build(), filledInSyncAllocationIds.build(), requireFilters, initialRecoveryFilters, includeFilters, excludeFilters,
indexCreatedVersion, indexUpgradedVersion, getRoutingNumShards(), routingPartitionSize, waitForActiveShards);
indexCreatedVersion, indexUpgradedVersion, getRoutingNumShards(), routingPartitionSize, waitForActiveShards, internalIndexFormat);
Copy link
Contributor

Choose a reason for hiding this comment

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

this should go away

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

LGTM

@spinscale spinscale merged commit 6842398 into elastic:master Jun 21, 2017
spinscale added a commit that referenced this pull request Jun 21, 2017
This setting is supposed to ease index upgrades as it allows you
to check for a new setting called `index.internal.version` which
can be used to check before upgrading indices.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jun 22, 2017
* master: (56 commits)
  Initialize max unsafe auto ID timestamp on shrink
  Enable a long translog retention policy by default (elastic#25294)
  Remove `index.mapping.single_type=false` from core/tests (elastic#25331)
  test: single type defaults to true since alpha1 and not alpha3
  Get short path name for native controllers
  Live primary-replica resync (no rollback) (elastic#24841)
  Upgrade to lucene-7.0.0-snapshot-ad2cb77. (elastic#25349)
  percolator: Deprecate `document_type` parameter.
  [DOCS] Fixed typo.
  [rest-api-spec/indices.refresh] Remove old params
  Remove redundant and broken MD5 checksum from repository-s3 (elastic#25270)
  Initialize sequence numbers on a shrunken index
  Port most snapshot/restore static bwc tests to qa:full-cluster-restart (elastic#25296)
  Javadoc: ThreadPool doesn't reject while shutdown (elastic#23678)
  test: verify `size_to_upgrade_in_bytes` in assertBusy(...)
  Docs: Removed duplicated line in mapping docs
  Add backward compatibility indices for 5.4.2
  Update MockTransportService to the age of Transport.Connection (elastic#25320)
  Add version v5.4.2 after release
  IndexMetaData: Add internal format index setting (elastic#25292)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants