Class CollectionsRepairEventListener

java.lang.Object
org.apache.solr.cluster.events.impl.CollectionsRepairEventListener
All Implemented Interfaces:
Closeable, AutoCloseable, ClusterSingleton, ClusterEventListener

public class CollectionsRepairEventListener extends Object implements ClusterEventListener, ClusterSingleton, Closeable
This is an illustration how to re-implement the combination of Solr 8x NodeLostTrigger and AutoAddReplicasPlanAction to maintain the collection's replicas when nodes are lost.

The notion of waitFor delay between detection and repair action is implemented as a scheduled execution of the repair method, which is called every 1 sec to check whether there are any lost nodes that exceeded their waitFor period.

NOTE: this functionality would be probably more reliable when executed also as a periodically scheduled check - both as a reactive (listener) and proactive (scheduled) measure.

  • Field Details

  • Constructor Details

    • CollectionsRepairEventListener

      public CollectionsRepairEventListener(CoreContainer cc)
  • Method Details

    • setWaitForSecond

      public void setWaitForSecond(int waitForSecond)
    • getName

      public String getName()
      Description copied from interface: ClusterSingleton
      Unique name of this singleton. Used for registration.
      Specified by:
      getName in interface ClusterSingleton
    • onEvent

      public void onEvent(ClusterEvent event)
      Description copied from interface: ClusterEventListener
      Handle the event. Implementations should be non-blocking - if any long processing is needed it should be performed asynchronously.
      Specified by:
      onEvent in interface ClusterEventListener
      Parameters:
      event - cluster event
    • start

      public void start() throws Exception
      Description copied from interface: ClusterSingleton
      Start the operation of the component. Initially this method should set the state to STARTING, and on success it should set the state to RUNNING.
      Specified by:
      start in interface ClusterSingleton
      Throws:
      Exception - on startup errors. The component should revert to the STOPPED state.
    • getState

      public ClusterSingleton.State getState()
      Description copied from interface: ClusterSingleton
      Returns the current state of the component.
      Specified by:
      getState in interface ClusterSingleton
    • stop

      public void stop()
      Description copied from interface: ClusterSingleton
      Stop the operation of the component. Initially this method should set the state to STOPPING, and on return it should set the state to STOPPED. Components should also avoid holding any resource when in STOPPED state.
      Specified by:
      stop in interface ClusterSingleton
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException