Class DistributedClusterStateUpdater.StateChangeRecorder

  • Enclosing class:

    public static class DistributedClusterStateUpdater.StateChangeRecorder
    extends Object
    Class handling the distributed updates of collection's Zookeeper files state.json based on multiple updates applied to a single collection (as is sometimes done by *Cmd classes implementing the Collection API commands).

    Previously these updates were sent one by one to Overseer and then grouped by

    Records desired changes to state.json files in Zookeeper (as are done by the family of mutator classes such as ClusterStateMutator, CollectionMutator etc.) in order to be able to later execute them on the actual content of the state.json files using optimistic locking (and retry a few times if the optimistic locking failed).

    Instances are not thread safe.

    • Method Detail

      • record

        public void record​(DistributedClusterStateUpdater.MutatingCommand command,
                           ZkNodeProps message)
        Records a mutation method and its parameters so that it can be executed later to modify the corresponding Zookeeper state. Note the message is identical to the one used for communicating with Overseer (at least initially) so it also contains the action in parameter Overseer.QUEUE_OPERATION, but that value is ignored here in favor of the value passed in command.
        message - the parameters associated with the command that are kept in the recorded mutations to be played later. Note that this call usually replaces a call to Overseer.offerStateUpdate(byte[]) that is passed a copy of the data!
        This means that if message passed in here is reused before the recorded commands are replayed, things will break! Need to make sure all places calling this method do not reuse the data passed in (otherwise need to make a copy).