从同时写入的 table 中读取扳手数据
Read spanner data from a table which is simultaneously being written
我正在通过 Dataflow 作业将 Spanner 数据复制到 BigQuery。该作业计划每 15 分钟 运行。问题是,如果从同时写入的 Spanner table 读取数据,则在复制到 BigQuery 时会丢失一些记录。
我在读取 Spanner 数据时使用了 readOnlyTransaction()。执行此操作时我必须采取任何其他预防措施吗activity?
建议使用 Cloud Spanner 提交时间戳来填充像 update_date
这样的列。提交时间戳允许应用程序确定突变的确切顺序。
使用 update_date
的提交时间戳并指定读取的准确时间戳,Dataflow 作业将能够找到自上次 运行.[=14= 以来的所有现有记录 written/committed ]
if the data is read from a Spanner table which is also being written at the same time, some of the records get missed while copying to BigQuery
这就是交易的运作方式。它们在创建事务时提供数据库的'snapshot view',因此在拍摄此快照后写入的任何行将不包括在内。
因为, using commit timestamps on your rows, and keeping track of the timestamp when you last exported (available from the ReadOnlyTransaction object)会让你准确select'new/updated rows since last export'
我正在通过 Dataflow 作业将 Spanner 数据复制到 BigQuery。该作业计划每 15 分钟 运行。问题是,如果从同时写入的 Spanner table 读取数据,则在复制到 BigQuery 时会丢失一些记录。
我在读取 Spanner 数据时使用了 readOnlyTransaction()。执行此操作时我必须采取任何其他预防措施吗activity?
建议使用 Cloud Spanner 提交时间戳来填充像 update_date
这样的列。提交时间戳允许应用程序确定突变的确切顺序。
使用 update_date
的提交时间戳并指定读取的准确时间戳,Dataflow 作业将能够找到自上次 运行.[=14= 以来的所有现有记录 written/committed ]
if the data is read from a Spanner table which is also being written at the same time, some of the records get missed while copying to BigQuery
这就是交易的运作方式。它们在创建事务时提供数据库的'snapshot view',因此在拍摄此快照后写入的任何行将不包括在内。
因为