1) Remove the requirement on the segmentsPath zk property.

This commit is contained in:
Eric Tschetter 2012-11-28 11:54:59 -06:00
parent 1e35913579
commit 4de6ef5025
4 changed files with 0 additions and 164 deletions

View File

@ -1,106 +0,0 @@
/*
* Druid - a distributed column store.
* Copyright (C) 2012 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 com.metamx.druid.client;
import com.metamx.common.Pair;
import com.metamx.common.logger.Logger;
import com.metamx.phonebook.PhoneBook;
import com.metamx.phonebook.PhoneBookPeon;
import java.util.Map;
/**
*/
public class SegmentInventoryManager extends InventoryManager<DruidDataSource>
{
private static final Logger log = new Logger(SegmentInventoryManager.class);
public SegmentInventoryManager(
SegmentInventoryManagerConfig config,
PhoneBook zkPhoneBook
)
{
super(
log,
new InventoryManagerConfig(
config.getBasePath(),
config.getBasePath()
),
zkPhoneBook,
new SegmentInventoryManagementStrategy()
);
}
private static class SegmentInventoryManagementStrategy implements InventoryManagementStrategy<DruidDataSource>
{
@Override
public Class<DruidDataSource> getContainerClass()
{
return DruidDataSource.class;
}
@Override
public Pair<String, PhoneBookPeon<?>> makeSubListener(final DruidDataSource baseObject)
{
return new Pair<String, PhoneBookPeon<?>>(
baseObject.getName(),
new PhoneBookPeon<DataSegment>()
{
@Override
public Class<DataSegment> getObjectClazz()
{
return DataSegment.class;
}
@Override
public void newEntry(String name, DataSegment segment)
{
log.info("Adding dataSegment[%s].", segment);
baseObject.addSegment(name, segment);
}
@Override
public void entryRemoved(String name)
{
log.info("Partition[%s] deleted.", name);
baseObject.removePartition(name);
}
}
);
}
@Override
public void objectRemoved(DruidDataSource baseObject)
{
}
@Override
public boolean doesSerde()
{
return true;
}
@Override
public DruidDataSource deserialize(String name, Map<String, String> properties)
{
return new DruidDataSource(name, properties);
}
}
}

View File

@ -1,30 +0,0 @@
/*
* Druid - a distributed column store.
* Copyright (C) 2012 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 com.metamx.druid.client;
import org.skife.config.Config;
/**
*/
public abstract class SegmentInventoryManagerConfig
{
@Config("druid.zk.paths.indexesPath")
public abstract String getBasePath();
}

View File

@ -19,23 +19,6 @@
package com.metamx.druid.http;
import java.net.URL;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import org.I0Itec.zkclient.ZkClient;
import org.codehaus.jackson.map.ObjectMapper;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
import org.jets3t.service.security.AWSCredentials;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.FilterHolder;
import org.mortbay.jetty.servlet.ServletHolder;
import org.skife.config.ConfigurationObjectFactory;
import org.skife.jdbi.v2.DBI;
import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
@ -47,8 +30,6 @@ import com.metamx.common.concurrent.ScheduledExecutors;
import com.metamx.common.config.Config;
import com.metamx.common.lifecycle.Lifecycle;
import com.metamx.common.logger.Logger;
import com.metamx.druid.client.SegmentInventoryManager;
import com.metamx.druid.client.SegmentInventoryManagerConfig;
import com.metamx.druid.client.ServerInventoryManager;
import com.metamx.druid.client.ServerInventoryManagerConfig;
import com.metamx.druid.coordination.DruidClusterInfo;
@ -127,9 +108,6 @@ public class MasterMain
final PhoneBook masterYp = Initialization.createPhoneBook(jsonMapper, zkClient, "Master-ZKYP--%s", lifecycle);
final ScheduledExecutorFactory scheduledExecutorFactory = ScheduledExecutors.createFactory(lifecycle);
final SegmentInventoryManager segmentInventoryManager =
new SegmentInventoryManager(configFactory.build(SegmentInventoryManagerConfig.class), masterYp);
final ServerInventoryManager serverInventoryManager =
new ServerInventoryManager(configFactory.build(ServerInventoryManagerConfig.class), masterYp);
@ -186,7 +164,6 @@ public class MasterMain
final DruidMaster master = new DruidMaster(
druidMasterConfig,
druidClusterInfo,
segmentInventoryManager,
jsonMapper,
databaseSegmentManager,
serverInventoryManager,

View File

@ -37,7 +37,6 @@ import com.metamx.common.logger.Logger;
import com.metamx.druid.client.DataSegment;
import com.metamx.druid.client.DruidDataSource;
import com.metamx.druid.client.DruidServer;
import com.metamx.druid.client.SegmentInventoryManager;
import com.metamx.druid.client.ServerInventoryManager;
import com.metamx.druid.coordination.DruidClusterInfo;
import com.metamx.druid.db.DatabaseSegmentManager;
@ -85,13 +84,11 @@ public class DruidMaster
private final ServiceProvider serviceProvider;
private final SegmentInventoryManager segmentInventoryManager;
private final ObjectMapper jsonMapper;
public DruidMaster(
DruidMasterConfig config,
DruidClusterInfo clusterInfo,
SegmentInventoryManager segmentInventoryManager,
ObjectMapper jsonMapper,
DatabaseSegmentManager databaseSegmentManager,
ServerInventoryManager serverInventoryManager,
@ -105,7 +102,6 @@ public class DruidMaster
this.config = config;
this.clusterInfo = clusterInfo;
this.segmentInventoryManager = segmentInventoryManager;
this.jsonMapper = jsonMapper;
this.databaseSegmentManager = databaseSegmentManager;
@ -419,7 +415,6 @@ public class DruidMaster
if (becameMaster) {
log.info("I am the master, all must bow!");
master = true;
segmentInventoryManager.start();
databaseSegmentManager.start();
serverInventoryManager.start();