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

Do not apply journal and show warning message for chewy:reset and chewy:upgrade if journal index is missing #817

Merged
merged 2 commits into from
Oct 18, 2021

Conversation

konalegi
Copy link
Contributor

@konalegi konalegi commented Oct 15, 2021

Description

During rake chewy:reset with disabled journaling we get the following error

Chewy – [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [chewy_journal]","resource.type":"index_or_alias","resource.id":"chewy_journal","index_uuid":"na","index":"chewy_journal"}],"type":"index_not_found_exception","reason":"no such index [chewy_journal]","resource.type":"index_or_alias","resource.id":"chewy_journal","index_uuid":"na","index":"chewy_journal"},"status":404}

This doesn't say that there is an error, just journal index is missing, but it confuses some developers who are not familiar with chewy and make them think that there is an import error.

New behavior disables replay of the journal from old index if there is no journal and additionally show warning message

$ be rake chewy:reset

##########################################################
WARN: You are risking to lose some changes during the reset.
      Please consider enabling journaling.
      See https://github.com/toptal/chewy#journaling
##########################################################
Resetting IndexOne
  Imported IndexOne in 1s, stats: index 932
  Imported Chewy::Stash::Specification in 1s, stats: index 1
Resetting IndexTwo
....

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • [ ] Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the changelog if the new code introduces user-observable changes. See changelog entry format for details.

@konalegi konalegi force-pushed the apply-journal-only-if-journaling-is-enabled branch 3 times, most recently from 36f01f8 to 69c6395 Compare October 15, 2021 14:07
@konalegi konalegi changed the title Apply journal only if journaling is enabled Do not apply journal and show warning message for chewy:reset and chewy:upgrade if journal index is missing Oct 15, 2021
@konalegi konalegi force-pushed the apply-journal-only-if-journaling-is-enabled branch from 69c6395 to 6760fa3 Compare October 15, 2021 14:09
@konalegi konalegi marked this pull request as ready for review October 15, 2021 14:13
lib/chewy/rake_helper.rb Outdated Show resolved Hide resolved
lib/chewy/rake_helper.rb Outdated Show resolved Hide resolved
lib/chewy/rake_helper.rb Show resolved Hide resolved
@konalegi konalegi force-pushed the apply-journal-only-if-journaling-is-enabled branch from 6760fa3 to 4a96299 Compare October 15, 2021 14:42
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Ivan Rabotyaga <ivan.rabotyaga@toptal.com>
@konalegi konalegi merged commit 38698f9 into master Oct 18, 2021
@konalegi konalegi deleted the apply-journal-only-if-journaling-is-enabled branch October 18, 2021 05:27
cyucelen pushed a commit to cyucelen/chewy that referenced this pull request Jan 28, 2023
…wy:upgrade if journal index is missing (toptal#817)

* Do not apply journal and show warning message for chewy:reset and chewy:upgrade if journal index is missing

* Update CHANGELOG.md

Co-authored-by: Ivan Rabotyaga <ivan.rabotyaga@toptal.com>

Co-authored-by: Ivan Rabotyaga <ivan.rabotyaga@toptal.com>
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