-
Notifications
You must be signed in to change notification settings - Fork 537
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
Skip reindex on normal make up where index alias exists #22819
base: master
Are you sure you want to change the base?
Conversation
c94776b
to
e229395
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#22805 (comment) still applies:
- You should continue to pass
--wipe
(important for initial setup) - You should only skip if the alias exists, not the index
Is this not addressing the second point? For the first point. Looking back at the original point
So if I don't pass wipe, and addons are created before I call the "reindex" command there is a potential failure? It's not totally clear to me why that would be. If I take your words literally in that case ther would still not be an alias so we would recreate the index anyway.. so that is why we need both the skip if aliased and wipe so if we don't skip due to non aliased index we also remove the existing invalid index first? Do I get it? Not sure.. halllp 🤷 |
a73a091
to
c78bab5
Compare
It's at the wrong place: it should be done for your new
If you don't pass BTW, the reason we do that alias switch is to allow a full reindex while still having a fully working search. The idea is:
This is particularly important in production: we want both reads and writes to continue working transparently while we do a full reindex that might take a couple dozen minutes. |
@diox fixed |
2463c3f
to
c9245c2
Compare
""" | ||
Test reindex command with skip_if_exists option when index already exists. | ||
""" | ||
mock_es.indices.exists.return_value = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the right mock - it should be exists_alias
- why is this test passing ?
@@ -58,4 +58,4 @@ def handle(self, *args, **options): | |||
# We should reindex even if no data is loaded/modified | |||
# because we might have a fresh instance of elasticsearch | |||
else: | |||
call_command('reindex', '--wipe', '--force', '--noinput') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should keep the --force
here. It prevents the error from being raise when there is already a reindexation in progress, which I think is what we want here, in case somehow it was triggered from elsewhere?
Follow up: #22805
Description
When running make up, if we are not explicitly cleaning and reseting the database and we have a non-empty database it is fair to assume that indexing may have already happened and we can safely skip reindex if the es index is already aliased
Context
See: LINK TO COMMENT for explanation
Testing
Run
make up
after runningmake down
and you should expect ES indexing to happen. Then runmake up
again and expect it not to happen. AddingINIT_CEAN=True
or wiping the database should also cause reindexing.Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.