anchor.diff:                        end, not_present),
       ok.
   
  -maybe_update_ephemeral_full_policy(Sock, Bucket, NewFullPolicy, CurrFullPolicy) ->
  -    case NewFullPolicy =/= CurrFullPolicy of
  +maybe_set_num_threads(Bucket, ReloadBuckets, NewNumThreads, ActualNumThreadsBin) ->
  +    NewNumThreadsBin = list_to_binary(integer_to_list(NewNumThreads)),
  +    case ReloadBuckets andalso NewNumThreadsBin =/= ActualNumThreadsBin of
           true ->
  -            ok = mc_client_binary:set_flush_param(Sock,
  +            ale:info(?USER_LOGGER,
  +                     "Bucket priority changed from ~s to ~s for bucket ~p",
  +                     [ActualNumThreadsBin, NewNumThreadsBin, Bucket]),
  +            {ok, needs_restart};
  +        false ->
  +            ok
  +    end.
  +
  +maybe_set_item_eviction_policy(_, _, undefined, _) ->
  +    ok;
  +maybe_set_item_eviction_policy(Bucket, ReloadBuckets, NewPolicy, ActualPolicyBin) ->
  +    NewPolicyBin = atom_to_binary(NewPolicy, latin1),
  +    case ReloadBuckets andalso NewPolicyBin =/= ActualPolicyBin of
  +        true ->
  +            ale:info(?USER_LOGGER,
  +                     "Eviction policy changed from '~s' to '~s' for bucket ~p",
  +                     [ActualPolicyBin, NewPolicyBin, Bucket]),
  +            {ok, needs_restart};
  +        false ->
  +            ok
  +    end.
  +
  +maybe_set_ephemeral_full_policy(_, _, undefined, _) ->
  +    ok;
  +maybe_set_ephemeral_full_policy(Sock, Bucket, NewPolicy, ActualPolicyBin) ->
  +    NewPolicyBin = atom_to_binary(NewPolicy, latin1),
  +    case NewPolicyBin =/= ActualPolicyBin of
  +        true ->
  +            ok = mc_client_binary:set_engine_param(Sock,
                                                      <<"ephemeral_full_policy">>,
  -                                                   NewFullPolicy),
  +                                                   NewPolicyBin,
  +                                                   flush),
               ?log_info("Ephemeral full policy changed from '~s' to '~s' for bucket ~p",
  -                      [CurrFullPolicy, NewFullPolicy, Bucket]),
  +                      [ActualPolicyBin, NewPolicyBin, Bucket]),
               ok;
           false ->
               ok
       end.
   
  +maybe_set_ephemeral_metadata_purge_age(_, _, undefined, _) ->
  +    ok;
   maybe_set_ephemeral_metadata_purge_age(Sock, Bucket, NewPurgeAge, CurrPurgeAge) ->
  -    case NewPurgeAge =/= CurrPurgeAge of
  +    NewPurgeAgeBin = list_to_binary(integer_to_list(NewPurgeAge)),
  +    case NewPurgeAgeBin =/= CurrPurgeAge of
           true ->
               ok = mc_client_binary:set_flush_param(Sock,
  -                                                   <<"ephemeral_metadata_purge_age">>,
  -                                                   NewPurgeAge),
  +                                                  <<"ephemeral_metadata_purge_age">>,
  +                                                  NewPurgeAgeBin),
               ?log_info("Ephemeral metadata purge age changed from '~s' to '~s' for bucket ~p",
  -                      [CurrPurgeAge, NewPurgeAge, Bucket]),
  +                      [CurrPurgeAge, NewPurgeAgeBin, Bucket]),
               ok;
           false ->
               ok
  +    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.
  +
  +maybe_set_max_size(Sock, Bucket, NewMaxSize, ActualMaxSizeBin) ->
  +    NewMaxSizeBin = list_to_binary(integer_to_list(NewMaxSize)),
  +    case ActualMaxSizeBin of
  +        NewMaxSizeBin ->
  +            ok;
  +        X1 when is_binary(X1) ->
  +            ?log_info("Changing max_size of ~p from ~s to ~s", [Bucket, X1,
  +                                                                NewMaxSizeBin]),
  +            ok = mc_client_binary:set_flush_param(Sock, <<"max_size">>, NewMaxSizeBin)
  +    end.
  +
  +maybe_set_db_dir(Bucket, NewDBDir, ActualDBDirBin) ->
  +    NewDBDirBin = list_to_binary(NewDBDir),
  +    case ActualDBDirBin of
  +        NewDBDirBin ->
  +            ok;
  +        X2 when is_binary(X2) ->
  +            ?log_info("Changing dbname of ~p from ~s to ~s", [Bucket, X2,
  +                                                              NewDBDirBin]),
  +            %% Just exit; this will delete and recreate the bucket
  +            {ok, needs_restart}
       end.
   
   server(Bucket) ->
  
positive.code:             {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,
  
negative.code: ensure_bucket_config(Sock, Bucket, membase,
                       {MaxSize, DBDir, NumThreads, ItemEvictionPolicy, EphemeralFullPolicy,
                        DriftThresholds, EphemeralPurgeAge}) ->
      {ok, #qstats{max_size = ActualMaxSize,
                   dbname = ActualDBDir,
                   max_num_workers = ActualNumThreads,
                   item_eviction_policy = ActualItemEvictionPolicy,
                   ephemeral_full_policy = ActualEphemeralFullPolicy,
  