应用引擎数据存储事务异常 [英] app engine datastore transaction exception

查看:181
本文介绍了应用引擎数据存储事务异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用引擎交易文档中,我发现了以下注释:注意:如果您的应用程序在提交事务时收到异常,
并不总意味着事务失败。您可以在
的情况下收到
超时,TransactionFailedError或InternalError异常,其中事务已被提交并最终将成功应用
。只要有可能,使您的Datastore交易
idempotent,以便如果您重复交易,最终结果将是
相同。


这是相当一般的信息,我无法找到更多的细节。关于此问题,我有以下问题:


  1. 它会影响NDB转换吗? NDB文档不会
    提及它,但我想这种行为被继承

  2. 什么会导致这种情况?

  3. 发生这种情况的频率

  4. 是否可以阻止它,或者降低概率?

  5. 在这种情况下,事务性任务是否排队?

  6. 这种情况是一个错误,修正了将来的功能,还是我应该习惯的功能?
  7. 是的,它也会影响ndb。



    可能的原因包括网络分区,数据存储服务器成功提交但无法将结果传递给应用程序。

    这是罕见的,但不能被阻止,并且永远不会被修复。它是所有分布式系统固有的。



    任务队列添加由数据存储服务器用事务提交。


    In app engine transactions documentation I have found the following note:

    Note: If your app receives an exception when submitting a transaction, it does not always mean that the transaction failed. You can receive Timeout, TransactionFailedError, or InternalError exceptions in cases where transactions have been committed and eventually will be applied successfully. Whenever possible, make your Datastore transactions idempotent so that if you repeat a transaction, the end result will be the same.

    This is quite general information and I wasn't able to find more details. I have the following questions regarding this issue:

    1. Does it affect NDB transations? NDB documentation doesn't mention it, but I suppose that this behavior is inherited
    2. What can cause this type of situation?
    3. How often can it happen?
    4. Can I prevent it, or decrease probability?
    5. Are transactional tasks enqueued in this situation?
    6. Is this situation a bug, which will be fixed in the future, or a feature, which I should just get used to?

    解决方案

    Yes, it affects ndb too.

    Potential causes include network partitions where the datastore server commits successfully but cannot communicate the result to the app.

    It is rare, but cannot be prevented, and will never be fixed. It is inherent to all distributed systems.

    Task queue adds are committed with the transaction by the datastore server.

    这篇关于应用引擎数据存储事务异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