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

169395632 v7 2 changes #69

Merged
merged 20 commits into from
Nov 12, 2019
Merged

169395632 v7 2 changes #69

merged 20 commits into from
Nov 12, 2019

Conversation

davidbl
Copy link
Member

@davidbl davidbl commented Oct 29, 2019

PT story https://www.pivotaltracker.com/story/show/169395632
Associated doximity PR https://github.com/doximity/doximity/pull/30797

Overview

There are breaking changes in Elasticsearch v7.0 that we need to address in order to upgrade

Technical Details

Additional information available here https://docs.google.com/document/d/1pGgAdDeHEclh7nr_MX_RkryCgyf2IEtUQGyfbYMAh9k/edit#heading=h.oymnw3nlvwib

in v7.0,  the 'total' on a search results will return
an object instead of an integer so we need to be able
to handle that along with the older integer value
@davidbl davidbl changed the title 169395632 v7 2 changes WIP 169395632 v7 2 changes Oct 29, 2019
- update elasticsearch gem for compatibility with target ES version
- handle 'total' object (instead of scalar)
- allow for optional timestamp format without colon (":")
- expose refresh_index to force writes because flush_index will no force
writes
- option param 'include_type_name_on_create' that control the
:include_type_name argument used when creating indexes
@davidbl davidbl force-pushed the 169395632_v7_2_changes branch from b2480d2 to 47b1370 Compare November 1, 2019 14:37
@davidbl davidbl force-pushed the 169395632_v7_2_changes branch from 1ef2835 to ddc351e Compare November 5, 2019 18:01
@davidbl davidbl force-pushed the 169395632_v7_2_changes branch from edab08e to c1bbaa3 Compare November 5, 2019 18:17
@davidbl davidbl force-pushed the 169395632_v7_2_changes branch from c1bbaa3 to 192133d Compare November 5, 2019 18:19
@@ -71,10 +72,16 @@ def remap!(retry_delete_on_recoverable_errors: true, retry_delay: 30, max_delay:
end

# Flushes the index, forcing any writes
# note that v7 no longer forces any writes on flush
def flush_index
Copy link
Member

Choose a reason for hiding this comment

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

would emitting a deprecation log warning be useful here, or is flush_index still have value if it doesn't force the writes?

Copy link
Member Author

Choose a reason for hiding this comment

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

flush is still a valid thing
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html#flush-api-desc

it just want have the side-effect of refreshing the index which made new documents visible to searches (the side-effect that is has pre v7)

def build_index_name
ts = String.new
if @use_new_timestamp_format == true
ts = Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
Copy link
Member

Choose a reason for hiding this comment

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

Any chance we could add some delimiters to make this easier to parse by humans reading the index names? Something like 2019_10_27_211410 (not sure if _ is an acceptable delimiter, but whatever is could be useful here.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, we could. but this format should be familiar to rails devs
https://github.com/doximity/doximity/tree/master/db/migrate (which is why I picked it)

Copy link
Member Author

Choose a reason for hiding this comment

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

and I was a bit scared of some future upgrade declaring other chars off limits

Copy link
Member

Choose a reason for hiding this comment

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

Yeah - I was thinking that same thing about the chars too. I'm good either way, just figured I'd mention it.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍
fwiw, most human interaction is usually via the aliases anyway

Copy link
Member

@rstawarz rstawarz left a comment

Choose a reason for hiding this comment

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

♠️ One suggestion on adding a delimiter to the timestamp in the name if possible, but not a blocker

Copy link
Member

@divoxx divoxx left a comment

Choose a reason for hiding this comment

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

Overall looks good to me.

Question: Is this backwards compatible with previous ES versions?

@davidbl
Copy link
Member Author

davidbl commented Nov 6, 2019

@divoxx yes. I made the v7-specific stuff opt-in so, by default, things should be compatible with older ES versions.

But we probably need to consider sun-setting support for truly old versions

@davidbl davidbl changed the title WIP 169395632 v7 2 changes 169395632 v7 2 changes Nov 8, 2019
@davidbl
Copy link
Member Author

davidbl commented Nov 8, 2019

The testing of these changes is complete (see https://github.com/doximity/doximity/pull/30797)

And I have removed the pre tag and pushed the gem
Screen Shot 2019-11-08 at 7 11 30 AM

@davidbl davidbl merged commit bea4ef5 into master Nov 12, 2019
@davidbl davidbl deleted the 169395632_v7_2_changes branch November 12, 2019 15:40
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.

3 participants