whatyouhide / xandra

Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.
ISC License
406 stars 54 forks source link

%StatusChange{} causes MatchError in protocol v4 #300

Closed harunzengin closed 1 year ago

harunzengin commented 1 year ago

The status change events crash with a MatchError in v4. Works as expected in v5:

** (EXIT from #PID<0.283.0>) shell process exited with reason: an exception was raised:
    ** (MatchError) no match of right hand side value: %Xandra.Cluster.StatusChange{effect: "UP", address: {172, 0, 0, 1}, port: 9042}
        (xandra 0.15.0-rc.1) lib/xandra/cluster/control_connection.ex:664: Xandra.Cluster.ControlConnection.consume_new_data/3
        (xandra 0.15.0-rc.1) lib/xandra/cluster/control_connection.ex:292: Xandra.Cluster.ControlConnection.handle_event/4
        (stdlib 4.3) gen_statem.erl:1428: :gen_statem.loop_state_callback/11
        (stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
whatyouhide commented 1 year ago

That is interesting, because the code for decode_response/3 is the same in the v4 and v5 protocol code.

CleanShot 2023-04-15 at 08 35 14@2x

Neither of them returns the {change_event, warnings} tuple that the control connection seems to expect 🤔