4545-record (vbucket_info , {before_chain :: [node ()],
4646 after_chain :: [node ()],
4747 stats :: [# replica_building_stats {}],
48- move = # stat_info {}}).
48+ move = # stat_info {},
49+ backfill = # stat_info {}}).
4950
5051-record (total_stat_info , {total_time = 0 ,
5152 completed_count = 0 }).
5253
5354-record (vbucket_level_info , {move = # total_stat_info {},
55+ backfill = # total_stat_info {},
5456 vbucket_info = dict :new ()}).
5557
5658-record (compaction_info , {per_node = [] :: [{node (), # total_stat_info {}}],
@@ -114,6 +116,10 @@ is_interesting_master_event({_, compaction_uninhibit_started, _BucketName, _}) -
114116 fun handle_compaction_uninhibit /2 ;
115117is_interesting_master_event ({_ , compaction_uninhibit_done , _BucketName , _ }) ->
116118 fun handle_compaction_uninhibit /2 ;
119+ is_interesting_master_event ({_ , backfill_phase_started , _BucketName , _VBucketId }) ->
120+ fun handle_generic_vb_stat_event /2 ;
121+ is_interesting_master_event ({_ , backfill_phase_ended , _BucketName , _VBucketId }) ->
122+ fun handle_generic_vb_stat_event /2 ;
117123is_interesting_master_event (_ ) ->
118124 undefined .
119125
@@ -374,6 +380,9 @@ handle_vbucket_move_done({TS, vbucket_move_done, BucketName, VBucket},
374380handle_compaction_uninhibit ({TS , Event , BucketName , Node }, State ) ->
375381 {noreply , update_info (Event , State , {TS , BucketName , Node })}.
376382
383+ handle_generic_vb_stat_event ({TS , Event , BucketName , VBucket }, State ) ->
384+ {noreply , update_info (Event , State , {TS , BucketName , VBucket })}.
385+
377386update_move (State , BucketName , VBucket , Fun ) ->
378387 update_all_vb_info (State , BucketName ,
379388 dict :update (VBucket , Fun ,
@@ -679,7 +688,12 @@ find_event_action(Event) ->
679688 {vbucket_move_start , undefined ,
680689 # vbucket_info .move , start_time },
681690 {vbucket_move_done , # vbucket_level_info .move ,
682- # vbucket_info .move , end_time }
691+ # vbucket_info .move , end_time },
692+
693+ {backfill_phase_started , undefined ,
694+ # vbucket_info .backfill , start_time },
695+ {backfill_phase_ended , # vbucket_level_info .backfill ,
696+ # vbucket_info .backfill , end_time }
683697 ],
684698 lists :keyfind (Event , 1 , EventAction ).
685699
@@ -776,12 +790,14 @@ construct_replica_building_stats_json(#replica_building_stats{node = Node,
776790construct_vbucket_info_json (Id , # vbucket_info {before_chain = BC ,
777791 after_chain = AC ,
778792 stats = RBS ,
779- move = Move }) ->
793+ move = Move ,
794+ backfill = Backfill }) ->
780795 {[{id , Id },
781796 {beforeChain , BC },
782797 {afterChain , AC },
783798 {stats , {[construct_replica_building_stats_json (X ) || X <- RBS ]}},
784- {move , construct_stat_info_json (Move )}]}.
799+ {move , construct_stat_info_json (Move )},
800+ {backfill , construct_stat_info_json (Backfill )}]}.
785801
786802construct_vbucket_level_info_json (VBLevelInfo , Options ) ->
787803 case dict :is_empty (VBLevelInfo # vbucket_level_info .vbucket_info ) of
@@ -794,6 +810,7 @@ construct_vbucket_level_info_json(VBLevelInfo, Options) ->
794810
795811construct_vbucket_level_info_json_inner (
796812 # vbucket_level_info {move = Move ,
813+ backfill = Backfill ,
797814 vbucket_info = AllVBInfo }, Options ) ->
798815 VBI = case proplists :get_bool (add_vbucket_info , Options ) of
799816 true ->
@@ -804,7 +821,8 @@ construct_vbucket_level_info_json_inner(
804821 _ ->
805822 []
806823 end ,
807- {[{move , construct_total_stat_info_json (Move )}]
824+ {[{move , construct_total_stat_info_json (Move )},
825+ {backfill , construct_total_stat_info_json (Backfill )}]
808826 ++ VBI }.
809827
810828get_all_stage_rebalance_details (# state {bucket_info = BucketLevelInfo },
0 commit comments