Class TopologyAwareEnsemblePlacementPolicy

    • Field Detail

      • LOG

        static final org.slf4j.Logger LOG
      • REPP_DNS_RESOLVER_CLASS

        public static final java.lang.String REPP_DNS_RESOLVER_CLASS
        See Also:
        Constant Field Values
      • knownBookies

        protected final java.util.Map<org.apache.bookkeeper.net.BookieId,​org.apache.bookkeeper.net.BookieNode> knownBookies
      • historyBookies

        protected final java.util.Map<org.apache.bookkeeper.net.BookieId,​org.apache.bookkeeper.net.BookieNode> historyBookies
      • rwLock

        protected final java.util.concurrent.locks.ReentrantReadWriteLock rwLock
      • readOnlyBookies

        protected com.google.common.collect.ImmutableSet<org.apache.bookkeeper.net.BookieId> readOnlyBookies
      • isWeighted

        boolean isWeighted
      • topology

        protected org.apache.bookkeeper.net.NetworkTopology topology
      • dnsResolver

        protected org.apache.bookkeeper.net.DNSToSwitchMapping dnsResolver
      • bookieAddressResolver

        protected org.apache.bookkeeper.proto.BookieAddressResolver bookieAddressResolver
      • bookiesJoinedCounter

        @StatsDoc(name="BOOKIES_JOINED",
                  help="The distribution of number of bookies joined the cluster on each network topology change")
        protected OpStatsLogger bookiesJoinedCounter
      • bookiesLeftCounter

        @StatsDoc(name="BOOKIES_LEFT",
                  help="The distribution of number of bookies left the cluster on each network topology change")
        protected OpStatsLogger bookiesLeftCounter
    • Constructor Detail

      • TopologyAwareEnsemblePlacementPolicy

        TopologyAwareEnsemblePlacementPolicy()
    • Method Detail

      • getNetworkLocations

        static java.util.Set<java.lang.String> getNetworkLocations​(java.util.Set<org.apache.bookkeeper.net.Node> bookieNodes)
      • shuffleWithMask

        static void shuffleWithMask​(DistributionSchedule.WriteSet writeSet,
                                    int mask,
                                    int bits)
        Shuffle all the entries of an array that matches a mask. It assumes all entries with the same mask are contiguous in the array.
      • reorderReadLACSequence

        public DistributionSchedule.WriteSet reorderReadLACSequence​(java.util.List<org.apache.bookkeeper.net.BookieId> ensemble,
                                                                    BookiesHealthInfo bookiesHealthInfo,
                                                                    DistributionSchedule.WriteSet writeSet)
        Description copied from interface: EnsemblePlacementPolicy
        Reorder the read last add confirmed sequence of a given write quorum writeSet.
        Specified by:
        reorderReadLACSequence in interface EnsemblePlacementPolicy
        Parameters:
        ensemble - Ensemble to read entries.
        bookiesHealthInfo - Health info for bookies
        writeSet - Write quorum to read entries. This will be modified, rather than allocating a new WriteSet.
        Returns:
        The read sequence. This will be the same object as the passed in writeSet.
      • differBetweenBookies

        public static int differBetweenBookies​(java.util.List<org.apache.bookkeeper.net.BookieId> bookiesA,
                                               java.util.List<org.apache.bookkeeper.net.BookieId> bookiesB)
      • createBookieNode

        protected org.apache.bookkeeper.net.BookieNode createBookieNode​(org.apache.bookkeeper.net.BookieId addr)
      • createDummyLocalBookieNode

        protected org.apache.bookkeeper.net.BookieNode createDummyLocalBookieNode​(java.lang.String hostname)
      • resolveNetworkLocation

        protected java.lang.String resolveNetworkLocation​(org.apache.bookkeeper.net.BookieId addr)
      • convertBookiesToNodes

        protected java.util.Set<org.apache.bookkeeper.net.Node> convertBookiesToNodes​(java.util.Collection<org.apache.bookkeeper.net.BookieId> bookies)
      • convertBookieToNode

        protected org.apache.bookkeeper.net.BookieNode convertBookieToNode​(org.apache.bookkeeper.net.BookieId addr)