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

Fix SQL introspection after inplace upgrade #8159

Merged
merged 3 commits into from
Jan 3, 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
14 changes: 10 additions & 4 deletions edb/server/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ async def test() -> None:
started = time.monotonic()
await test()
left -= (time.monotonic() - started)
if res := self._admin_query("SELECT ();", f"{max(1, int(left))}s"):
if res := self._admin_query(
"SELECT ();",
f"{max(1, int(left))}s",
check=False,
):
raise ClusterError(
f'could not connect to edgedb-server '
f'within {timeout} seconds (exit code = {res})') from None
Expand All @@ -333,6 +337,7 @@ def _admin_query(
self,
query: str,
wait_until_available: str = "0s",
check: bool=True,
) -> int:
args = [
"edgedb",
Expand All @@ -350,12 +355,13 @@ def _admin_query(
wait_until_available,
query,
]
res = subprocess.call(
res = subprocess.run(
args=args,
stdout=subprocess.DEVNULL,
check=check,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
return res
return res.returncode

async def set_test_config(self) -> None:
self._admin_query(f'''
Expand Down
10 changes: 10 additions & 0 deletions edb/server/inplace_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

from edb.pgsql import common as pg_common
from edb.pgsql import dbops
from edb.pgsql import metaschema
from edb.pgsql import trampoline


Expand Down Expand Up @@ -273,6 +274,15 @@ async def _upgrade_one(
except Exception:
raise

# Refresh the pg_catalog materialized views
current_block = dbops.PLTopBlock()
refresh = metaschema.generate_sql_information_schema_refresh(
backend_params.instance_params.version
)
refresh.generate(current_block)
patch = current_block.to_string()
await ctx.conn.sql_execute(patch.encode('utf-8'))

new_local_spec = config.load_spec_from_schema(
schema,
only_exts=True,
Expand Down
3 changes: 3 additions & 0 deletions tests/inplace-testing/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ if $EDGEDB query 'create empty branch asdf'; then
fi
$EDGEDB query 'configure instance reset force_database_error'
stop_server
if [ "$SAVE_TARBALLS" = 1 ]; then
tar cf "$DIR"-cooked2.tar "$DIR"
fi


# Test!
Expand Down
Loading