anchor.diff:  
   %% @doc Generate an key for backend db
   -define(gen_backend_key(_VSN, _AddrId, _Key),
  -begin
  -case _VSN of
  -?AVS_HEADER_VSN_2_2 ->
  -term_to_binary({_AddrId, _Key});
  -?AVS_HEADER_VSN_2_4 ->
  -_Key
  -end
  -end).
  +        begin
  +            case _VSN of
  +                ?AVS_HEADER_VSN_2_2 ->
  +                    term_to_binary({_AddrId, _Key});
  +                ?AVS_HEADER_VSN_2_4 ->
  +                    _Key
  +            end
  +        end).
   
   -define(AVS_HEADER_VSN,     <<?AVS_HEADER_VSN_TOBE/binary,13,10>>).
   -define(AVS_PART_OF_HEADER, <<"CHKSUM:128,KSIZE:16,BLEN_MSIZE:32,DSIZE:32,OFFSET:64,ADDRID:128,CLOCK:64,TIMESTAMP:42,DEL:1,BUF:437,CHUNK_SIZE:32,CHUNK_NUM:24,CHUNK_INDEX:24",13,10>>).
   -define(AVS_PART_OF_BODY,   <<"KEY/binary,DATA/binary",13,10>>).
   -define(AVS_PART_OF_FOOTER, <<"PADDING:64",13,10>>).
   -define(AVS_SUPER_BLOCK,    <<?AVS_HEADER_VSN/binary,
  -?AVS_PART_OF_HEADER/binary,
  -?AVS_PART_OF_BODY/binary,
  -?AVS_PART_OF_FOOTER/binary>>).
  +                              ?AVS_PART_OF_HEADER/binary,
  +                              ?AVS_PART_OF_BODY/binary,
  +                              ?AVS_PART_OF_FOOTER/binary>>).
   -define(AVS_SUPER_BLOCK_LEN, byte_size(?AVS_SUPER_BLOCK)).
   
   %% ------------------------ %%
  
