Skip to content

Commit 17a9346

Browse files
committed
sync: add tests with periodic checkpointing
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
1 parent 008f2d9 commit 17a9346

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

crates/adapters/src/controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4007,7 +4007,7 @@ impl TransactionInfo {
40074007
/// controller threads.
40084008
pub struct ControllerInner {
40094009
pub status: Arc<ControllerStatus>,
4010-
last_checkpoint: Arc<Mutex<LastCheckpoint>>,
4010+
last_checkpoint: Mutex<LastCheckpoint>,
40114011
secrets_dir: PathBuf,
40124012
num_api_connections: AtomicU64,
40134013
command_sender: Sender<Command>,

python/tests/platform/test_checkpoint_sync.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def test_checkpoint_sync(
5858
strict: bool = False,
5959
expect_empty: bool = False,
6060
standby: bool = False,
61+
ft_interval: int = 60,
62+
automated_checkpoint: bool = False,
6163
):
6264
"""
6365
CREATE TABLE t0 (c0 INT, c1 VARCHAR);
@@ -69,7 +71,8 @@ def test_checkpoint_sync(
6971

7072
self.pipeline.set_runtime_config(
7173
RuntimeConfig(
72-
fault_tolerance_model=ft, storage=Storage(config=storage_config)
74+
fault_tolerance_model=ft, storage=Storage(config=storage_config),
75+
checkpoint_interval_secs=ft_interval,
7376
)
7477
)
7578
self.pipeline.start()
@@ -103,7 +106,10 @@ def test_checkpoint_sync(
103106
f"adhoc query returned {len(got_before)} but {processed} records were processed: {got_before}"
104107
)
105108

106-
self.pipeline.checkpoint(wait=True)
109+
if not automated_checkpoint:
110+
self.pipeline.checkpoint(wait=True)
111+
else:
112+
time.sleep(ft_interval)
107113
uuid = self.pipeline.sync_checkpoint(wait=True)
108114

109115
self.pipeline.stop(force=True)
@@ -124,7 +130,8 @@ def test_checkpoint_sync(
124130
)
125131
self.pipeline.set_runtime_config(
126132
RuntimeConfig(
127-
fault_tolerance_model=ft, storage=Storage(config=storage_config)
133+
fault_tolerance_model=ft, storage=Storage(config=storage_config),
134+
checkpoint_interval_secs=ft_interval,
128135
)
129136
)
130137

@@ -177,9 +184,13 @@ def test_from_uuid(self):
177184
def test_without_clearing_storage(self):
178185
self.test_checkpoint_sync(clear_storage=False)
179186

187+
@enterprise_only
188+
def test_automated_checkpoint(self):
189+
self.test_checkpoint_sync(ft_interval=5, automated_checkpoint=True)
190+
180191
@enterprise_only
181192
def test_autherr_fail(self):
182-
with self.assertRaisesRegex(RuntimeError, "SignatureDoesNotMatch"):
193+
with self.assertRaisesRegex(RuntimeError, "SignatureDoesNotMatch|Forbidden"):
183194
self.test_checkpoint_sync(auth_err=True, strict=True)
184195

185196
@enterprise_only

0 commit comments

Comments
 (0)