Closed oruchreis closed 2 years ago
Hi, @oruchreis!
Those methods are pretty similar, but a bit different. ModifyItem
requires 1 or more documents, which will be handled sequentially one by one. It's useful, when you are inserting documents or want to update few specific documents.
Update
and Delete
methods, on the other hand, accept query in JSON DSL format:
https://github.com/Restream/reindexer/blob/1cbb63ce2ba80af1512deb41458f04b77d406bb9/cpp_src/server/contrib/server.yml#L2248
With DSL you are able to construct some equvalents of SQL-sentences (like UPDATE SET field1 = 'value' WHERE id > 100
, for example). So it will be useful , when you don't have specific documents, but have some conditions to find them.
Also there is a difference in internal implementation. Update
and Delete
are atomic (i.e. both documents search and all the modifications will be executed under single mutex), and ModifyItem
will take separate mutex lock for each item in bulk
Thanks, it is all clear now, especially this quote:
Update and Delete are atomic (i.e. both documents search and all the modifications will be executed under single mutex), and ModifyItem will take separate mutex lock for each item in bulk
Hi, I saw these methods in grpc proto:
I know that
ModifyItem
is a bidirectional stream method, and supports bulk operations. But this method also does other methods' job, which means I can do any operations withModifyItem
method thatUpdate, Delete
methods do. Is there any particular reason to useUpdate, Delete
methods over ModifyItem method, maybe performance reasons or something else?