Skip to content

Conversation

@alco
Copy link
Member

@alco alco commented Nov 27, 2025

Fix #3506.

alco added 4 commits November 27, 2025 13:02
The reason it is returned as a string, even though the return type of
the PG function pg_backend_pid() is integer, is because
Postgrex.ReplicationConnection uses simply query protocol. Hence the
explicit type conversion in our Elixir code.
The way the unit test was ignoring the exit reason for the
LockBreakerConnection process was masking a bug in the code. Before the
explicit conversion of pg_backend_pid's value to integer, the exit
reason in the test was

    {:function_clause,
     [
       {Electric.Postgres.LockBreakerConnection, :lock_breaker_query,
        ["electric_test_slot_d7f423cc8759", "16492",
         "NXmQhg ~ test doesn't break the lock if it's taken from expe"],
        [file: ~c"lib/electric/postgres/lock_breaker_connection.ex", line: 104]},
       {Electric.Postgres.LockBreakerConnection, :handle_info, 2,
        [file: ~c"lib/electric/postgres/lock_breaker_connection.ex", line: 80]},
       {Postgrex.SimpleConnection, :handle, 5,
        [file: ~c"lib/postgrex/simple_connection.ex", line: 438]},
       {:gen_statem, :loop_state_callback, 11,
        [file: ~c"gen_statem.erl", line: 3750]},
       {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 333]}
     ]}
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.31%. Comparing base (0a82280) to head (2be5734).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3509      +/-   ##
==========================================
+ Coverage   75.20%   75.31%   +0.10%     
==========================================
  Files          51       51              
  Lines        2743     2743              
  Branches      409      405       -4     
==========================================
+ Hits         2063     2066       +3     
+ Misses        678      675       -3     
  Partials        2        2              
Flag Coverage Δ
electric-telemetry 22.71% <ø> (ø)
elixir 57.74% <ø> (+0.35%) ⬆️
elixir-client 74.47% <ø> (+0.52%) ⬆️
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 92.98% <ø> (-0.09%) ⬇️
packages/y-electric 55.12% <ø> (ø)
typescript 87.39% <ø> (-0.07%) ⬇️
unit-tests 75.31% <ø> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LockBreakerConnection crashes when trying to execute the "terminate backend" query

2 participants