From 61101bee6ca4f229a74f9f564ec8bd4fda5d5e1a Mon Sep 17 00:00:00 2001 From: fjy Date: Mon, 15 Dec 2014 12:57:40 -0800 Subject: [PATCH 1/3] more logs for CIM --- .../inventory/CuratorInventoryManager.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java index 3c4bb2a2c6f..6bbc7beb391 100644 --- a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java +++ b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java @@ -46,10 +46,10 @@ import java.util.concurrent.atomic.AtomicReference; /** * An InventoryManager watches updates to inventory on Zookeeper (or some other discovery-like service publishing * system). It is built up on two object types: containers and inventory objects. - * + *

* The logic of the InventoryManager just maintains a local cache of the containers and inventory it sees on ZK. It * provides methods for getting at the container objects, which house the actual individual pieces of inventory. - * + *

* A Strategy is provided to the constructor of an Inventory manager, this strategy provides all of the * object-specific logic to serialize, deserialize, compose and alter the container and inventory objects. */ @@ -104,7 +104,8 @@ public class CuratorInventoryManager } catch (Exception e) { synchronized (lock) { - try { stop(); + try { + stop(); } catch (IOException e1) { log.error(e1, "Exception when stopping InventoryManager that couldn't start."); @@ -276,9 +277,9 @@ public class CuratorInventoryManager case INITIALIZED: synchronized (lock) { // must await initialized of all containerholders - for(ContainerHolder holder : containers.values()) { + for (ContainerHolder holder : containers.values()) { synchronized (holder) { - if(!holder.initialized) { + if (!holder.initialized) { uninitializedInventory.add(holder); } } @@ -300,12 +301,12 @@ public class CuratorInventoryManager private void maybeDoneInitializing() { - if(doneInitializing) { + if (doneInitializing) { return; } // only fire if we are done initializing the parent PathChildrenCache - if(containersInitialized && uninitializedInventory.isEmpty()) { + if (containersInitialized && uninitializedInventory.isEmpty()) { doneInitializing = true; strategy.inventoryInitialized(); } @@ -336,6 +337,7 @@ public class CuratorInventoryManager case CHILD_ADDED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_ADDED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); final InventoryClass addedInventory = strategy.deserializeInventory(child.getData()); @@ -348,6 +350,7 @@ public class CuratorInventoryManager case CHILD_UPDATED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_UPDATED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); final InventoryClass updatedInventory = strategy.deserializeInventory(child.getData()); @@ -361,6 +364,7 @@ public class CuratorInventoryManager case CHILD_REMOVED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_REMOVED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); synchronized (holder) { holder.setContainer(strategy.removeInventory(holder.getContainer(), inventoryKey)); From 9c6e32fc3f30d3e8f961df08bcf06b54570523dc Mon Sep 17 00:00:00 2001 From: fjy Date: Mon, 15 Dec 2014 13:06:36 -0800 Subject: [PATCH 2/3] address cr --- .../io/druid/curator/inventory/CuratorInventoryManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java index 6bbc7beb391..444d46ad386 100644 --- a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java +++ b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java @@ -337,7 +337,7 @@ public class CuratorInventoryManager case CHILD_ADDED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); - log.info("CHILD_ADDED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); + log.info("CHILD_ADDED[%s] with version[%s]", child.getPath(), event.getData().getStat().getVersion()); final InventoryClass addedInventory = strategy.deserializeInventory(child.getData()); @@ -350,7 +350,7 @@ public class CuratorInventoryManager case CHILD_UPDATED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); - log.info("CHILD_UPDATED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); + log.info("CHILD_UPDATED[%s] with version[%s]", child.getPath(), event.getData().getStat().getVersion()); final InventoryClass updatedInventory = strategy.deserializeInventory(child.getData()); @@ -364,7 +364,7 @@ public class CuratorInventoryManager case CHILD_REMOVED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); - log.info("CHILD_REMOVED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); + log.info("CHILD_REMOVED[%s] with version[%s]", child.getPath(), event.getData().getStat().getVersion()); synchronized (holder) { holder.setContainer(strategy.removeInventory(holder.getContainer(), inventoryKey)); From e166260f807bbd368f96f88fc195ac368f163e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Mon, 15 Dec 2014 13:19:47 -0800 Subject: [PATCH 3/3] more inventory logs --- .../druid/curator/inventory/CuratorInventoryManager.java | 9 +++++---- .../server/coordination/BatchDataSegmentAnnouncer.java | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java index 444d46ad386..aaa4409221c 100644 --- a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java +++ b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java @@ -263,12 +263,13 @@ public class CuratorInventoryManager final ContainerClass container = strategy.deserializeContainer(child.getData()); - ContainerHolder oldContainer = containers.get(containerKey); - if (oldContainer == null) { + log.info("Container[%s] updated.", child.getPath()); + ContainerHolder holder = containers.get(containerKey); + if (holder == null) { log.warn("Container update[%s], but the old container didn't exist!? Ignoring.", child.getPath()); } else { - synchronized (oldContainer) { - oldContainer.setContainer(strategy.updateContainer(oldContainer.getContainer(), container)); + synchronized (holder) { + holder.setContainer(strategy.updateContainer(holder.getContainer(), container)); } } diff --git a/server/src/main/java/io/druid/server/coordination/BatchDataSegmentAnnouncer.java b/server/src/main/java/io/druid/server/coordination/BatchDataSegmentAnnouncer.java index d0b24ea5653..620f75c6614 100644 --- a/server/src/main/java/io/druid/server/coordination/BatchDataSegmentAnnouncer.java +++ b/server/src/main/java/io/druid/server/coordination/BatchDataSegmentAnnouncer.java @@ -121,6 +121,7 @@ public class BatchDataSegmentAnnouncer extends AbstractDataSegmentAnnouncer { final SegmentZNode segmentZNode = segmentLookup.remove(segment); if (segmentZNode == null) { + log.warn("No path to unannounce segment[%s]", segment.getIdentifier()); return; }