gpt4 book ai didi

Firestore PITR returns Invalid Transaction(FiRestore PITR返回无效事务)

转载 作者:bug小助手 更新时间:2023-10-24 20:52:58 29 4
gpt4 key购买 nike



Today was the day I needed to recover the initial version of an updated document, as described in the docs. I know from Firestore that the document was created on September 10, 2023 at 16:19:17 GMT ({ _seconds: 1694362757, _nanoseconds: 397127000 })

正如文档中所描述的,今天是我需要恢复更新文档的初始版本的日子。我从FiRestore得知文档创建于2023年9月10日格林尼治标准时间16:19:17({_秒:1694362757,_纳秒:397127000})


Running the example from the documentation returns an error when trying with any readTime earlier than 1694390000 (September 10, 23:53:20 GMT):

运行文档中的示例时,如果尝试使用早于1694390000(格林威治标准时间9月10日23:53:20)的任何读取时间,则会返回错误:



Invalid transaction. Exception occurred in retry method that was not classified as transient



const ref = db.collection('rentals').doc('q5MsBad7ZKM9jP5FbZbJ')

const doc = await db.runTransaction(
transaction => transaction.get(ref),
{readOnly: true, readTime: new Timestamp(1694362757, 397127000)}
)

Any clue what's wrong? GCS specifies earliest data point is 4th of September, which is correct, since it is only available for 7 days. As a last resort, I'd try exporting the DB at that specific point in time but it is gigantic with the logs table having millions of entries .. hoping that it would return the document as it was when created.

有什么不对劲的线索吗?GCS指定最早的数据点是9月4日,这是正确的,因为它只有7天有效。作为最后的手段,我会尝试在那个特定的时间点导出数据库,但是由于日志表有数百万个条目,所以它非常庞大。希望它能将文件按创建时的原样归还。


Please advise

请告知


更多回答
优秀答案推荐

Hi I know it is a few days late, but the solution to your problem is to make sure that the timestamp you are using is at a whole minute granularity. This tripped me up for quite a while at first as well.
From the docs
"Make sure that the timestamp you specify is a whole minute timestamp within the past hour, but not earlier than the earliestVersionTime. If data no longer exists at the specified timestamp, an error is generated."
https://cloud.google.com/firestore/docs/use-pitr

嗨,我知道这晚了几天,但解决问题的办法是确保您正在使用的时间戳是整分钟的粒度。一开始,我也被绊倒了很长一段时间。在文档中,请确保您指定的时间戳是过去一小时内的整分钟时间戳,但不能早于早期版本时间。如果在指定的时间戳上不再存在数据,则会生成错误。Https://cloud.google.com/firestore/docs/use-pitr


更多回答

Yep, thanks for the input. I forgot to add a solution here myself. Firebase Support came through quite quick on it after sending them all de nitty gritty.

是的,谢谢你的投入。我自己忘了在这里添加一个解决方案。火力支援在把他们全部送来后很快就来了。

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com