From 1ac84fcd009675c5d26dd032fcc573952a03d018 Mon Sep 17 00:00:00 2001 From: fjy Date: Tue, 29 Jul 2014 14:07:19 -0700 Subject: [PATCH] some more logging cleanup for zk coordination --- .../server/coordination/BaseZkCoordinator.java | 13 +++++++------ .../coordination/DataSegmentChangeRequest.java | 2 ++ .../coordination/SegmentChangeRequestDrop.java | 6 ++++++ .../coordination/SegmentChangeRequestLoad.java | 6 ++++++ .../coordination/SegmentChangeRequestNoop.java | 6 ++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/io/druid/server/coordination/BaseZkCoordinator.java b/server/src/main/java/io/druid/server/coordination/BaseZkCoordinator.java index bf77cdf9987..d489d74b445 100644 --- a/server/src/main/java/io/druid/server/coordination/BaseZkCoordinator.java +++ b/server/src/main/java/io/druid/server/coordination/BaseZkCoordinator.java @@ -72,7 +72,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler return; } - log.info("Starting zkCoordinator for server[%s]", me); + log.info("Starting zkCoordinator for server[%s]", me.getName()); final String loadQueueLocation = ZKPaths.makePath(zkPaths.getLoadQueuePath(), me.getName()); final String servedSegmentsLocation = ZKPaths.makePath(zkPaths.getServedSegmentsPath(), me.getName()); @@ -107,7 +107,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler child.getData(), DataSegmentChangeRequest.class ); - log.info("New node[%s] with segmentClass[%s]", path, request.getClass()); + log.info("New node[%s] with request[%s]", path, request.asString()); try { request.go( @@ -122,7 +122,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler try { if (!hasRun) { curator.delete().guaranteed().forPath(path); - log.info("Completed processing and removing entry for node[%s]", path); + log.info("Completed request and deleting node[%s]", path); hasRun = true; } } @@ -131,8 +131,9 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler curator.delete().guaranteed().forPath(path); } catch (Exception e1) { - log.info(e1, "Failed to delete node[%s], but ignoring exception.", path); + log.error(e1, "Failed to delete node[%s], but ignoring exception.", path); } + log.error(e, "Exception while removing node[%s]", path); throw Throwables.propagate(e); } } @@ -144,7 +145,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler curator.delete().guaranteed().forPath(path); } catch (Exception e1) { - log.info(e1, "Failed to delete node[%s], but ignoring exception.", path); + log.error(e1, "Failed to delete node[%s], but ignoring exception.", path); } log.makeAlert(e, "Segment load/unload: uncaught exception.") @@ -155,7 +156,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler break; case CHILD_REMOVED: - log.info("[%s] was removed", event.getData().getPath()); + log.info("node[%s] was removed", event.getData().getPath()); break; default: log.info("Ignoring event[%s]", event); diff --git a/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java b/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java index c5fa72e6bc0..be18720d064 100644 --- a/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java +++ b/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java @@ -33,4 +33,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; public interface DataSegmentChangeRequest { public void go(DataSegmentChangeHandler handler, DataSegmentChangeCallback callback); + + public String asString(); } diff --git a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestDrop.java b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestDrop.java index 2514f22871e..a64a51e7d92 100644 --- a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestDrop.java +++ b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestDrop.java @@ -51,6 +51,12 @@ public class SegmentChangeRequestDrop implements DataSegmentChangeRequest handler.removeSegment(segment, callback); } + @Override + public String asString() + { + return String.format("load %s", segment.getIdentifier()); + } + @Override public String toString() { diff --git a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestLoad.java b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestLoad.java index 11eba9684c0..76d539dcc59 100644 --- a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestLoad.java +++ b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestLoad.java @@ -51,6 +51,12 @@ public class SegmentChangeRequestLoad implements DataSegmentChangeRequest return segment; } + @Override + public String asString() + { + return String.format("drop %s", segment.getIdentifier()); + } + @Override public String toString() { diff --git a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestNoop.java b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestNoop.java index 7c51f3f0b6f..454d8617044 100644 --- a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestNoop.java +++ b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestNoop.java @@ -28,4 +28,10 @@ public class SegmentChangeRequestNoop implements DataSegmentChangeRequest { // do nothing } + + @Override + public String asString() + { + return "noop"; + } }