Skip to content

Commit

Permalink
Reapply "Re-enable persistent cache"
Browse files Browse the repository at this point in the history
This reverts commit f04237c.
  • Loading branch information
fantix committed Mar 8, 2024
1 parent 01b6192 commit f134020
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion edb/common/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class flags(metaclass=FlagsMeta):

zombodb = Flag(doc="Enabled zombodb and disables postgres FTS")

persistent_cache = Flag(doc="Use persistent cache")
disable_persistent_cache = Flag(doc="Don't use persistent cache")

# Function cache is an experimental feature that may not fully work
func_cache = Flag(doc="Use stored functions for persistent cache")
Expand Down
4 changes: 2 additions & 2 deletions edb/server/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def compile_request(
request.protocol_version,
request.inline_objectids,
request.json_parameters,
persistent_cache=bool(debug.flags.persistent_cache),
persistent_cache=not debug.flags.disable_persistent_cache,
cache_key=request.get_cache_key(),
)
return units, cstate
Expand Down Expand Up @@ -976,7 +976,7 @@ def compile_in_tx_request(
request.inline_objectids,
request.json_parameters,
expect_rollback=expect_rollback,
persistent_cache=bool(debug.flags.persistent_cache),
persistent_cache=not debug.flags.disable_persistent_cache,
cache_key=request.get_cache_key(),
)
return units, cstate
Expand Down
7 changes: 4 additions & 3 deletions edb/server/dbview/dbview.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ cdef class Database:
query_req, unit_group = self._eql_to_compiled.cleanup_one()
if len(unit_group) == 1:
keys.append(query_req.get_cache_key())
if keys and debug.flags.persistent_cache:
if keys and not debug.flags.disable_persistent_cache:
self.tenant.create_task(
self.tenant.evict_query_cache(self.name, keys),
interruptable=True,
Expand Down Expand Up @@ -275,7 +275,8 @@ cdef class Database:
async with self._introspection_lock:
if self.user_schema_pickle is None:
await self.tenant.introspect_db(
self.name, hydrate_cache=debug.flags.persistent_cache
self.name,
hydrate_cache=not debug.flags.disable_persistent_cache,
)


Expand Down Expand Up @@ -713,7 +714,7 @@ cdef class DatabaseConnectionView:

if not self._in_tx:
self._db._cache_compiled_query(key, query_unit_group)
elif not self._in_tx_with_ddl and not debug.flags.persistent_cache:
elif not self._in_tx_with_ddl and debug.flags.disable_persistent_cache:
self._db._cache_compiled_query(key, query_unit_group)
# Query compiled in transaction is not yet cached when persistent_cache
# is turned on, because eviction of such query would fail if the tx
Expand Down
2 changes: 1 addition & 1 deletion edb/server/protocol/execute.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async def execute(
# This flag indicates both features are in use, and we actually have
# recompiled the query cache to persist.
persist_recompiled_query_cache = bool(
debug.flags.persistent_cache and compiled.recompiled_cache)
not debug.flags.disable_persistent_cache and compiled.recompiled_cache)

data = None

Expand Down

0 comments on commit f134020

Please sign in to comment.