[英]Multiple Operations on Multiple Sets (Tables) in Aerospike cluster
Current system state:当前系统 state:
Currently, I maintain three sets (tables, equivalent in RDBMS) in my aerospike namespace (database, equivalent in RDBMS) backed by RESTful service.目前,我在由 RESTful 服务支持的 aerospike 命名空间(数据库,在 RDBMS 中等效)中维护了三个集合(表,在 RDBMS 中等效)。
Use-case:用例:
I want to perform CRUD operations on at least one set and sometimes at most on all sets based on some bulk inputs into my system.我想根据对我系统的一些批量输入,对至少一个集合执行 CRUD 操作,有时最多对所有集合执行 CRUD 操作。
Expectation:期待:
I want to perform all these CRUD operations in an atomic manner (means either all happen or none. This also contains an edge-case where some sets are successfully updated with their respective latest updates, and later on even a single set is un-successful. I would want to rollback my data to the previous state in each set.)我想以原子方式执行所有这些 CRUD 操作(意味着要么全部发生,要么都不发生。这还包含一个边缘情况,其中一些集合已成功更新其各自的最新更新,后来甚至单个集合都不成功. 我想将我的数据回滚到每组中以前的 state。)
My workaround:我的解决方法:
Second, I thought of creating an intermediate rollback workflow module.其次,我想到了创建一个中间回滚工作流模块。 Psuedo code shown below:
伪代码如下所示:
IF[everything runs till the end]: GOTO step 6; ELSE: GOTO step 4
IF[everything runs till the end]: GOTO step 6; ELSE: GOTO step 4
. IF[everything runs till the end]: GOTO step 6; ELSE: GOTO step 4
。IF[everything runs till the end]: GOTO step 7; ELSE: GOTO step 5
IF[everything runs till the end]: GOTO step 7; ELSE: GOTO step 5
. IF[everything runs till the end]: GOTO step 7; ELSE: GOTO step 5
。GO TO step 7;
Help Needed:需要帮助:
InsertOnSubmit
behaviour on Aerospike cluster without creating my own roll-back workflow?InsertOnSubmit
行为?1 - No. Aerospike offers atomicity only at a single record level. 1 - 没有。Aerospike 仅在单个记录级别提供原子性。 While inserting Master record and then replicating its copy to another node do follow true 2-phase commit semantics in Aerospike's Strong Consistency (SC) mode, any multi-record transaction has to be implemented at the application level.
在插入主记录然后将其副本复制到另一个节点时,在 Aerospike 的强一致性 (SC) 模式下确实遵循真正的两阶段提交语义,任何多记录事务都必须在应用程序级别实现。
2 - Any scheme implementing multi-record transactions, such as one you are thinking of, typically involves - creating some kind of "lock" bin in a record that you set, do the multi-record updates, build a before and after state of your data, have some kind of a maximum time to complete so you can rollback and clear abandoned operations and lock by the client application. 2 - 任何实现多记录事务的方案,例如您正在考虑的方案,通常涉及 - 在您设置的记录中创建某种“锁定”箱,进行多记录更新,在 state 之前和之后构建您的数据,有某种最长时间来完成,以便您可以回滚并清除客户端应用程序的放弃操作和锁定。 Any of these schemes will only work reliably under Aerospike's Strong Consistency mode.
这些方案中的任何一个都只能在 Aerospike 的强一致性模式下可靠地工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.