Skip to content

Commit

Permalink
bug fix: auto_rebuild_query_cache gate was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Feb 13, 2025
1 parent e3c8e82 commit 6aea3df
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions edb/server/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def lookup(
spec: Spec,
allow_unrecognized: bool = False,
) -> Any:
assert len(configs) > 0

try:
setting = spec[name]
Expand Down
2 changes: 1 addition & 1 deletion edb/server/dbview/dbview.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ cdef class DatabaseConnectionView:
if unit.user_schema:
user_schema = unit.user_schema
user_schema_version = unit.user_schema_version
if user_schema and not self.server.config_lookup(
if user_schema and not self.config_lookup(
"auto_rebuild_query_cache",
):
user_schema = None
Expand Down
21 changes: 21 additions & 0 deletions tests/test_server_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,27 @@ def measure_sql_compilations(
# con_c = con.with_config(apply_access_policies=False)
# await con_c.query_sql(qry_sql)

# At last, make sure recompilation switch works fine
await con.execute(
"configure current database "
"set auto_rebuild_query_cache := false"
)
await con.query('''
create type X
''')
with self.assertChange(measure_compilations(sd), 1):
await con.query(qry)
with self.assertChange(measure_compilations(sd), 0):
await con.query(qry)
with self.assertChange(measure_sql_compilations(sd), 1):
await con.query_sql(sql)
with self.assertChange(measure_sql_compilations(sd), 0):
await con.query_sql(sql)
await con.execute(
"configure current database "
"reset auto_rebuild_query_cache"
)

finally:
await con.aclose()

Expand Down

0 comments on commit 6aea3df

Please sign in to comment.