fix: initialize shadow snapshot state
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
FT546 shadow-only read model for SQL Server 2016 RTM (13.0).
|
||||
This package writes only alg.* and never changes Legacy WMS business rows.
|
||||
A clean install creates an empty INITIALIZING package. The v3 worker owns
|
||||
the first refresh and publication.
|
||||
A clean install creates an INITIALIZING state for warehouse 01. The v3
|
||||
worker owns the first refresh and publication.
|
||||
*/
|
||||
SET NOCOUNT ON;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
@@ -186,6 +186,10 @@ CREATE TABLE alg.shadow_snapshot_state (
|
||||
);
|
||||
GO
|
||||
|
||||
INSERT INTO alg.shadow_snapshot_state (warehouse_id, snapshot_generation, snapshot_status)
|
||||
VALUES ('01', 0, 'INITIALIZING');
|
||||
GO
|
||||
|
||||
CREATE TABLE alg.cargo_space_snapshot (
|
||||
warehouse_id varchar(80) NOT NULL,
|
||||
space_id varchar(80) NOT NULL,
|
||||
|
||||
@@ -234,6 +234,16 @@ class ShadowSqlServerMigrationScriptTest {
|
||||
"truncate table alg.decision_log");
|
||||
}
|
||||
|
||||
@Test
|
||||
void cleanInstallSeedsAuthoritativeWarehouseAsInitializing() throws IOException {
|
||||
String install = normalize(resource("db/sqlserver/install-shadow.sql"));
|
||||
|
||||
assertThat(install).contains(
|
||||
"insert into alg.shadow_snapshot_state "
|
||||
+ "(warehouse_id, snapshot_generation, snapshot_status) "
|
||||
+ "values ('01', 0, 'initializing')");
|
||||
}
|
||||
|
||||
@Test
|
||||
void claimUsesOnlyPackageHeartbeatAndA120SecondStaleThreshold() throws IOException {
|
||||
String install = normalize(resource("db/sqlserver/install-shadow.sql"));
|
||||
|
||||
Reference in New Issue
Block a user