当 AppEngine 上的 ID 耗尽时,我会发生什么?

发布于 2025-01-01 14:05:48 字数 356 浏览 2 评论 0原文

我永远不会创建足够的实体来耗尽 63 位地址空间,但假设我使用 allocateIdRange 来分配 id 9223372036854775807 (几乎是 2^63)。对于新的自动输入的实体来说,这种实体是否会被破坏?

我在测试应用程序中尝试了这一点。似乎自动 IDer 的某些分片可以继续生成有效的 id,但其他分片只是给出 DatastoreFailureException。成功率约为30%。它会上涨吗?

这实际上是一个严肃的问题,因为我天真地创建了一些相当大的 id。在达到这个限制之前,我还有几万亿个实体需要去,但我注意到实体之间的 ID 可以跳跃数百万,并且我以每年大约一百万的速度输入新实体。所以...我害怕达到这个极限。

I would never create enough entities to run out of 63-bit address space, but say I used allocateIdRange to allocate the id 9223372036854775807 (which is almost 2^63). Is that kind of entity just broken for new, automatically entered entities?

I tried this out in a test app . It seems that some shards of the auto-IDer can continue to produce valid ids, but other shards just give a DatastoreFailureException. The success rate is about 30%. Will it ever go up?

This is actually a serious question because, in my naivete, I created some rather huge ids. I still have several trillion entities to go before I come up to this limit, but I've noticed that the ids can jump by millions between entities, and I enter new entities at the rate of about a million per year. So... I'm scared of hitting this limit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除→记忆 2025-01-08 14:05:48

通过测试应用程序,我使用 allocateIdRange 保留了一堆非常高的 id。起初,我尝试建立新实体的尝试大约有一半成功了。现在,没有新实体可以添加空白 ID - 每次都会引发 DatastoreFailureException。我认为这是因为密钥分配器实现不跟踪密钥中的间隙,而仅跟踪迄今为止给出的最高 id。

我没有看到任何方法可以重置此类计数器,因此我认为唯一的解决方案是选择一个新的 Kind 名称。

教训:不要使用 2^63 附近的 ids!

With a test app I reserved a bunch of very high ids with allocateIdRange. At first, about half of my attempts to put new entities succeeded. Now, no new entities can be put with a blank id - a DatastoreFailureException is raised every time. I presume this is because the key allocator implementation does not keep track of gaps in keys, but only keeps track of the highest id given out so far.

I don't see any way to reset the counter for this Kind, so I think the only solution would be to pick a new Kind name.

Lesson: don't use ids anywhere near 2^63!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文