mongodb4.0即将推出,最大的亮点莫过于,开始支持‘真正的’事务了。为什么说是真正的呢?之前的行级别原子性,两阶段提交,要么应用场景有限,要么实现成本太高,有点‘鸡肋’。
大年三十的时候,mongodb的CTO兼联合创始人Eliot Horowitz就发文给大家介绍了mongodb4.0的事务特性,让我们一起看一下吧!
有兴趣的可以去官网查看英文版,https://www.mongodb.com/blog/post/multi-document-transactions-in-mongodb,这里只是解读,不是翻译。
MongoDB 4.0 will add support for multi-documenttransactions, making it the only database to combine the speed, flexibility,and power of the document model with ACID data integrity guarantees. Throughsnapshot isolation, transactions provide a globally consistent view of data,and enforce all-or-nothing execution to maintain data integrity.
多文档事务:可以理解为多行,以前都是单行级别的原子性。
目标:高速、灵活、以及基于文档模型的事务支持
事务:通过快照实现、全局一致性,由此可鉴,应该是全局锁,性能不会太高