anchor.diff:      {noreply, State3};
   handle_info(inactivate, #state{} = State) ->
       {noreply, check_inactivate(State#state{inactivate_timer = undefined})};
  +handle_info({check_terminate, ReplyTo} = Msg, #state{
  +    keys_to_inactivate = ToInactivate,
  +    disc_writer_pid = Pid} = State) ->
  +    case allow_terminate(State) of
  +        true ->
  +            catch gen_server:call(Pid, terminate, infinity), % catch exception - disc writer could be already terminated
  +            datastore_cache:inactivate(ToInactivate),
  +            gen_server:reply(ReplyTo, ok),
  +            {stop, normal, State};
  +        false ->
  +            erlang:send_after(?TERMINATE_CHECK_INTERVAL, self(), Msg),
  +            {noreply, State}
  +    end;
   handle_info(Info, #state{} = State) ->
       ?log_bad_request(Info),
       {noreply, State}.
  
positive.code:     application:get_env(?CLUSTER_WORKER_APP_NAME, datastore_writer_flush_delay, timer:seconds(1))).
  -define(FLUSH_INTERVAL, 100). % Time in us between consecutive flushes
  -define(FLUSH_COOLDOWN, application:get_env(?CLUSTER_WORKER_APP_NAME, flush_key_cooldown_sec, 3)).
  
  %%%===================================================================
  %%% API
  
negative.code:     tp_router:update_process_size(Pid, maps:size(NewKeys)),
      State2 = State#state{cached_keys_to_flush = NewKeys},
      {noreply, schedule_flush(State2)};
  % Standard termination request
  handle_call(terminate, _From, #state{
      keys_to_inactivate = ToInactivate,
      disc_writer_pid = Pid} = State) ->
      case allow_terminate(State) of
          true ->
              catch gen_server:call(Pid, terminate, infinity), % catch exception - disc writer could be already terminated
              datastore_cache:inactivate(ToInactivate),
              {stop, normal, ok, State};
          false ->
              {reply, working, State}
      end;
  % Termination request during node shutdown
  handle_call({terminate, Requests}, From, State) ->
      State2 = handle_requests(Requests, false, State), % TODO - VFS-6169 Handle failover and proxy requests
      case handle_call(terminate, From, State2) of
          {reply, working, State} ->
              erlang:send_after(?TERMINATE_CHECK_INTERVAL, self(), {check_terminate, From}),
              {noreply, State2};
          Other ->
              Other
      end;
  handle_call(?SLAVE_MSG(Msg), _From, #state{ha_master_data = Data} = State) ->
      Data2 = ha_datastore_master:handle_slave_lifecycle_message(Msg, Data),
      {reply, ok, State#state{ha_master_data = Data2}};
  