eolivelli commented on a change in pull request #2096: Entries must be
acknowledged by bookies in multiple fault domains before being acknowledged to
client
URL: https://github.com/apache/bookkeeper/pull/2096#discussion_r284105068
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
##########
@@ -1060,4 +1061,30 @@ public boolean
isEnsembleAdheringToPlacementPolicy(List<BookieSocketAddress> ens
}
return true;
}
+
+ @Override
+ public boolean
areAckedBookiesAdheringToPlacementPolicy(Set<BookieSocketAddress> ackedBookies)
{
+ ReentrantReadWriteLock.ReadLock readLock = rwLock.readLock();
+
+ readLock.lock();
+ HashSet<String> rackCounter = new HashSet<>();
+ for (BookieSocketAddress bookie : ackedBookies) {
+ try {
+ rackCounter.add(knownBookies.get(bookie).getNetworkLocation());
+ } catch (Exception e) {
+ LOG.warn("Received exception while trying to get network
location of bookie: {}", bookie, e);
+ }
+ }
+
+ // Check to make sure that ensemble is writing to `minNumberOfRacks`'s
number of racks at least.
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("areAckedBookiesAdheringToPlacementPolicy returning {}
because number of racks = {} and "
+ + "minNumRacksPerWriteQuorum = {}",
+ rackCounter.size() >= minNumRacksPerWriteQuorum,
+ rackCounter.size(),
+ minNumRacksPerWriteQuorum);
+ }
+ readLock.unlock();
Review comment:
enclose "readLock.unlock()" in a finally block please
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services