positive.code: -define(EVENT_INCREASE, 'increase').
  -define(EVENT_DECREASE, 'decrease').
  -type(compaction_event() ::?EVENT_RUN |
  ?EVENT_DIAGNOSE |
  ?EVENT_LOCK |
  ?EVENT_SUSPEND |
  ?EVENT_RESUME |
  ?EVENT_FINISH |
  ?EVENT_STATE |
  ?EVENT_INCREASE |
  ?EVENT_DECREASE
  ).
  
  %% @doc Compaction related definitions
  -define(RET_SUCCESS, 'success').
  -define(RET_FAIL,    'fail').
  -type(compaction_ret() :: ?RET_SUCCESS |
  ?RET_FAIL |
  undefined).
  
  -define(MAX_LEN_HIST, 50).
  -define(MAX_RETRY_TIMES, 2).
  -define(WAIT_TIME_AFTER_ERROR, 200). %% 200ms
  
  -record(compaction_report, {
  file_path = [] :: string(),
  avs_ver = <<>> :: binary(),
  num_of_active_objs = 0 :: non_neg_integer(),
  size_of_active_objs = 0 :: non_neg_integer(),
  total_num_of_objs = 0 :: non_neg_integer(),
  total_size_of_objs = 0 :: non_neg_integer(),
  start_datetime = [] :: string(),
  end_datetime = [] :: string(),
  errors = [] :: [{non_neg_integer(),non_neg_integer()}],
  duration = 0 :: non_neg_integer(),
  result :: atom()
  }).
  
  -record(compaction_hist, {
  start_datetime = 0 :: non_neg_integer(),
  end_datetime   = 0 :: non_neg_integer(),
  duration = 0 :: non_neg_integer(),
  result :: compaction_ret()
  }).
  
  -record(compaction_stats, {
  status = ?ST_IDLING :: compaction_state(),
  total_num_of_targets = 0 :: non_neg_integer(),
  num_of_reserved_targets = 0 :: non_neg_integer(),
  num_of_pending_targets = 0 :: non_neg_integer(),
  num_of_ongoing_targets = 0 :: non_neg_integer(),
  reserved_targets = [] :: [atom()],
  pending_targets = [] :: [atom()],
  ongoing_targets = [] :: [atom()],
  locked_targets = [] :: [atom()],
  latest_exec_datetime = 0 :: non_neg_integer(),
  acc_reports = [] :: [#compaction_report{}]
  }).
  
  
  %% Error Constants
  
negative.code: -define(SYNC_MODE_PERIODIC, 'periodic').
  -define(SYNC_MODE_WRITETHROUGH, 'writethrough').
  -type(sync_mode() :: ?SYNC_MODE_NONE |
                       ?SYNC_MODE_PERIODIC |
                       ?SYNC_MODE_WRITETHROUGH).
  -define(OBJ_PRV_READ_WRITE, 'read_and_write').
  -define(OBJ_PRV_READ_ONLY, 'read').
  -define(OBJ_PRV_WRITE_ONLY, 'write').
  -type(obj_privilege() :: ?OBJ_PRV_READ_WRITE |
                           ?OBJ_PRV_READ_ONLY |
                           ?OBJ_PRV_WRITE_ONLY).
  -record(obj_server_state, {
                             id :: atom(),
                             seq_num = 0 :: non_neg_integer(),
                             privilege = ?OBJ_PRV_READ_WRITE :: obj_privilege(),
                             meta_db_id :: atom(),
                             compaction_worker_id :: atom(),
                             diagnosis_logger_id :: atom(),
                             root_path = [] :: string(),
                             object_storage = #backend_info{}  :: #backend_info{},
                             storage_stats  = #storage_stats{} :: #storage_stats{},
                             state_filepath :: string(),
                             sync_mode = ?SYNC_MODE_NONE :: sync_mode(),
                             sync_interval_in_ms = ?DEF_SYNC_INTERVAL :: pos_integer(),
                             is_strict_check = false :: boolean(),
                             is_locked = false :: boolean(),
                             is_del_blocked = false  :: boolean(),
                             threshold_slow_processing = ?DEF_THRESHOLD_SLOW_PROC :: non_neg_integer(),
                             is_able_to_write = true :: boolean()
                            }).
  
  %% apllication-env
  -define(env_metadata_db(),
          case application:get_env(?APP_NAME, metadata_storage) of
              {ok, EnvMetadataDB} ->
                  EnvMetadataDB;
              _ ->
                  ?DEF_METADATA_DB
          end).
  
  -define(env_sync_mode(),
          case application:get_env(?APP_NAME, sync_mode) of
              {ok, SyncMode} ->
                  SyncMode;
              _ ->
                  ?SYNC_MODE_NONE
          end).
  
  -define(env_sync_interval(),
          case application:get_env(?APP_NAME, sync_interval_in_ms) of
              {ok, SyncInterval} ->
                  SyncInterval;
              _ ->
                  ?DEF_SYNC_INTERVAL
          end).
  
  -ifdef(TEST).
  -define(env_strict_check(), true).
  -else.
  -define(env_strict_check(),
          case application:get_env(?APP_NAME, is_strict_check) of
              {ok, EnvStrictCheck} ->
                  EnvStrictCheck;
              _ ->
                  false
          end).
  -endif.
  
  -define(env_enable_diagnosis_log(),
          case application:get_env(?APP_NAME,
                                   is_enable_diagnosis_log) of
              {ok, true} ->
                  true;
              _ ->
                  false
          end).
  
  -define(env_num_of_obj_storage_read_procs(),
          case application:get_env(?APP_NAME,
                                   num_of_obj_storage_read_procs) of
              {ok, EnvNumOfObjStorageReadProcs} ->
                  EnvNumOfObjStorageReadProcs;
              _ ->
                  ?DEF_NUM_OF_OBJ_STORAGE_READ_PROCS
          end).
  
  -define(get_obj_storage_read_proc(_PidL,_AddrId),
          begin
              lists:nth((_AddrId rem erlang:length(_PidL)) + 1,_PidL)
          end).
  
  
  -define(env_limit_num_of_compaction_procs(),
          case application:get_env(?APP_NAME,
                                   limit_num_of_compaction_procs) of
              {ok, EnvLimitCompactionProcs} when is_integer(EnvLimitCompactionProcs) ->
                  EnvLimitCompactionProcs;
              _ ->
                  ?DEF_LIMIT_COMPACTION_PROCS
          end).
  
  -define(env_threshold_slow_processing(),
          case application:get_env(?APP_NAME,
                                   threshold_slow_processing) of
              {ok, EnvThresholdSlowProc} when is_integer(EnvThresholdSlowProc) ->
                  EnvThresholdSlowProc;
              _ ->
                  ?DEF_THRESHOLD_SLOW_PROC
          end).
  
  %% [Interval between batch processes]
  -define(env_compaction_interval_reg(),
          case application:get_env(?APP_NAME,
                                   compaction_waiting_time_regular) of
              {ok, EnvRegCompactionWT} when is_integer(EnvRegCompactionWT) ->
                  EnvRegCompactionWT;
              _ ->
                  ?DEF_REG_COMPACTION_WT
          end).
  
  -define(env_compaction_interval_max(),
          case application:get_env(?APP_NAME,
                                   compaction_waiting_time_max) of
              {ok, EnvMaxCompactionWT} when is_integer(EnvMaxCompactionWT) ->
                  EnvMaxCompactionWT;
              _ ->
                  ?DEF_MAX_COMPACTION_WT
          end).
  
  %% [Number of batch processes]
  -define(env_compaction_num_of_batch_procs_max(),
          case application:get_env(?APP_NAME,
                                   batch_procs_max) of
              {ok, EnvMaxCompactionBP} when is_integer(EnvMaxCompactionBP) ->
                  EnvMaxCompactionBP;
              _ ->
                  ?DEF_MAX_COMPACTION_BP
          end).
  
  -define(env_compaction_num_of_batch_procs_reg(),
          case application:get_env(?APP_NAME,
                                   batch_procs_regular) of
              {ok, EnvRegCompactionBP} when is_integer(EnvRegCompactionBP) ->
                  EnvRegCompactionBP;
              _ ->
                  ?DEF_REG_COMPACTION_BP
          end).
  
  -define(env_compaction_skip_prefetch_size(),
          case application:get_env(?APP_NAME,
                                   skip_prefetch_size) of
              {ok, EnvPrefetchSize} when is_integer(EnvPrefetchSize) ->
                  EnvPrefetchSize;
              _ ->
                  ?DEF_COMPACTION_SKIP_PS
          end).
  
  -define(num_of_compaction_concurrency(_PrmNumOfConcurrency),
          begin
              _EnvNumOfConcurrency = ?env_limit_num_of_compaction_procs(),
              case (_PrmNumOfConcurrency > _EnvNumOfConcurrency) of
                  true  -> _EnvNumOfConcurrency;
                  false -> _PrmNumOfConcurrency
              end
          end).
  
  -define(env_compaction_force_quit_in_bytes(),
          case application:get_env(?APP_NAME, force_quit_in_bytes) of
              {ok, ForceQuitInBytes} ->
                  ForceQuitInBytes;
              _ ->
                  ?DEF_COMPACTION_FQ_IN_BYTES
          end).
  
  -define(get_object_storage_id(_TargetContainers),
          begin
              lists:flatten(
                lists:map(
                  fun(_Id) ->
                          case leo_object_storage_api:get_object_storage_pid_by_container_id(_Id) of
                              not_found -> [];
                              _Pid -> _Pid
                          end
                  end,_TargetContainers))
          end).
  
  -define(env_diskspace_check_intervals(),
          case application:get_env(?APP_NAME, diskspace_check_intervals) of
              {ok, EnvDiskSpaceCheckIntervals} ->
                  EnvDiskSpaceCheckIntervals;
              _ ->
                  timer:minutes(1)
          end).
  
  -define(env_enable_msg_collector(),
          case application:get_env(?APP_NAME, msg_collector) of
              {ok, true} ->
                  true;
              _ ->
                  false
          end).
  
  %% custom-metadata's items for MDC-replication:
  -define(PROP_CMETA_CLUSTER_ID, 'cluster_id').
  