From 044e43d231ae53615be22647ff682e04694178ba Mon Sep 17 00:00:00 2001 From: cheddar Date: Thu, 12 Sep 2013 14:17:11 -0500 Subject: [PATCH] 1) Remove last TODO related to segment lifetime. Don't think we care about that anymore. --- .../io/druid/client/ServerInventoryView.java | 2 +- .../client/ServerInventoryViewConfig.java | 36 ------------------- .../io/druid/guice/CoordinatorModule.java | 2 -- .../io/druid/server/master/DruidMaster.java | 27 ++++---------- 4 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 server/src/main/java/io/druid/client/ServerInventoryViewConfig.java diff --git a/server/src/main/java/io/druid/client/ServerInventoryView.java b/server/src/main/java/io/druid/client/ServerInventoryView.java index 07b1a08bdc4..f9187828ac3 100644 --- a/server/src/main/java/io/druid/client/ServerInventoryView.java +++ b/server/src/main/java/io/druid/client/ServerInventoryView.java @@ -63,7 +63,7 @@ public abstract class ServerInventoryView implements ServerView, ) { this.log = log; - this.inventoryManager = new CuratorInventoryManager( + this.inventoryManager = new CuratorInventoryManager<>( curator, new InventoryManagerConfig() { diff --git a/server/src/main/java/io/druid/client/ServerInventoryViewConfig.java b/server/src/main/java/io/druid/client/ServerInventoryViewConfig.java deleted file mode 100644 index 0e96cec5e34..00000000000 --- a/server/src/main/java/io/druid/client/ServerInventoryViewConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012, 2013 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.client; - -import org.skife.config.Config; -import org.skife.config.Default; - -/** - */ -public abstract class ServerInventoryViewConfig -{ - @Config("druid.master.removedSegmentLifetime") - @Default("1") - public abstract int getRemovedSegmentLifetime(); - - @Config("druid.announcer.type") - @Default("legacy") - public abstract String getAnnouncerType(); -} \ No newline at end of file diff --git a/server/src/main/java/io/druid/guice/CoordinatorModule.java b/server/src/main/java/io/druid/guice/CoordinatorModule.java index 75b7ab93e32..df0e36a53c5 100644 --- a/server/src/main/java/io/druid/guice/CoordinatorModule.java +++ b/server/src/main/java/io/druid/guice/CoordinatorModule.java @@ -24,7 +24,6 @@ import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Provides; import com.metamx.common.concurrent.ScheduledExecutorFactory; -import io.druid.client.ServerInventoryViewConfig; import io.druid.client.indexing.IndexingServiceClient; import io.druid.db.DatabaseRuleManager; import io.druid.db.DatabaseRuleManagerConfig; @@ -49,7 +48,6 @@ public class CoordinatorModule implements Module public void configure(Binder binder) { ConfigProvider.bind(binder, DruidMasterConfig.class); - ConfigProvider.bind(binder, ServerInventoryViewConfig.class); JsonConfigProvider.bind(binder, "druid.manager.segment", DatabaseSegmentManagerConfig.class); JsonConfigProvider.bind(binder, "druid.manager.rules", DatabaseRuleManagerConfig.class); diff --git a/server/src/main/java/io/druid/server/master/DruidMaster.java b/server/src/main/java/io/druid/server/master/DruidMaster.java index 812d131a477..937c1c6bfa1 100644 --- a/server/src/main/java/io/druid/server/master/DruidMaster.java +++ b/server/src/main/java/io/druid/server/master/DruidMaster.java @@ -160,8 +160,8 @@ public class DruidMaster this.exec = scheduledExecutorFactory.create(1, "Master-Exec--%d"); - this.leaderLatch = new AtomicReference(null); - this.segmentSettingsAtomicReference= new AtomicReference(null); + this.leaderLatch = new AtomicReference<>(null); + this.segmentSettingsAtomicReference= new AtomicReference<>(null); this.loadManagementPeons = loadQueuePeonMap; } @@ -731,29 +731,16 @@ public class DruidMaster SegmentReplicantLookup segmentReplicantLookup = SegmentReplicantLookup.make(cluster); // Stop peons for servers that aren't there anymore. - for (String name : Sets.difference( - loadManagementPeons.keySet(), - Sets.newHashSet( - Iterables.transform( - servers, - new Function() - { - @Override - public String apply(@Nullable DruidServer input) - { - return input.getName(); - } - } - ) - ) - )) { + final Set disdappearedServers = Sets.newHashSet(loadManagementPeons.keySet()); + for (DruidServer server : servers) { + disdappearedServers.remove(server.getName()); + } + for (String name : disdappearedServers) { log.info("Removing listener for server[%s] which is no longer there.", name); LoadQueuePeon peon = loadManagementPeons.remove(name); peon.stop(); } - // TODO: decrementRemovedSegmentsLifetime(); - return params.buildFromExisting() .withDruidCluster(cluster) .withDatabaseRuleManager(databaseRuleManager)