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

Remove dodgy skip_start hack for notebook protocol #6849

Merged
merged 1 commit into from
Feb 14, 2024
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
2 changes: 1 addition & 1 deletion edb/server/dbview/dbview.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ cdef class DatabaseConnectionView:
cdef tx_error(self)

cdef start(self, query_unit)
cdef _start_tx(self)
cdef start_tx(self)
cdef _apply_in_tx(self, query_unit)
cdef start_implicit(self, query_unit)
cdef on_error(self)
Expand Down
9 changes: 3 additions & 6 deletions edb/server/dbview/dbview.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -750,15 +750,12 @@ cdef class DatabaseConnectionView:

if query_unit.tx_id is not None:
self._txid = query_unit.tx_id
self._start_tx()

if self._in_tx and not self._txid:
raise errors.InternalServerError('unset txid in transaction')
self.start_tx()

if self._in_tx:
self._apply_in_tx(query_unit)

cdef _start_tx(self):
cdef start_tx(self):
state_serializer = self.get_state_serializer()
self._in_tx = True
self._in_tx_config = self._config
Expand Down Expand Up @@ -793,7 +790,7 @@ cdef class DatabaseConnectionView:
self.raise_in_tx_error()

if not self._in_tx:
self._start_tx()
self.start_tx()

self._apply_in_tx(query_unit)

Expand Down
6 changes: 1 addition & 5 deletions edb/server/protocol/execute.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ async def execute(
*,
fe_conn: frontend.AbstractFrontendConnection = None,
use_prep_stmt: bint = False,
# HACK: A hook from the notebook ext, telling us to skip dbview.start
# so that it can handle things differently.
skip_start: bint = False,
):
cdef:
bytes state = None, orig_state = None
Expand All @@ -89,8 +86,7 @@ async def execute(
# the current status in be_conn is in sync with dbview, skip the
# state restoring
state = None
if not skip_start:
dbv.start(query_unit)
dbv.start(query_unit)
if query_unit.create_db_template:
await tenant.on_before_create_db_from_template(
query_unit.create_db_template,
Expand Down
4 changes: 1 addition & 3 deletions edb/server/protocol/notebook_ext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ async def execute(db, tenant, queries: list):
pgcon = await tenant.acquire_pgcon(db.name)
try:
await pgcon.sql_execute(b'START TRANSACTION;')
dbv.start_tx()

for is_error, unit_or_error in units:
if is_error:
Expand All @@ -202,13 +203,10 @@ async def execute(db, tenant, queries: list):

fe_conn = NotebookConnection()

dbv.start_implicit(query_unit)

compiled = dbview.CompiledQuery(
query_unit_group=query_unit_group)
await p_execute.execute(
pgcon, dbv, compiled, b'', fe_conn=fe_conn,
skip_start=True,
)

except Exception as ex:
Expand Down
Loading