Skip to content

Commit f9f34d8

Browse files
committed
Add counter for checkpoint promotions that are not executed
Due to a current promotion or snapshot being taken.
1 parent 7927dee commit f9f34d8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/ra.hrl

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@
276276
"Number of checkpoint bytes written"},
277277
{checkpoints_promoted, ?C_RA_LOG_CHECKPOINTS_PROMOTED, counter,
278278
"Number of checkpoints promoted to snapshots"},
279+
{checkpoints_promotions_dropped, ?C_RA_LOG_CHECKPOINTS_PROMOTIONS_DROPPED,
280+
counter, "Number of checkpoints promotions that were not exectued"},
279281
{reserved_1, ?C_RA_LOG_RESERVED, counter, "Reserved counter"}
280282
]).
281283
-define(C_RA_LOG_WRITE_OPS, 1).
@@ -293,6 +295,7 @@
293295
-define(C_RA_LOG_CHECKPOINTS_WRITTEN, 13).
294296
-define(C_RA_LOG_CHECKPOINT_BYTES_WRITTEN, 14).
295297
-define(C_RA_LOG_CHECKPOINTS_PROMOTED, 15).
298+
-define(C_RA_LOG_CHECKPOINTS_PROMOTIONS_DROPPED, 15).
296299
-define(C_RA_LOG_RESERVED, 16).
297300

298301
-define(C_RA_SRV_AER_RECEIVED_FOLLOWER, ?C_RA_LOG_RESERVED + 1).

src/ra_log.erl

+1
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ promote_checkpoint(Idx, #?MODULE{cfg = Cfg,
895895
snapshot_state = SnapState0} = State) ->
896896
case ra_snapshot:pending(SnapState0) of
897897
{_WriterPid, _IdxTerm, snapshot} ->
898+
ok = incr_counter(Cfg, ?C_RA_LOG_CHECKPOINTS_PROMOTIONS_DROPPED, 1),
898899
%% If we're currently writing a snapshot, skip promoting a
899900
%% checkpoint.
900901
{State, []};

0 commit comments

Comments
 (0)