douke6424
2013-11-25 06:15
浏览 8
已采纳

GAE多租户和交易-Go

If I use multitenancy feature on GAE Datastore, will a datastore transaction lock be applied per tenant as well? Or if a tenant is using a datastore transaction, all of the other tenants will have to wait until the tenant's transaction is finished?

图片转代码服务由CSDN问答提供 功能建议

如果我在GAE数据存储区上使用多租户功能,是否也会对每个租户应用数据存储区交易锁? 还是如果承租人正在使用数据存储交易,那么所有其他承租人都必须等到承租人的交易完成?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douan5151 2013-11-25 11:01
    已采纳

    Two things to note:

    1. Namespace is part of the key of the entity, so transaction will work only for entities that are part of your transaction. Entities of other namespaces will not be affected even if they have same IDs.

    2. Transactions on GAE do not do locking, instead they use optimistic concurrency control. So transactions are never blocking, just when two transactions operate on same entities the second will fail and then go runtime will try to repeat it up to three times. This auto-retry is the reason why your transactions should be idempotent (= running the code multiple times should produce same end result).

    评论
    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题