anchor.diff:      ?log_debug("reset auto_failover count: ~p", [State]),
       State2 = State#state{count=0,
                            auto_failover_logic_state = init_logic_state(State#state.timeout)},
  -    make_state_persistent(State2),
  -    {reply, ok, State2};
  +    State3 = init_reported(State2),
  +    make_state_persistent(State3),
  +    {reply, ok, State3};
   
   handle_call(_Request, _From, State) ->
       {reply, ok, State}.
  
positive.code:                           ?user_log(?EVENT_NODE_AUTO_FAILOVERED,
                                      "Node (~p) was automatically failovered.~n~p",
                                      [Node, ns_doctor:get_node(Node)]),
                            S#state{count = S#state.count+1};
                        {autofailover_unsafe, UnsafeBuckets} ->
                            ?user_log(?EVENT_NODE_AUTO_FAILOVERED,
                                      "Could not automatically fail over node (~p)."
                                      " Would lose vbuckets in the following buckets: ~p", [Node, UnsafeBuckets]),
                            S#state{count = S#state.count+1}
                    end
            end, State#state{auto_failover_logic_state = LogicState}, Actions),
      if
          NewState#state.count =/= State#state.count ->
              make_state_persistent(NewState);
          true -> ok
      end,
      {noreply, NewState};
  
  handle_info(_Info, State) ->
      {noreply, State}.
  
negative.code:                                {"bucket2", [{servers, [a, b, c]}]}])),
      ok.
  
  -define(FLAG, #state.reported_autofailover_unsafe).
  reported_test() ->
      %% nothing reported initially
      State = init_reported(#state{}),
  
      %% we correctly instructed to report the condition for the first time
      ?assertEqual(should_report(?FLAG, State), true),
      State1 = note_reported(?FLAG, State),
      State2 = update_reported_flags_by_actions([{failover, some_node}], State1),
  
      %% we don't report it second time
      ?assertEqual(should_report(?FLAG, State2), false),
  
      %% we report the condition again for the other "instance" of failover
      %% (i.e. failover is not needed for some time, but the it's needed again)
      State3 = update_reported_flags_by_actions([], State2),
      ?assertEqual(should_report(?FLAG, State3), true),
  
      %% we report the condition after we explicitly drop it (note that we use
      %% State2)
      State4 = init_reported(State2),
      ?assertEqual(should_report(?FLAG, State4), true),
  
      ok.
  
  -endif.
  