View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.zookeeper;
20  
21  import java.io.Closeable;
22  import java.io.IOException;
23  import java.util.ArrayList;
24  import java.util.HashMap;
25  import java.util.List;
26  import java.util.Map;
27  import java.util.concurrent.CopyOnWriteArrayList;
28  import java.util.concurrent.CountDownLatch;
29  
30  import org.apache.commons.logging.Log;
31  import org.apache.commons.logging.LogFactory;
32  import org.apache.hadoop.conf.Configuration;
33  import org.apache.hadoop.hbase.Abortable;
34  import org.apache.hadoop.hbase.HConstants;
35  import org.apache.hadoop.hbase.HRegionInfo;
36  import org.apache.hadoop.hbase.ZooKeeperConnectionException;
37  import org.apache.hadoop.hbase.classification.InterfaceAudience;
38  import org.apache.hadoop.security.UserGroupInformation;
39  import org.apache.zookeeper.KeeperException;
40  import org.apache.zookeeper.WatchedEvent;
41  import org.apache.zookeeper.Watcher;
42  import org.apache.zookeeper.ZooDefs.Ids;
43  import org.apache.zookeeper.ZooDefs.Perms;
44  import org.apache.zookeeper.data.ACL;
45  import org.apache.zookeeper.data.Id;
46  import org.apache.zookeeper.data.Stat;
47  
48  /**
49   * Acts as the single ZooKeeper Watcher.  One instance of this is instantiated
50   * for each Master, RegionServer, and client process.
51   *
52   * <p>This is the only class that implements {@link Watcher}.  Other internal
53   * classes which need to be notified of ZooKeeper events must register with
54   * the local instance of this watcher via {@link #registerListener}.
55   *
56   * <p>This class also holds and manages the connection to ZooKeeper.  Code to
57   * deal with connection related events and exceptions are handled here.
58   */
59  @InterfaceAudience.Private
60  public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
61    private static final Log LOG = LogFactory.getLog(ZooKeeperWatcher.class);
62  
63    // Identifier for this watcher (for logging only).  It is made of the prefix
64    // passed on construction and the zookeeper sessionid.
65    private String prefix;
66    private String identifier;
67  
68    // zookeeper quorum
69    private String quorum;
70  
71    // zookeeper connection
72    private RecoverableZooKeeper recoverableZooKeeper;
73  
74    // abortable in case of zk failure
75    protected Abortable abortable;
76    // Used if abortable is null
77    private boolean aborted = false;
78  
79    // listeners to be notified
80    private final List<ZooKeeperListener> listeners =
81      new CopyOnWriteArrayList<ZooKeeperListener>();
82  
83    // Used by ZKUtil:waitForZKConnectionIfAuthenticating to wait for SASL
84    // negotiation to complete
85    public CountDownLatch saslLatch = new CountDownLatch(1);
86  
87    // node names
88  
89    // base znode for this cluster
90    public String baseZNode;
91    //znodes containing the locations of the servers hosting the meta replicas
92    private Map<Integer,String> metaReplicaZnodes = new HashMap<Integer, String>();
93    // znode containing ephemeral nodes of the regionservers
94    public String rsZNode;
95    // znode containing ephemeral nodes of the draining regionservers
96    public String drainingZNode;
97    // znode of currently active master
98    private String masterAddressZNode;
99    // znode of this master in backup master directory, if not the active master
100   public String backupMasterAddressesZNode;
101   // znode containing the current cluster state
102   public String clusterStateZNode;
103   // znode used for table disabling/enabling
104   @Deprecated
105   public String tableZNode;
106   // znode containing the unique cluster ID
107   public String clusterIdZNode;
108   // znode used for log splitting work assignment
109   public String splitLogZNode;
110   // znode containing the state of the load balancer
111   public String balancerZNode;
112   // znode containing the lock for the tables
113   public String tableLockZNode;
114   // znode containing the state of recovering regions
115   public String recoveringRegionsZNode;
116   // znode containing namespace descriptors
117   public static String namespaceZNode = "namespace";
118 
119   public final static String META_ZNODE_PREFIX = "meta-region-server";
120 
121   private final Configuration conf;
122 
123   private final Exception constructorCaller;
124 
125   /**
126    * Instantiate a ZooKeeper connection and watcher.
127    * @param identifier string that is passed to RecoverableZookeeper to be used as
128    * identifier for this instance. Use null for default.
129    * @throws IOException
130    * @throws ZooKeeperConnectionException
131    */
132   public ZooKeeperWatcher(Configuration conf, String identifier,
133       Abortable abortable) throws ZooKeeperConnectionException, IOException {
134     this(conf, identifier, abortable, false);
135   }
136 
137   /**
138    * Instantiate a ZooKeeper connection and watcher.
139    * @param conf
140    * @param identifier string that is passed to RecoverableZookeeper to be used as identifier for
141    *          this instance. Use null for default.
142    * @param abortable Can be null if there is on error there is no host to abort: e.g. client
143    *          context.
144    * @param canCreateBaseZNode
145    * @throws IOException
146    * @throws ZooKeeperConnectionException
147    */
148   public ZooKeeperWatcher(Configuration conf, String identifier,
149       Abortable abortable, boolean canCreateBaseZNode)
150   throws IOException, ZooKeeperConnectionException {
151     this.conf = conf;
152     // Capture a stack trace now.  Will print it out later if problem so we can
153     // distingush amongst the myriad ZKWs.
154     try {
155       throw new Exception("ZKW CONSTRUCTOR STACK TRACE FOR DEBUGGING");
156     } catch (Exception e) {
157       this.constructorCaller = e;
158     }
159     this.quorum = ZKConfig.getZKQuorumServersString(conf);
160     this.prefix = identifier;
161     // Identifier will get the sessionid appended later below down when we
162     // handle the syncconnect event.
163     this.identifier = identifier + "0x0";
164     this.abortable = abortable;
165     setNodeNames(conf);
166     this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, this, identifier);
167     if (canCreateBaseZNode) {
168       createBaseZNodes();
169     }
170   }
171 
172   private void createBaseZNodes() throws ZooKeeperConnectionException {
173     try {
174       // Create all the necessary "directories" of znodes
175       ZKUtil.createWithParents(this, baseZNode);
176       ZKUtil.createAndFailSilent(this, rsZNode);
177       ZKUtil.createAndFailSilent(this, drainingZNode);
178       ZKUtil.createAndFailSilent(this, tableZNode);
179       ZKUtil.createAndFailSilent(this, splitLogZNode);
180       ZKUtil.createAndFailSilent(this, backupMasterAddressesZNode);
181       ZKUtil.createAndFailSilent(this, tableLockZNode);
182       ZKUtil.createAndFailSilent(this, recoveringRegionsZNode);
183     } catch (KeeperException e) {
184       throw new ZooKeeperConnectionException(
185           prefix("Unexpected KeeperException creating base node"), e);
186     }
187   }
188 
189   /** Returns whether the znode is supposed to be readable by the client
190    * and DOES NOT contain sensitive information (world readable).*/
191   public boolean isClientReadable(String node) {
192     // Developer notice: These znodes are world readable. DO NOT add more znodes here UNLESS
193     // all clients need to access this data to work. Using zk for sharing data to clients (other
194     // than service lookup case is not a recommended design pattern.
195     return
196         node.equals(baseZNode) ||
197         isAnyMetaReplicaZnode(node) ||
198         node.equals(getMasterAddressZNode()) ||
199         node.equals(clusterIdZNode)||
200         node.equals(rsZNode) ||
201         // /hbase/table and /hbase/table/foo is allowed, /hbase/table-lock is not
202         node.equals(tableZNode) ||
203         node.startsWith(tableZNode + "/");
204   }
205 
206   /**
207    * On master start, we check the znode ACLs under the root directory and set the ACLs properly
208    * if needed. If the cluster goes from an unsecure setup to a secure setup, this step is needed
209    * so that the existing znodes created with open permissions are now changed with restrictive
210    * perms.
211    */
212   public void checkAndSetZNodeAcls() {
213     if (!ZKUtil.isSecureZooKeeper(getConfiguration())) {
214       return;
215     }
216 
217     // Check the base znodes permission first. Only do the recursion if base znode's perms are not
218     // correct.
219     try {
220       List<ACL> actualAcls = recoverableZooKeeper.getAcl(baseZNode, new Stat());
221 
222       if (!isBaseZnodeAclSetup(actualAcls)) {
223         LOG.info("setting znode ACLs");
224         setZnodeAclsRecursive(baseZNode);
225       }
226     } catch(KeeperException.NoNodeException nne) {
227       return;
228     } catch(InterruptedException ie) {
229       interruptedException(ie);
230     } catch (IOException|KeeperException e) {
231       LOG.warn("Received exception while checking and setting zookeeper ACLs", e);
232     }
233   }
234 
235   /**
236    * Set the znode perms recursively. This will do post-order recursion, so that baseZnode ACLs
237    * will be set last in case the master fails in between.
238    * @param znode
239    */
240   private void setZnodeAclsRecursive(String znode) throws KeeperException, InterruptedException {
241     List<String> children = recoverableZooKeeper.getChildren(znode, false);
242 
243     for (String child : children) {
244       setZnodeAclsRecursive(ZKUtil.joinZNode(znode, child));
245     }
246     List<ACL> acls = ZKUtil.createACL(this, znode, true);
247     LOG.info("Setting ACLs for znode:" + znode + " , acl:" + acls);
248     recoverableZooKeeper.setAcl(znode, acls, -1);
249   }
250 
251   /**
252    * Checks whether the ACLs returned from the base znode (/hbase) is set for secure setup.
253    * @param acls acls from zookeeper
254    * @return whether ACLs are set for the base znode
255    * @throws IOException
256    */
257   private boolean isBaseZnodeAclSetup(List<ACL> acls) throws IOException {
258     String superUser = conf.get("hbase.superuser");
259 
260     // this assumes that current authenticated user is the same as zookeeper client user
261     // configured via JAAS
262     String hbaseUser = UserGroupInformation.getCurrentUser().getShortUserName();
263 
264     if (acls.isEmpty()) {
265       return false;
266     }
267 
268     for (ACL acl : acls) {
269       int perms = acl.getPerms();
270       Id id = acl.getId();
271       // We should only set at most 3 possible ACLs for 3 Ids. One for everyone, one for superuser
272       // and one for the hbase user
273       if (Ids.ANYONE_ID_UNSAFE.equals(id)) {
274         if (perms != Perms.READ) {
275           return false;
276         }
277       } else if (superUser != null && new Id("sasl", superUser).equals(id)) {
278         if (perms != Perms.ALL) {
279           return false;
280         }
281       } else if (new Id("sasl", hbaseUser).equals(id)) {
282         if (perms != Perms.ALL) {
283           return false;
284         }
285       } else {
286         return false;
287       }
288     }
289     return true;
290   }
291 
292   @Override
293   public String toString() {
294     return this.identifier + ", quorum=" + quorum + ", baseZNode=" + baseZNode;
295   }
296 
297   /**
298    * Adds this instance's identifier as a prefix to the passed <code>str</code>
299    * @param str String to amend.
300    * @return A new string with this instance's identifier as prefix: e.g.
301    * if passed 'hello world', the returned string could be
302    */
303   public String prefix(final String str) {
304     return this.toString() + " " + str;
305   }
306 
307   /**
308    * Set the local variable node names using the specified configuration.
309    */
310   private void setNodeNames(Configuration conf) {
311     baseZNode = conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
312         HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
313     metaReplicaZnodes.put(0, ZKUtil.joinZNode(baseZNode,
314            conf.get("zookeeper.znode.metaserver", "meta-region-server")));
315     int numMetaReplicas = conf.getInt(HConstants.META_REPLICAS_NUM,
316             HConstants.DEFAULT_META_REPLICA_NUM);
317     for (int i = 1; i < numMetaReplicas; i++) {
318       String str = ZKUtil.joinZNode(baseZNode,
319         conf.get("zookeeper.znode.metaserver", "meta-region-server") + "-" + i);
320       metaReplicaZnodes.put(i, str);
321     }
322     rsZNode = ZKUtil.joinZNode(baseZNode,
323         conf.get("zookeeper.znode.rs", "rs"));
324     drainingZNode = ZKUtil.joinZNode(baseZNode,
325         conf.get("zookeeper.znode.draining.rs", "draining"));
326     masterAddressZNode = ZKUtil.joinZNode(baseZNode,
327         conf.get("zookeeper.znode.master", "master"));
328     backupMasterAddressesZNode = ZKUtil.joinZNode(baseZNode,
329         conf.get("zookeeper.znode.backup.masters", "backup-masters"));
330     clusterStateZNode = ZKUtil.joinZNode(baseZNode,
331         conf.get("zookeeper.znode.state", "running"));
332     tableZNode = ZKUtil.joinZNode(baseZNode,
333         conf.get("zookeeper.znode.tableEnableDisable", "table"));
334     clusterIdZNode = ZKUtil.joinZNode(baseZNode,
335         conf.get("zookeeper.znode.clusterId", "hbaseid"));
336     splitLogZNode = ZKUtil.joinZNode(baseZNode,
337         conf.get("zookeeper.znode.splitlog", HConstants.SPLIT_LOGDIR_NAME));
338     balancerZNode = ZKUtil.joinZNode(baseZNode,
339         conf.get("zookeeper.znode.balancer", "balancer"));
340     tableLockZNode = ZKUtil.joinZNode(baseZNode,
341         conf.get("zookeeper.znode.tableLock", "table-lock"));
342     recoveringRegionsZNode = ZKUtil.joinZNode(baseZNode,
343         conf.get("zookeeper.znode.recovering.regions", "recovering-regions"));
344     namespaceZNode = ZKUtil.joinZNode(baseZNode,
345         conf.get("zookeeper.znode.namespace", "namespace"));
346   }
347 
348   /**
349    * Is the znode of any meta replica
350    * @param node
351    * @return true or false
352    */
353   public boolean isAnyMetaReplicaZnode(String node) {
354     if (metaReplicaZnodes.values().contains(node)) {
355       return true;
356     }
357     return false;
358   }
359 
360   /**
361    * Is it the default meta replica's znode
362    * @param node
363    * @return true or false
364    */
365   public boolean isDefaultMetaReplicaZnode(String node) {
366     if (getZNodeForReplica(HRegionInfo.DEFAULT_REPLICA_ID).equals(node)) {
367       return true;
368     }
369     return false;
370   }
371 
372   /**
373    * Get the znodes corresponding to the meta replicas from ZK
374    * @return list of znodes
375    * @throws KeeperException
376    */
377   public List<String> getMetaReplicaNodes() throws KeeperException {
378     List<String> childrenOfBaseNode = ZKUtil.listChildrenNoWatch(this, baseZNode);
379     List<String> metaReplicaNodes = new ArrayList<String>(2);
380     String pattern = conf.get("zookeeper.znode.metaserver","meta-region-server");
381     for (String child : childrenOfBaseNode) {
382       if (child.startsWith(pattern)) metaReplicaNodes.add(child);
383     }
384     return metaReplicaNodes;
385   }
386 
387   /**
388    * Get the znode string corresponding to a replicaId
389    * @param replicaId
390    * @return znode
391    */
392   public String getZNodeForReplica(int replicaId) {
393     String str = metaReplicaZnodes.get(replicaId);
394     // return a newly created path but don't update the cache of paths
395     // This is mostly needed for tests that attempt to create meta replicas
396     // from outside the master
397     if (str == null) {
398       str = ZKUtil.joinZNode(baseZNode,
399           conf.get("zookeeper.znode.metaserver", "meta-region-server") + "-" + replicaId);
400     }
401     return str;
402   }
403 
404   /**
405    * Parse the meta replicaId from the passed znode
406    * @param znode
407    * @return replicaId
408    */
409   public int getMetaReplicaIdFromZnode(String znode) {
410     String pattern = conf.get("zookeeper.znode.metaserver","meta-region-server");
411     if (znode.equals(pattern)) return HRegionInfo.DEFAULT_REPLICA_ID;
412     // the non-default replicas are of the pattern meta-region-server-<replicaId>
413     String nonDefaultPattern = pattern + "-";
414     return Integer.parseInt(znode.substring(nonDefaultPattern.length()));
415   }
416 
417   /**
418    * Register the specified listener to receive ZooKeeper events.
419    * @param listener
420    */
421   public void registerListener(ZooKeeperListener listener) {
422     listeners.add(listener);
423   }
424 
425   /**
426    * Register the specified listener to receive ZooKeeper events and add it as
427    * the first in the list of current listeners.
428    * @param listener
429    */
430   public void registerListenerFirst(ZooKeeperListener listener) {
431     listeners.add(0, listener);
432   }
433 
434   public void unregisterListener(ZooKeeperListener listener) {
435     listeners.remove(listener);
436   }
437 
438   /**
439    * Clean all existing listeners
440    */
441   public void unregisterAllListeners() {
442     listeners.clear();
443   }
444 
445   /**
446    * Get a copy of current registered listeners
447    */
448   public List<ZooKeeperListener> getListeners() {
449     return new ArrayList<ZooKeeperListener>(listeners);
450   }
451 
452   /**
453    * @return The number of currently registered listeners
454    */
455   public int getNumberOfListeners() {
456     return listeners.size();
457   }
458 
459   /**
460    * Get the connection to ZooKeeper.
461    * @return connection reference to zookeeper
462    */
463   public RecoverableZooKeeper getRecoverableZooKeeper() {
464     return recoverableZooKeeper;
465   }
466 
467   public void reconnectAfterExpiration() throws IOException, KeeperException, InterruptedException {
468     recoverableZooKeeper.reconnectAfterExpiration();
469   }
470 
471   /**
472    * Get the quorum address of this instance.
473    * @return quorum string of this zookeeper connection instance
474    */
475   public String getQuorum() {
476     return quorum;
477   }
478 
479   /**
480    * @return the base znode of this zookeeper connection instance.
481    */
482   public String getBaseZNode() {
483     return baseZNode;
484   }
485 
486   /**
487    * Method called from ZooKeeper for events and connection status.
488    * <p>
489    * Valid events are passed along to listeners.  Connection status changes
490    * are dealt with locally.
491    */
492   @Override
493   public void process(WatchedEvent event) {
494     LOG.debug(prefix("Received ZooKeeper Event, " +
495         "type=" + event.getType() + ", " +
496         "state=" + event.getState() + ", " +
497         "path=" + event.getPath()));
498 
499     switch(event.getType()) {
500 
501       // If event type is NONE, this is a connection status change
502       case None: {
503         connectionEvent(event);
504         break;
505       }
506 
507       // Otherwise pass along to the listeners
508 
509       case NodeCreated: {
510         for(ZooKeeperListener listener : listeners) {
511           listener.nodeCreated(event.getPath());
512         }
513         break;
514       }
515 
516       case NodeDeleted: {
517         for(ZooKeeperListener listener : listeners) {
518           listener.nodeDeleted(event.getPath());
519         }
520         break;
521       }
522 
523       case NodeDataChanged: {
524         for(ZooKeeperListener listener : listeners) {
525           listener.nodeDataChanged(event.getPath());
526         }
527         break;
528       }
529 
530       case NodeChildrenChanged: {
531         for(ZooKeeperListener listener : listeners) {
532           listener.nodeChildrenChanged(event.getPath());
533         }
534         break;
535       }
536     }
537   }
538 
539   // Connection management
540 
541   /**
542    * Called when there is a connection-related event via the Watcher callback.
543    * <p>
544    * If Disconnected or Expired, this should shutdown the cluster. But, since
545    * we send a KeeperException.SessionExpiredException along with the abort
546    * call, it's possible for the Abortable to catch it and try to create a new
547    * session with ZooKeeper. This is what the client does in HCM.
548    * <p>
549    * @param event
550    */
551   private void connectionEvent(WatchedEvent event) {
552     switch(event.getState()) {
553       case SyncConnected:
554         // Now, this callback can be invoked before the this.zookeeper is set.
555         // Wait a little while.
556         long finished = System.currentTimeMillis() +
557           this.conf.getLong("hbase.zookeeper.watcher.sync.connected.wait", 2000);
558         while (System.currentTimeMillis() < finished) {
559           try {
560             Thread.sleep(1);
561           } catch (InterruptedException e) {
562             LOG.warn("Interrupted while sleeping");
563             throw new RuntimeException("Interrupted while waiting for" +
564                 " recoverableZooKeeper is set");
565           }
566           if (this.recoverableZooKeeper != null) break;
567         }
568 
569         if (this.recoverableZooKeeper == null) {
570           LOG.error("ZK is null on connection event -- see stack trace " +
571             "for the stack trace when constructor was called on this zkw",
572             this.constructorCaller);
573           throw new NullPointerException("ZK is null");
574         }
575         this.identifier = this.prefix + "-0x" +
576           Long.toHexString(this.recoverableZooKeeper.getSessionId());
577         // Update our identifier.  Otherwise ignore.
578         LOG.debug(this.identifier + " connected");
579         break;
580 
581       // Abort the server if Disconnected or Expired
582       case Disconnected:
583         LOG.debug(prefix("Received Disconnected from ZooKeeper, ignoring"));
584         break;
585 
586       case Expired:
587         String msg = prefix(this.identifier + " received expired from " +
588           "ZooKeeper, aborting");
589         // TODO: One thought is to add call to ZooKeeperListener so say,
590         // ZooKeeperNodeTracker can zero out its data values.
591         if (this.abortable != null) {
592           this.abortable.abort(msg, new KeeperException.SessionExpiredException());
593         }
594         break;
595 
596       case ConnectedReadOnly:
597       case SaslAuthenticated:
598       case AuthFailed:
599         break;
600 
601       default:
602         throw new IllegalStateException("Received event is not valid: " + event.getState());
603     }
604   }
605 
606   /**
607    * Forces a synchronization of this ZooKeeper client connection.
608    * <p>
609    * Executing this method before running other methods will ensure that the
610    * subsequent operations are up-to-date and consistent as of the time that
611    * the sync is complete.
612    * <p>
613    * This is used for compareAndSwap type operations where we need to read the
614    * data of an existing node and delete or transition that node, utilizing the
615    * previously read version and data.  We want to ensure that the version read
616    * is up-to-date from when we begin the operation.
617    */
618   public void sync(String path) throws KeeperException {
619     this.recoverableZooKeeper.sync(path, null, null);
620   }
621 
622   /**
623    * Handles KeeperExceptions in client calls.
624    * <p>
625    * This may be temporary but for now this gives one place to deal with these.
626    * <p>
627    * TODO: Currently this method rethrows the exception to let the caller handle
628    * <p>
629    * @param ke
630    * @throws KeeperException
631    */
632   public void keeperException(KeeperException ke)
633   throws KeeperException {
634     LOG.error(prefix("Received unexpected KeeperException, re-throwing exception"), ke);
635     throw ke;
636   }
637 
638   /**
639    * Handles InterruptedExceptions in client calls.
640    * <p>
641    * This may be temporary but for now this gives one place to deal with these.
642    * <p>
643    * TODO: Currently, this method does nothing.
644    *       Is this ever expected to happen?  Do we abort or can we let it run?
645    *       Maybe this should be logged as WARN?  It shouldn't happen?
646    * <p>
647    * @param ie
648    */
649   public void interruptedException(InterruptedException ie) {
650     LOG.debug(prefix("Received InterruptedException, doing nothing here"), ie);
651     // At least preserver interrupt.
652     Thread.currentThread().interrupt();
653     // no-op
654   }
655 
656   /**
657    * Close the connection to ZooKeeper.
658    *
659    */
660   @Override
661   public void close() {
662     try {
663       if (recoverableZooKeeper != null) {
664         recoverableZooKeeper.close();
665       }
666     } catch (InterruptedException e) {
667       Thread.currentThread().interrupt();
668     }
669   }
670 
671   public Configuration getConfiguration() {
672     return conf;
673   }
674 
675   @Override
676   public void abort(String why, Throwable e) {
677     if (this.abortable != null) this.abortable.abort(why, e);
678     else this.aborted = true;
679   }
680 
681   @Override
682   public boolean isAborted() {
683     return this.abortable == null? this.aborted: this.abortable.isAborted();
684   }
685 
686   /**
687    * @return Path to the currently active master.
688    */
689   public String getMasterAddressZNode() {
690     return this.masterAddressZNode;
691   }
692 
693 }