anchor.diff:              {#{}, #{}, KIF}
       end,
   
  -    NewRef = case Ref of
  -        CurrentRef -> undefined;
  +    NewRef = case {Ref, map_size(NotFlushed)} of
  +        {CurrentRef, 0} -> undefined;
           _ -> CurrentRef
       end,
   
  
positive.code:         remote_node = RemoteNode, remote_requests_processing_mode = RemoteRequestsProcessingMode} =
          ha_datastore_slave:qualify_and_reverse_requests(Requests, Mode),
      gen_server:reply(From, {RemoteRequestsProcessingMode, RemoteNode}),
      State2 = handle_requests(LocalRequests, false, State#state{requests_ref = Ref}),
      State3 = case RemoteRequestsProcessingMode of
          ?DELEGATE ->
  
negative.code:     {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}.
  