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 hash integer length #6895

Merged
merged 3 commits into from
Feb 21, 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/protocol/binary.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cdef class EdgeConnection(frontend.FrontendConnection):
object _startup_msg_waiter

dbview.CompiledQuery _last_anon_compiled
int _last_anon_compiled_hash
int64_t _last_anon_compiled_hash

bint query_cache_enabled

Expand Down
36 changes: 29 additions & 7 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,14 @@ async def test_proto_desc_id_cardinality(self):

self.assertNotEqual(cdd1.output_typedesc_id, cdd2.output_typedesc_id)

async def _parse(self, query):
async def _parse(self, query, output_format=protocol.OutputFormat.BINARY):
await self.con.send(
protocol.Parse(
annotations=[],
allowed_capabilities=protocol.Capability.ALL,
compilation_flags=protocol.CompilationFlag(0),
implicit_limit=0,
output_format=protocol.OutputFormat.BINARY,
output_format=output_format,
expected_cardinality=compiler.Cardinality.MANY,
command_text=query,
state_typedesc_id=b'\0' * 16,
Expand Down Expand Up @@ -511,9 +511,8 @@ async def test_proto_state_concurrent_alter(self):
await con2.aclose()

async def _parse_execute(self, query, args):
await self.con.connect()

await self._parse(query)
output_format = protocol.OutputFormat.BINARY
await self._parse(query, output_format=output_format)
res = await self.con.recv()

await self.con.send(
Expand All @@ -523,7 +522,7 @@ async def _parse_execute(self, query, args):
compilation_flags=protocol.CompilationFlag(0),
implicit_limit=0,
command_text=query,
output_format=protocol.OutputFormat.NONE,
output_format=output_format,
expected_cardinality=protocol.Cardinality.MANY,
input_typedesc_id=res.input_typedesc_id,
output_typedesc_id=res.output_typedesc_id,
Expand All @@ -533,7 +532,6 @@ async def _parse_execute(self, query, args):
),
protocol.Sync(),
)
await self.con.recv()

async def test_proto_execute_bad_array_01(self):
q = "SELECT <array<int32>>$0"
Expand All @@ -558,6 +556,7 @@ async def test_proto_execute_bad_array_01(self):
len(array), # len
) + array

await self.con.connect()
await self._parse_execute(q, args)
await self.con.recv_match(
protocol.ErrorResponse,
Expand Down Expand Up @@ -586,6 +585,7 @@ async def test_proto_execute_bad_array_02(self):
len(array), # len
) + array

await self.con.connect()
await self._parse_execute(q, args)
await self.con.recv_match(
protocol.ErrorResponse,
Expand Down Expand Up @@ -614,6 +614,7 @@ async def test_proto_execute_bad_array_03(self):
len(array), # len
) + array

await self.con.connect()
await self._parse_execute(q, args)
await self.con.recv_match(
protocol.ErrorResponse,
Expand Down Expand Up @@ -657,6 +658,27 @@ async def test_proto_global_bad_array(self):
message='invalid NULL'
)

async def test_proto_parse_execute_transaction_id(self):
await self.con.connect()
await self._parse_execute("start transaction", b"")
await self.con.recv_match(
protocol.CommandComplete,
status='START TRANSACTION'
)
await self.con.recv_match(
protocol.ReadyForCommand,
transaction_state=protocol.TransactionState.IN_TRANSACTION,
)
await self._parse_execute("commit", b"")
await self.con.recv_match(
protocol.CommandComplete,
status='COMMIT'
)
await self.con.recv_match(
protocol.ReadyForCommand,
transaction_state=protocol.TransactionState.NOT_IN_TRANSACTION,
)


class TestServerCancellation(tb.TestCase):
@contextlib.asynccontextmanager
Expand Down
Loading