Side by Side Indexes in RavenDB
Join the DZone community and get the full member experience.Join For Free
one of the new features we just finished working on is the notion of side by side indexes. you can see how to access it on the image, but what is it?
as usual lately, this is part and parcel of our current focus in operations. the basic notion is simple. you have an index in production that you want to update, but just updating it on the fly isn’t going to work.
the problem is that updating the index force a complete reindexing of the data, and in most production systems, we have enough documents that this can take a while. that means that during the indexing process, your application would see partial results, and may see that for a while. common work around was to add support in your application to change the index name, so you would create a new index, wait for it to become non stale and then you would update the application configuration so you would query the new index.
with the side by side option, this is all handled for you. when you save an index with side by side option, you get the following options:
basically, we create the index under a temporary name, and start indexing it. and you can choose when ravendb automatically will make the switch (note that there is an or condition between those, so any of those that match would work).
this give you the option of changing an index, and have no interruptions of service, because ravendb will take care of all of that for you. you can even mark an index with a “force to change via side-by-side”, which will protect it from accidental changes.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.