Add atomic reindex support, via --atomic flag in search:import#324
Add atomic reindex support, via --atomic flag in search:import#324chloelbn merged 1 commit intoalgolia:masterfrom ostrolucky:atomic-reindex
Conversation
| $realIndexName = $this->searchService->searchableAs($entityClassName); | ||
|
|
||
| if ($shouldDoAtomicReidex) { | ||
| $tmpIndex = $this->searchServiceForAtomicReindex->searchableAs($entityClassName); |
There was a problem hiding this comment.
Scout-extended is doing here try {} catch {}, but command does handle situation with missing original index fine according my testing.
|
Nothing I can do with test failure |
|
Hey @ostrolucky! Thanks for your PR. As we are getting ready for the release and this feature can be delivered as a minor, I'll postpone the review a little bit. Thanks for your patience! |
|
Rebased on master. 4.0 is out for some time. Any chance to take a look at this now? |
|
Hi @ostrolucky , thank you for your patience! Overall it looks good but could you tell me why you favored a |
|
Two reasons
|
|
@ostrolucky I understand your explanation. In that case I'd rather change the flag for |
|
It doesn't convey that data is imported from scratch and obsolete data will be erased. How about |
|
@ostrolucky it's the |
|
Indeed, failure with testSearchImportAggregator was valid. Fixed and renamed clear to atomic. |
nunomaduro
left a comment
There was a problem hiding this comment.
I am a fan if your implementation, I like it.
One very important thing tho, we should allow the user to pass a --safe, that should call the wait method on the copy, on the sum of all responses ( after the while ), and on the very last move: https://github.com/algolia/algoliasearch-client-php/blob/ffa03964a56adafbb3bef5b06d7445ff2a73eb5b/src/SearchIndex.php#L217.
Is it really useful? Algolia queues up these operations. IMHO it's useful only when having following operation retrieving data from algolia, which we don't do here. See from https://www.algolia.com/doc/api-client/methods/indexing/#asynchronous-methods: "What you are actually doing when calling these methods is adding a new job to a queue". My testing confirms that. Can you think of some scenario to reproduce failing of this command not using wait methods? |
Yes, but let's implement it later in another pull request ( doesn't have to be done by you! ). Thanks for all the work so far. |
|
Alright, I think I addressed everything :) |
|
Would you mind rebasing on master please? |
|
done |
0 downtime
search:clear && search:importsolution