Closed Serpentian closed 1 year ago
There is a new proposal in the ticket: #372 (comment). This way might be much less crutchy and significantly more useful in general. Can you talk to customers of this feature if they can leverage the triggers-way like described in the comment instead of us doing those spaces in master?
Agree with you, this solution is a big crutch, triggers looks much better. Don't really think they will be against this idea, but I'll definitely ask them.
Buckets migration looks like a regular client data activity, indistinguishable in the replication flow. In order to allow efficient change data capturing we can add a fake operation in the beginning of the transaction, so that a client could determing which operations can be skipped (using HEADER.tsn) as they were done not by the user but by gc or rebalancer.
In order not to implement "dirty hack" with special cases, this commit introduces the ability for a user to set the trigger.
Closes https://github.com/tarantool/vshard/issues/372
Co-authored-by: Vladislav Shpilevoy v.shpilevoy@tarantool.org
@TarantoolBot document Title: vshard.storage.on_bucket_event()
vshard.storage.on_bucket_event([trigger-function[, old-trigger-function]])
Create a trigger, which is executed when the data from the user spaces is changed (deleted or inserted) due to the rebalancing process. It's triggered on every data batch changed.
Parameters:
Return: nil or function pointer
As everything executed inside triggers is already in a transaction, you shouldn't use transactions, yield-operations, changes to different space engines.
The trigger-function can have up to three parameters:
Example