@@ -2948,28 +2948,33 @@ do_checkpoints(Ts, #checkpoint{index = ChIdx,
2948
2948
MsgsTot = messages_total (MacState ),
2949
2949
% % more than 64MB (by default) of message data has been written to the log
2950
2950
% % best take a checkpoint
2951
- EnoughDataWritten = BytesIn - LastBytesIn > ? CHECK_MAX_BYTES ,
2952
2951
2953
2952
{CheckMinInterval , CheckMinIndexes , CheckMaxIndexes } =
2954
2953
persistent_term :get (quorum_queue_checkpoint_config ,
2955
2954
{? CHECK_MIN_INTERVAL_MS , ? CHECK_MIN_INDEXES ,
2956
2955
? CHECK_MAX_INDEXES }),
2956
+
2957
+ % % scale the bytes limit as the backlog increases
2958
+ MaxBytesFactor = max (1 , MsgsTot / CheckMaxIndexes ),
2959
+ EnoughDataWritten = BytesIn - LastBytesIn > (? CHECK_MAX_BYTES * MaxBytesFactor ),
2957
2960
EnoughTimeHasPassed = TimeSince > CheckMinInterval ,
2958
2961
2959
- case EnoughTimeHasPassed andalso
2960
- (
2961
- % % condition 1: enough indexes have been committed since the last
2962
- % % checkpoint
2963
- (IndexesSince > MinIndexes ) orelse
2964
- % % condition 2: the queue is empty and _some_ commands
2965
- % % have been applied since the last checkpoint
2966
- (MsgsTot == 0 andalso IndexesSince > 32 ) orelse
2967
- % % condition 3: enough message data has been written to warrant a new
2968
- % % checkpoint
2969
- EnoughDataWritten orelse
2970
- % % force was requested, e.g. after a purge
2971
- Force
2972
- ) of
2962
+ case (EnoughTimeHasPassed andalso
2963
+ (
2964
+ % % condition 1: enough indexes have been committed since the last
2965
+ % % checkpoint
2966
+ (IndexesSince > MinIndexes ) orelse
2967
+ % % condition 2: the queue is empty and _some_ commands
2968
+ % % have been applied since the last checkpoint
2969
+ (MsgsTot == 0 andalso IndexesSince > 32 )
2970
+ )
2971
+ ) orelse
2972
+ % % condition 3: enough message data has been written to warrant a new
2973
+ % % checkpoint, this ignores the time windowing
2974
+ EnoughDataWritten orelse
2975
+ % % force was requested, e.g. after a purge
2976
+ Force
2977
+ of
2973
2978
true ->
2974
2979
% % take fewer checkpoints the more messages there are on queue
2975
2980
NextIndexes = min (max (MsgsTot , CheckMinIndexes ), CheckMaxIndexes ),
0 commit comments