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

Drop legacy anonymous statement #6576

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions edb/server/protocol/binary.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ cdef class EdgeConnection(frontend.FrontendConnection):

object _startup_msg_waiter

dbview.CompiledQuery _last_anon_compiled
int _last_anon_compiled_hash

bint query_cache_enabled

tuple protocol_version
Expand Down
60 changes: 17 additions & 43 deletions edb/server/protocol/binary.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ cdef class EdgeConnection(frontend.FrontendConnection):

self._dbview = None

self._last_anon_compiled = None

self.query_cache_enabled = not (debug.flags.disable_qcache or
debug.flags.edgeql_compile)

Expand Down Expand Up @@ -793,8 +791,6 @@ cdef class EdgeConnection(frontend.FrontendConnection):
WriteBuffer parse_complete
WriteBuffer buf

self._last_anon_compiled = None

self.ignore_headers()

_dbview = self.get_dbview()
Expand All @@ -805,14 +801,6 @@ cdef class EdgeConnection(frontend.FrontendConnection):

buf = self.make_command_data_description_msg(compiled)

# Cache compilation result in anticipation that the client
# will follow up with an Execute immediately.
#
# N.B.: we cannot rely on query cache because not all units
# are cacheable.
self._last_anon_compiled = compiled
self._last_anon_compiled_hash = hash(query_req)

self.write(buf)
self.flush()

Expand All @@ -836,39 +824,25 @@ cdef class EdgeConnection(frontend.FrontendConnection):

self.buffer.finish_message()

if (
self._last_anon_compiled is not None and
hash(query_req) == self._last_anon_compiled_hash and
in_tid == self._last_anon_compiled.query_unit_group.in_type_id and
out_tid == self._last_anon_compiled.query_unit_group.out_type_id
):
compiled = self._last_anon_compiled
query_unit_group = _dbview.lookup_compiled_query(query_req)
if query_unit_group is None:
if self.debug:
self.debug_print('EXECUTE /CACHE MISS', query_req.source.text())

compiled = await self._parse(query_req)
query_unit_group = compiled.query_unit_group
if self._cancelled:
raise ConnectionAbortedError
else:
query_unit_group = _dbview.lookup_compiled_query(query_req)
if query_unit_group is None:
if self.debug:
self.debug_print('EXECUTE /CACHE MISS', query_req.source.text())

compiled = await self._parse(query_req)
query_unit_group = compiled.query_unit_group
if self._cancelled:
raise ConnectionAbortedError
else:
metrics.edgeql_query_compilations.inc(
1.0, self.get_tenant_label(), 'cache'
)
compiled = dbview.CompiledQuery(
query_unit_group=query_unit_group,
first_extra=query_req.source.first_extra(),
extra_counts=query_req.source.extra_counts(),
extra_blobs=query_req.source.extra_blobs(),
)

# Clear the _last_anon_compiled so that the next Execute - if
# identical - will always lookup in the cache and honor the
# `cacheable` flag to compile the query again.
self._last_anon_compiled = None
metrics.edgeql_query_compilations.inc(
1.0, self.get_tenant_label(), 'cache'
)
compiled = dbview.CompiledQuery(
query_unit_group=query_unit_group,
first_extra=query_req.source.first_extra(),
extra_counts=query_req.source.extra_counts(),
extra_blobs=query_req.source.extra_blobs(),
)

_dbview.check_capabilities(
query_unit_group.capabilities,
Expand Down