Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d6fa02

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

File tree

Expand file treeCollapse file tree

1 file changed

+37
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+37
-0
lines changed

‎spanner/tests/system/test_system.py

Copy file name to clipboardExpand all lines: spanner/tests/system/test_system.py
+37Lines 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+
def test_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+
with self._db.batch() as batch:
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+
def test_multiuse_snapshot_read_isolation_exact_staleness(self):
608+
import time
609+
from datetime import timedelta
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+
with self._db.batch() as batch:
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
def test_read_w_manual_consume(self):
593630
ROW_COUNT = 4000
594631
session, committed = self._set_up_table(ROW_COUNT)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.