rabbitmq / ra

A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Other
813 stars 96 forks source link

Modify log-level for log segment writer #348

Closed johkin closed 1 year ago

johkin commented 1 year ago

If qourum-queue is deleted before the WAL content is written to the segment-file, a warning is issued: "segment_writer: failed to open segment file /var/lib/rabbitmq/mnesia/rabbit@granskontroll-rabbitmq01.**/quorum/rabbit@granskontroll-rabbitmq01.**/2F_RES7UVV437CY2HA/00000001.segment error: enoent" "segment_writer: skipping segment as directory /var/lib/rabbitmq/mnesia/rabbit@granskontroll-rabbitmq01.**/quorum/rabbit@granskontroll-rabbitmq01.**/2F_RES7UVV437CY2HA does not exist"

A check for queue existence here https://github.com/rabbitmq/ra/blob/main/src/ra_log_segment_writer.erl#L384 would be good.

kjnilsson commented 1 year ago

That is pretty much how it does the check atm, if the directory isn't there it assumes the Ra server is gone and skips it. That said, we could do a check somewhere around https://github.com/rabbitmq/ra/blob/main/src/ra_log_segment_writer.erl#L224 to see if the ServerUId is registered in the ra_directory - I'd still like to log something when we detect orphaned data in the WAL.

For now lowering the log message to debug would be a quick improvement.

johkin commented 1 year ago

Maybe the issue heading could be modified to "Modify log-level for segment-writer" to better describe the change?