private static void retryZooKeeperUpdate(ServerContext context, ZooLock zooLock, ZooOperation op) { while (true) { try { IZooReaderWriter zoo = context.getZooReaderWriter(); if (zoo.isLockHeld(zooLock.getLockID())) { op.run(zoo); } break; } catch (Exception e) { log.error("Unexpected exception {}", e.getMessage(), e); } sleepUninterruptibly(1, TimeUnit.SECONDS); } }
if (!zoo.isLockHeld(tablet.getTabletServer().getLock().getLockID())) { throw new IllegalStateException();
if (tablet.getExtent().isRootTablet()) { try { if (!zoo.isLockHeld(tablet.getTabletServer().getLock().getLockID())) { throw new IllegalStateException();
private static void retryZooKeeperUpdate(ClientContext context, ZooLock zooLock, ZooOperation op) { while (true) { try { IZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.isLockHeld(zooLock.getLockID())) { op.run(zoo); } break; } catch (Exception e) { log.error("Unexpected exception {}", e.getMessage(), e); } sleepUninterruptibly(1, TimeUnit.SECONDS); } }
if (!zoo.isLockHeld(tabletServer.getLock().getLockID())) { throw new IllegalStateException();
public static void addLogEntry(TCredentials credentials, LogEntry entry, ZooLock zooLock) { if (entry.extent.isRootTablet()) { String root = getZookeeperLogLocation(); while (true) { try { IZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.isLockHeld(zooLock.getLockID())) zoo.putPersistentData(root + "/" + entry.filename, entry.toBytes(), NodeExistsPolicy.OVERWRITE); break; } catch (KeeperException e) { log.error(e, e); } catch (InterruptedException e) { log.error(e, e); } catch (IOException e) { log.error(e, e); } UtilWaitThread.sleep(1000); } } else { String value = StringUtil.join(entry.logSet, ";") + "|" + entry.tabletId; Mutation m = new Mutation(entry.extent.getMetadataEntry()); m.put(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename), new Value(value.getBytes(UTF_8))); update(credentials, zooLock, m); } }
if (extent.isRootTablet()) { try { if (!zoo.isLockHeld(tabletServer.getLock().getLockID())) { throw new IllegalStateException();
public static void removeUnusedWALEntries(KeyExtent extent, List<LogEntry> logEntries, ZooLock zooLock) { if (extent.isRootTablet()) { for (LogEntry entry : logEntries) { String root = getZookeeperLogLocation(); while (true) { try { IZooReaderWriter zoo = ZooReaderWriter.getInstance(); if (zoo.isLockHeld(zooLock.getLockID())) zoo.recursiveDelete(root + "/" + entry.filename, NodeMissingPolicy.SKIP); break; } catch (Exception e) { log.error(e, e); } UtilWaitThread.sleep(1000); } } } else { Mutation m = new Mutation(extent.getMetadataEntry()); for (LogEntry entry : logEntries) { m.putDelete(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename)); } update(SecurityConstants.getSystemCredentials(), zooLock, m); } }
if (!zoo.isLockHeld(tablet.getTabletServer().getLock().getLockID())) { throw new IllegalStateException();
if (tablet.getExtent().isRootTablet()) { try { if (!zoo.isLockHeld(tablet.getTabletServer().getLock().getLockID())) { throw new IllegalStateException();