Riak search, post schema change reindexation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Riak search, post schema change reindexation

Guillaume Boddaert
Hi,

I recently needed to alter my Riak Search schema for a bucket type that contains ~30 millions rows. As a result, my index was wiped since we are waiting for a Riak Search 2.2 feature that will sync Riak storage with Solr index on such an occasion.

I adapted a since script suggested by Evren Esat Özkan there (https://github.com/basho/yokozuna/issues/130#issuecomment-196189344). It is a simple python script that will stream keys and trigger a store action for any items. Unfortunately it failed past 178k items due to time out on the key stream. I calculated that this kind of reindexation mechanism would take up to 5 days without a crash to succeed.

I was wondering if there would be a pure Erlang mean to achieve a complete forced rewrite of every single element in my bucket type rather that an error prone and very long python process.

How would you guys reindex a 30 million item bucket type in a fast and reliable way ?

Thanks, Guillaume

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Riak search, post schema change reindexation

Fred Dushin
Hi Guillame,

A few questions.

What version of Riak?

Does the reindexing need to occur across the entire cluster, or just on one node?

What are the expectations about query-ability while re-indexing is going on?

If you can afford to take a node out of commission for query, then one approach would be to delete your YZ data and YZ AAE trees, and let AAE sync your 30 million documents from Riak.  You can increase AAE tree rebuild and exchange concurrency to make that occur more quickly than it does by default, but that will put a fairly significant load on that node.  Moreover, because you have deleted indexed data on one node, you will get inconsistent search results from Yokozuna, as the node being reindexed will still show up as part of a coverage plan.  Depending on the version of Riak, however, you may be able to manually remove that node from coverage plans through the Riak console while re-indexing is going on.  The node is still available for Riak get/put operations (including indexing new entries into Solr), but it will be excluded from any cover set when a query plan is generated.  I can't guarantee that this would take less than 5 days, however.

-Fred

On Aug 29, 2016, at 3:56 AM, Guillaume Boddaert <[hidden email]> wrote:

Hi,

I recently needed to alter my Riak Search schema for a bucket type that contains ~30 millions rows. As a result, my index was wiped since we are waiting for a Riak Search 2.2 feature that will sync Riak storage with Solr index on such an occasion.

I adapted a since script suggested by Evren Esat Özkan there (https://github.com/basho/yokozuna/issues/130#issuecomment-196189344). It is a simple python script that will stream keys and trigger a store action for any items. Unfortunately it failed past 178k items due to time out on the key stream. I calculated that this kind of reindexation mechanism would take up to 5 days without a crash to succeed.

I was wondering if there would be a pure Erlang mean to achieve a complete forced rewrite of every single element in my bucket type rather that an error prone and very long python process.

How would you guys reindex a 30 million item bucket type in a fast and reliable way ?

Thanks, Guillaume
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Riak search, post schema change reindexation

Guillaume Boddaert
Hi Fred, thanks for your answer.

I'm using Riak 2.1 see attached status export.
I'm working on a single cluster, and need to update from time to time the some search index on all nodes.
As a cloud user, I can consider buying a spare host for a few days in order to achieve a complete rollout.

I can understand your plan to remove an host from production while it reconstruct its index. From my point of view your solution can only be applied on a broken Solr index, that needs to be rebuild from scratch on a single host.
In my case, I need to reindex my documents because I was updated my solr schema, which requires to wipe existing index beforehand (create new index, change bucket index_name prop, drop old index), on all hosts since that's a bucket type property that I need to update.

Fred, is your plan can be really applied on a « I want to update my search schema on my full cluster » ?

At the moment, I already created the new index, destroyed the old one, and I am unable to use a slow python script to force all items to be written again (and subsequently pushed to solr) since I get regular timeout on key stream API (both protobuff and http).
Is there a way to run a program inside riak nodes (not http, not protobuf) to achieve this simple algorithm:

for key in bucket.stream_keys():
  obj = bucket.get(key)
  bucket.store(obj)

I really fear that will not be able to restore my index any time soon. I am not stressed out because we are not in production yet, I have still plenty of time to fix that as new data is available. But this kind of complex operations required by index update really freak me out.

Guillaume


On 29/08/2016 14:41, Fred Dushin wrote:
Hi Guillame,

A few questions.

What version of Riak?

Does the reindexing need to occur across the entire cluster, or just on one node?

What are the expectations about query-ability while re-indexing is going on?

If you can afford to take a node out of commission for query, then one approach would be to delete your YZ data and YZ AAE trees, and let AAE sync your 30 million documents from Riak.  You can increase AAE tree rebuild and exchange concurrency to make that occur more quickly than it does by default, but that will put a fairly significant load on that node.  Moreover, because you have deleted indexed data on one node, you will get inconsistent search results from Yokozuna, as the node being reindexed will still show up as part of a coverage plan.  Depending on the version of Riak, however, you may be able to manually remove that node from coverage plans through the Riak console while re-indexing is going on.  The node is still available for Riak get/put operations (including indexing new entries into Solr), but it will be excluded from any cover set when a query plan is generated.  I can't guarantee that this would take less than 5 days, however.

-Fred

On Aug 29, 2016, at 3:56 AM, Guillaume Boddaert <[hidden email]> wrote:

Hi,

I recently needed to alter my Riak Search schema for a bucket type that contains ~30 millions rows. As a result, my index was wiped since we are waiting for a Riak Search 2.2 feature that will sync Riak storage with Solr index on such an occasion.

I adapted a since script suggested by Evren Esat Özkan there (https://github.com/basho/yokozuna/issues/130#issuecomment-196189344). It is a simple python script that will stream keys and trigger a store action for any items. Unfortunately it failed past 178k items due to time out on the key stream. I calculated that this kind of reindexation mechanism would take up to 5 days without a crash to succeed.

I was wondering if there would be a pure Erlang mean to achieve a complete forced rewrite of every single element in my bucket type rather that an error prone and very long python process.

How would you guys reindex a 30 million item bucket type in a fast and reliable way ?

Thanks, Guillaume
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

riak_version.txt (2K) Download Attachment