Amazon Aurora 是否为从属节点上的只读事务 运行 提供可序列化隔离?

Does Amazon Aurora offer serializable isolation for read-only transaction running on slave nodes?

据我阅读 Amazon aurora 文档的了解,即使 Aurora 主节点将 WAL 日志同步写入 6 个存储节点中的 4 个。除非有 master 的切换,否则 Aurora slave 仅使用直接从 master 节点发送的异步日志保持同步。

如果这是真的,我假设客户端可以写入一个值并将其提交给主节点,然后立即向其中一个从节点发送只读查询并观察旧值而不是最新值刚刚写入的值。

这意味着它只能在从站上支持快照隔离模式。

这似乎是一个很大的限制!我想确保这是正确的。

Serializable isolation是集群的一个难题。我不知道有任何人真正支持它。如果有人这样做,我不知道我是否愿意接受随之而来的性能影响。

运行 极光实例上的以下内容似乎表明仅支持 REPEATABLE-READ

mysql> SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+-----------------------+-----------------+
| @@GLOBAL.tx_isolation | @@tx_isolation  |
+-----------------------+-----------------+
| REPEATABLE-READ       | REPEATABLE-READ |
+-----------------------+-----------------+
1 row in set (0.00 sec)
mysql> SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
+-----------------------+-----------------+
| @@GLOBAL.tx_isolation | @@tx_isolation  |
+-----------------------+-----------------+
| REPEATABLE-READ       | REPEATABLE-READ |
+-----------------------+-----------------+
1 row in set (0.00 sec)

由于复制滞后的最终一致性;如果你接收实时数据很重要,你应该对着主人阅读。

Aurora 的副本延迟相对于非 Aurora 只读副本非常小,但仍然是一个非零值,您可以使用 CloudWatch 指标 AuroraBinlogReplicaLagAuroraReplicaLag 进行监控 - 记录更广泛在 https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Monitoring.html. Specific to your question, Aurora doesn't write to all 6 copies of the storage syncronously - only 4. A 4-part blog super deep dive on how this storage system works can be found at https://aws.amazon.com/blogs/database/amazon-aurora-under-the-hood-quorum-and-correlated-failure, and I encourage everyone to read it. You can also read more about Aurora Replication at https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Replication.html. but Steve Buzonas is correct - if you need guaranteed read-after-write SERIALIZABLE reads, then you need to read from the writer instance endpoint: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html