From 6be6337ab0617304fa839e3f40e9cf7f3df23071 Mon Sep 17 00:00:00 2001 From: nishantmonu51 Date: Fri, 9 May 2014 23:33:00 +0530 Subject: [PATCH 1/2] remove initial delay from polling remove initial delay from polling in coordinator, this will help in the cases when the pollDuration is set to higher than coordinator startDelay. --- server/src/main/java/io/druid/db/DatabaseSegmentManager.java | 2 +- .../src/test/java/io/druid/db/DatabaseSegmentManagerTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/io/druid/db/DatabaseSegmentManager.java b/server/src/main/java/io/druid/db/DatabaseSegmentManager.java index 930322106f8..a8b5b02bc16 100644 --- a/server/src/main/java/io/druid/db/DatabaseSegmentManager.java +++ b/server/src/main/java/io/druid/db/DatabaseSegmentManager.java @@ -106,7 +106,7 @@ public class DatabaseSegmentManager final Duration delay = config.get().getPollDuration().toStandardDuration(); ScheduledExecutors.scheduleWithFixedDelay( exec, - delay, + new Duration(0), delay, new Runnable() { diff --git a/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java b/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java index 267f86a8a56..329f5490ad1 100644 --- a/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java +++ b/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java @@ -106,6 +106,7 @@ public class DatabaseSegmentManagerTest @Test public void testPoll() { + EasyMock.expect(dbi.withHandle(EasyMock.anyObject())).andReturn(testRows); EasyMock.expect(dbi.withHandle(EasyMock.anyObject())).andReturn(testRows); EasyMock.replay(dbi); From 17e994f2e438d98c7c29600a44f8cc9fbfaa581a Mon Sep 17 00:00:00 2001 From: nishantmonu51 Date: Fri, 9 May 2014 23:53:25 +0530 Subject: [PATCH 2/2] review comment --- .../src/test/java/io/druid/db/DatabaseSegmentManagerTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java b/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java index 329f5490ad1..553c1b3946d 100644 --- a/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java +++ b/server/src/test/java/io/druid/db/DatabaseSegmentManagerTest.java @@ -106,8 +106,7 @@ public class DatabaseSegmentManagerTest @Test public void testPoll() { - EasyMock.expect(dbi.withHandle(EasyMock.anyObject())).andReturn(testRows); - EasyMock.expect(dbi.withHandle(EasyMock.anyObject())).andReturn(testRows); + EasyMock.expect(dbi.withHandle(EasyMock.anyObject())).andReturn(testRows).times(2); EasyMock.replay(dbi); manager.start();