Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLUSH after insert to make SHOW command predictable #1427

Merged
merged 3 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ write "INSERT INTO zb_catalog.zfunctions (name, sql) VALUES ('send_payment', 'CR
"$$\n"
"WITH (\n"
" EVENTS = ''app_events''\n"
");');"
");'); "
"FLUSH;"
[0x00]

read advised zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ read "INSERT INTO zb_catalog.zfunctions (name, sql) VALUES ('send_payment', 'CRE
"$$\n"
"WITH (\n"
" EVENTS = ''app_events''\n"
");');"
");'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ write zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
write "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS \"cities\" (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS \"cities\" (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ read zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
read "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS \"cities\" (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS \"cities\" (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ write "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"(id VARCHAR, name VARCHAR, description VARCHAR, "
"owner_id VARCHAR GENERATED ALWAYS AS IDENTITY, "
"created_at TIMESTAMP GENERATED ALWAYS AS NOW, "
"PRIMARY KEY (id));');"
"PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ read "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"(id VARCHAR, name VARCHAR, description VARCHAR, "
"owner_id VARCHAR GENERATED ALWAYS AS IDENTITY, "
"created_at TIMESTAMP GENERATED ALWAYS AS NOW, "
"PRIMARY KEY (id));');"
"PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ write zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
write "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ read zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
read "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ write zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
write "INSERT INTO zb_catalog.zviews (name, sql) VALUES "
"('distinct_cities', 'CREATE ZVIEW IF NOT EXISTS distinct_cities AS SELECT id, city FROM weather GROUP BY city;');"
"('distinct_cities', 'CREATE ZVIEW IF NOT EXISTS distinct_cities AS SELECT id, city FROM weather GROUP BY city;'); "
"FLUSH;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ read zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
read "INSERT INTO zb_catalog.zviews (name, sql) VALUES "
"('distinct_cities', 'CREATE ZVIEW IF NOT EXISTS distinct_cities AS SELECT id, city FROM weather GROUP BY city;');"
"('distinct_cities', 'CREATE ZVIEW IF NOT EXISTS distinct_cities AS SELECT id, city FROM weather GROUP BY city;'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "DELETE FROM zb_catalog.zfunctions WHERE name = 'send_payment';"
write "DELETE FROM zb_catalog.zfunctions WHERE name = 'send_payment'; FLUSH;"
[0x00]

read advised zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "DELETE FROM zb_catalog.zfunctions WHERE name = 'send_payment';"
read "DELETE FROM zb_catalog.zfunctions WHERE name = 'send_payment'; FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "DELETE FROM zb_catalog.ztables WHERE name = 'weather';"
write "DELETE FROM zb_catalog.ztables WHERE name = 'weather'; FLUSH;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "DELETE FROM zb_catalog.ztables WHERE name = 'weather';"
read "DELETE FROM zb_catalog.ztables WHERE name = 'weather'; FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ write zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
write "DELETE FROM zb_catalog.zviews WHERE name = 'weather';"
write "DELETE FROM zb_catalog.zviews WHERE name = 'weather'; FLUSH;"
[0x00]
write flush

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ read zilla:data.ext ${pgsql:dataEx()
.query()
.build()
.build()}
read "DELETE FROM zb_catalog.zviews WHERE name = 'weather';"
read "DELETE FROM zb_catalog.zviews WHERE name = 'weather'; FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ write zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
write "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]

read advised zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ read zilla:data.ext ${pgsql:dataEx()
.build()
.build()}
read "INSERT INTO zb_catalog.ztables (name, sql) VALUES "
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));');"
"('cities', 'CREATE ZTABLE IF NOT EXISTS cities (id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));'); "
"FLUSH;"
[0x00]

write advise zilla:flush ${pgsql:flushEx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public RisingwaveMacroState onError(
private final class InsertIntoCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s');\u0000""";
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s'); FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public RisingwaveMacroState onError(
private final class InsertIntoCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s');\u0000""";
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s'); FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public RisingwaveMacroState onError(
private final class InsertIntoCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s');\u0000""";
INSERT INTO %s.%s (name, sql) VALUES ('%s', '%s'); FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public RisingwaveMacroState start()
private final class DeleteCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
DELETE FROM %s.zfunctions WHERE name = '%s';\u0000""";
DELETE FROM %s.zfunctions WHERE name = '%s'; FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public RisingwaveMacroState onError(
private final class DeleteFromCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
DELETE FROM %s.ztables WHERE name = '%s';\u0000""";
DELETE FROM %s.ztables WHERE name = '%s'; FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public RisingwaveMacroState onError(
private final class DeleteFromCatalogState implements RisingwaveMacroState
{
private final String sqlFormat = """
DELETE FROM %s.zviews WHERE name = '%s';\u0000""";
DELETE FROM %s.zviews WHERE name = '%s'; FLUSH;\u0000""";

@Override
public void onStarted(
Expand Down