anchor.diff:              {E, R}
       end.
   
  -
  -maybe_set_drift_thresholds(_Sock, _Bucket, undefined, _, _) ->
  -    ok;
  -maybe_set_drift_thresholds(Sock, Bucket, {DAT, DBT}, ActualDAT, ActualDBT) ->
  -    DATBin = list_to_binary(integer_to_list(misc:msecs_to_usecs(DAT))),
  -    DBTBin = list_to_binary(integer_to_list(misc:msecs_to_usecs(DBT))),
  -    DATChanged = (DATBin =/= ActualDAT),
  -    DBTChanged = (DBTBin =/= ActualDBT),
  -
  -    case DATChanged of
  -        true ->
  -            ok = mc_client_binary:set_engine_param(Sock,
  -                                                   <<"hlc_drift_ahead_threshold_us">>,
  -                                                   DATBin,
  -                                                   vbucket),
  -            ?log_info("Drift ahead threshold changed from '~s' to '~s' for bucket ~p",
  -                      [ActualDAT, DATBin, Bucket]);
  -        false ->
  -            ok
  -    end,
  -
  -    case DBTChanged of
  -        true ->
  -            ok = mc_client_binary:set_engine_param(Sock,
  -                                                   <<"hlc_drift_behind_threshold_us">>,
  -                                                   DBTBin,
  -                                                   vbucket),
  -            ?log_info("Drift behind threshold changed from '~s' to '~s' for bucket ~p",
  -                      [ActualDBT, DBTBin, Bucket]);
  -        false ->
  -            ok
  -    end.
  -
   -record(qstats, {max_size = missng_max_size,
                    dbname = missing_path,
                    max_num_workers = missing_num_threads,
  
positive.code: ensure_bucket_config(Sock, Bucket, membase,
                       {MaxSize, DBDir, NumThreads, ItemEvictionPolicy, EphemeralFullPolicy,
                        DriftThresholds, EphemeralPurgeAge}) ->
      MaxSizeBin = list_to_binary(integer_to_list(MaxSize)),
      DBDirBin = list_to_binary(DBDir),
      NumThreadsBin = list_to_binary(integer_to_list(NumThreads)),
      ItemEvictionPolicyBin = atom_to_binary(ItemEvictionPolicy, latin1),
      EphemeralFullPolicyBin = atom_to_binary(EphemeralFullPolicy, latin1),
      {ok, #qstats{max_size = ActualMaxSizeBin,
                   dbname = ActualDBDirBin,
                   max_num_workers = ActualNumThreads,
                   item_eviction_policy = ActualItemEvictionPolicy,
                   ephemeral_full_policy = ActualEphemeralFullPolicy,
  
negative.code:                   QStats
            end, #qstats{}),
  
      ReloadBuckets = ns_config:read_key_fast(dont_reload_bucket_on_cfg_change, false) =:= false,
  
      Out = [maybe_set_num_threads(Bucket, ReloadBuckets, NumThreads, ActualNumThreads),
             maybe_set_item_eviction_policy(Bucket, ReloadBuckets, ItemEvictionPolicy,
                                            ActualItemEvictionPolicy),
             maybe_set_ephemeral_full_policy(Sock, Bucket, EphemeralFullPolicy,
                                             ActualEphemeralFullPolicy),
             maybe_set_ephemeral_metadata_purge_age(Sock, Bucket, EphemeralPurgeAge, ActualPurgeAge),
             maybe_set_drift_thresholds(Sock, Bucket, DriftThresholds, ActualDAT, ActualDBT),
             maybe_set_max_size(Sock, Bucket, MaxSize, ActualMaxSize),
             maybe_set_db_dir(Bucket, DBDir, ActualDBDir)],
  
      case lists:any(fun(RV) -> RV =:= {ok, needs_restart} end, Out) of
          true ->
              ale:info(?USER_LOGGER, "Restarting bucket ~p due to configuration change", [Bucket]),
              exit({shutdown, reconfig});
          false ->
              ok
      end;
  ensure_bucket_config(Sock, _Bucket, memcached, _MaxSize) ->
      %% TODO: change max size of memcached bucket also
  