数据存储到 Firestore(数据存储模式)自动迁移:在 REDIRECT_STRONGLY_CONSISTENT_READS 步骤后访问数据存储时请求超时

Datastore to Firestore(datastore mode) automatic migration: request timeout while accessing datastore after REDIRECT_STRONGLY_CONSISTENT_READS step

我在 App Engine 标准环境中使用 Objectify(v5) 访问数据存储,Java。实体由Objectify自动缓存,我也是单独使用Memcache

这个 Datastore API 超时问题恰好在 post REDIRECT_STRONGLY_CONSISTENT_READS 迁移步骤开始发生。奇怪的是,它大约每隔一小时或两小时发生一次,持续 3-4 分钟,然后恢复正常。由于请求延迟从大约 200 毫秒上升到超过 60 秒,因此创建了许多新实例并且收费很高。

以下是一些错误:

com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method 
java.util.concurrent.CancellationException: Task was cancelled. 
at com.google.common.util.concurrent.AbstractFuture.cancellationExceptionWithCause(AbstractFuture.java:1550)
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:590)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:467)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:122)
at com.google.appengine.tools.development.TimedFuture.get(TimedFuture.java:55)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:68)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:89)
at com.google.appengine.api.datastore.Batcher$ReorderingMultiFuture.get(Batcher.java:114)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:89)
at com.googlecode.objectify.cache.TriggerFuture.get(TriggerFuture.java:100)
at com.googlecode.objectify.impl.ResultAdapter.now(ResultAdapter.java:34)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:22)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:10)
at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:22)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:10)
at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:30)

com.googlecode.objectify.cache.EntityMemcache getAll: Error obtaining cache for [<dummy-entity-name>]
    java.util.concurrent.CancellationException: Task was cancelled.

java.lang.InterruptedException
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:460)

我已经尝试升级到最新版本:

implementation 'com.google.appengine:appengine-api-1.0-sdk:2.0.5'
implementation 'javax.servlet:javax.servlet-api:3.1.0'
implementation 'com.googlecode.objectify:objectify:5.1.25'

并且还刷新了内存缓存。没有任何效果。

有人遇到过这个问题吗?

原来是迁移本身的问题。联系了 Google 云支持(付费),Datastore/Firestore 产品团队暂停了迁移,顺便说一句,我自己无法做到,我的项目不允许这样做。他们做了一些修复并完成了迁移。现在 Datastore 按预期查询 运行。