Skip to content

Add Elasticsearch v7 support#1164

Merged
alexshtin merged 15 commits into
temporalio:masterfrom
alexshtin:feature/elasticsearch-7
Jan 8, 2021
Merged

Add Elasticsearch v7 support#1164
alexshtin merged 15 commits into
temporalio:masterfrom
alexshtin:feature/elasticsearch-7

Conversation

@alexshtin

@alexshtin alexshtin commented Jan 7, 2021

Copy link
Copy Markdown
Contributor

What changed?
Support of ES v7 was added while v6 is still supported. Implementation is v7 performance oriented. All internal APIs use v7 types which are converted to v6 (performance penalty) in case if ES v6 is used.
All development/test artifacts are switched to v7. Although (for backward compatibility) docker image still uses v6 by default. Set ES_VERSION environment variable to v7 or add corresponding config value:

...
    es-visibility:
      elasticsearch:
        version: "v7"
        url:
          scheme: "http"
...

to switch to v7.
Buildkite also runs integration tests with both v6 and v7 until v6 support is completely removed.

Why?
ES6 EOL 2020-11-20 has passed by, and ES7 has number of breaking changes. Most noticeable one is removal of schema type. ES client library has separate branch for v7 which means that v6 and v7 types are incompatible. Most complexity of this PR is about v6 to v7 types conversion.

How did you test it?
Run existing tests and manual run of canary against both (v6 and v7) versions.

Potential risks
Default build of docker image still uses v6.

@alexshtin alexshtin marked this pull request as draft January 7, 2021 18:08
Comment thread common/elasticsearch/client.go Outdated
}

CLIClient interface {
CatIndices(ctx context.Context) (elastic.CatIndicesResponse, error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CatIndices?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indexes and indices are both accepted and widely used plurals of the noun index. Both appear throughout the English-speaking world, but indices prevails in varieties of English from outside North America, while indexes is more common in American and Canadian English. Meanwhile, indices is generally preferred in mathematical, financial, and technical contexts, while indexes is relatively common in general usage.

I just mock whatever ES has.


type (
BulkProcessor interface {
Stop() error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Stop() error
common.Daemon

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no Start() here. And error is logged. I prefer to leave it.

Comment on lines +39 to +41
if esBulkProcessor == nil {
return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when will esBulkProcessor == nil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whenever c.esClient.BulkProcessor().Do(ctx) returns it (I believe in case of error only). Essentially it is a wrapper and I want wrapper to be nil every time when underlying object is nil.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Whenever c.esClient.BulkProcessor().Do(ctx) returns it (I believe in case of error only). Essentially it is a wrapper and I want wrapper to be nil every time when underlying object is nil.

is that weird? wrapper over nil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It just simplify caller code w/o checking for nil and err there. I think it is ok.

Comment on lines +38 to +40
if esBulkProcessor == nil {
return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when will esBulkProcessor == nil?

@alexshtin alexshtin marked this pull request as ready for review January 7, 2021 21:39
@alexshtin alexshtin merged commit b3b3e7b into temporalio:master Jan 8, 2021
@alexshtin alexshtin deleted the feature/elasticsearch-7 branch January 8, 2021 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants