Skip to content

Commit 7d6fa02

Browse files
committed
Add systets for multiuse snapshots w/ read_timestamp / exact_staleness.
1 parent 26bdbc5 commit 7d6fa02

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎spanner/tests/system/test_system.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,43 @@ def test_multiuse_snapshot_read_isolation_strong(self):
589589
after=list(strong.read(self.TABLE, self.COLUMNS, self.ALL))
590590
self._check_row_data(after, all_data_rows)
591591

592+
deftest_multiuse_snapshot_read_isolation_read_timestamp(self):
593+
ROW_COUNT=40
594+
session, committed=self._set_up_table(ROW_COUNT)
595+
all_data_rows=list(self._row_data(ROW_COUNT))
596+
read_ts=session.snapshot(read_timestamp=committed, multi_use=True)
597+
598+
before=list(read_ts.read(self.TABLE, self.COLUMNS, self.ALL))
599+
self._check_row_data(before, all_data_rows)
600+
601+
withself._db.batch() asbatch:
602+
batch.delete(self.TABLE, self.ALL)
603+
604+
after=list(read_ts.read(self.TABLE, self.COLUMNS, self.ALL))
605+
self._check_row_data(after, all_data_rows)
606+
607+
deftest_multiuse_snapshot_read_isolation_exact_staleness(self):
608+
importtime
609+
fromdatetimeimporttimedelta
610+
ROW_COUNT=40
611+
612+
session, committed=self._set_up_table(ROW_COUNT)
613+
all_data_rows=list(self._row_data(ROW_COUNT))
614+
615+
time.sleep(1)
616+
delta=timedelta(microseconds=1000)
617+
618+
exact=session.snapshot(exact_staleness=delta, multi_use=True)
619+
620+
before=list(exact.read(self.TABLE, self.COLUMNS, self.ALL))
621+
self._check_row_data(before, all_data_rows)
622+
623+
withself._db.batch() asbatch:
624+
batch.delete(self.TABLE, self.ALL)
625+
626+
after=list(exact.read(self.TABLE, self.COLUMNS, self.ALL))
627+
self._check_row_data(after, all_data_rows)
628+
592629
deftest_read_w_manual_consume(self):
593630
ROW_COUNT=4000
594631
session, committed=self._set_up_table(ROW_COUNT)

0 commit comments

Comments
 (0)