mirror of https://github.com/apache/druid.git
added two seperate modules for mysql and postgres
This commit is contained in:
parent
91bf8fadcf
commit
aa887edb73
|
@ -21,7 +21,7 @@ package io.druid.db;
|
|||
|
||||
/**
|
||||
*/
|
||||
public interface MetadataDbConnector
|
||||
public interface MetadataStorageConnector
|
||||
{
|
||||
|
||||
public Void insertOrUpdate(
|
|
@ -25,7 +25,7 @@ import javax.validation.constraints.NotNull;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class MetadataDbConnectorConfig
|
||||
public class MetadataStorageConnectorConfig
|
||||
{
|
||||
@JsonProperty
|
||||
private boolean createTables = true;
|
|
@ -24,11 +24,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class MetadataTablesConfig
|
||||
public class MetadataStorageTablesConfig
|
||||
{
|
||||
public static MetadataTablesConfig fromBase(String base)
|
||||
public static MetadataStorageTablesConfig fromBase(String base)
|
||||
{
|
||||
return new MetadataTablesConfig(base, null, null, null, null, null, null);
|
||||
return new MetadataStorageTablesConfig(base, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
private static String defaultBase = "druid";
|
||||
|
@ -55,7 +55,7 @@ public class MetadataTablesConfig
|
|||
private final String taskLockTable;
|
||||
|
||||
@JsonCreator
|
||||
public MetadataTablesConfig(
|
||||
public MetadataStorageTablesConfig(
|
||||
@JsonProperty("base") String base,
|
||||
@JsonProperty("segments") String segmentsTable,
|
||||
@JsonProperty("rules") String rulesTable,
|
|
@ -5,7 +5,7 @@ import io.druid.timeline.DataSegment;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public interface MetadataUpdaterJobHandler
|
||||
public interface MetadataStorageUpdaterJobHandler
|
||||
{
|
||||
public void publishSegments(String tableName, List<DataSegment> segments, ObjectMapper mapper);
|
||||
}
|
|
@ -28,7 +28,7 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
*/
|
||||
public interface IndexerMetadataCoordinator
|
||||
public interface IndexerMetadataStorageCoordinator
|
||||
{
|
||||
public List<DataSegment> getUsedSegmentsForInterval(final String dataSource, final Interval interval)
|
||||
throws IOException;
|
|
@ -19,15 +19,10 @@
|
|||
|
||||
package io.druid.indexing.overlord;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import io.druid.db.MetadataDbConnector;
|
||||
import io.druid.db.MetadataDbConnectorConfig;
|
||||
import io.druid.db.MetadataTablesConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface MetadataActionHandler
|
||||
public interface MetadataStorageActionHandler
|
||||
{
|
||||
//<T> T retryCall(Action<T> action);
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>druid</artifactId>
|
||||
<groupId>io.druid</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>druid-postgres-storage</artifactId>
|
||||
|
||||
|
||||
</project>
|
|
@ -27,14 +27,14 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class DbUpdaterJob implements Jobby
|
||||
public class MetadataStorageUpdaterJob implements Jobby
|
||||
{
|
||||
|
||||
private final HadoopDruidIndexerConfig config;
|
||||
@Inject
|
||||
private MetadataUpdaterJobHandler handler;
|
||||
private MetadataStorageUpdaterJobHandler handler;
|
||||
|
||||
public DbUpdaterJob(
|
||||
public MetadataStorageUpdaterJob(
|
||||
HadoopDruidIndexerConfig config
|
||||
)
|
||||
{
|
|
@ -21,11 +21,11 @@ package io.druid.indexer.updater;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.base.Supplier;
|
||||
import io.druid.db.MetadataDbConnectorConfig;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class DbUpdaterJobSpec implements Supplier<MetadataDbConnectorConfig>
|
||||
public class MetadataStorageUpdaterJobSpec implements Supplier<MetadataStorageConnectorConfig>
|
||||
{
|
||||
@JsonProperty("connectURI")
|
||||
public String connectURI;
|
||||
|
@ -45,9 +45,9 @@ public class DbUpdaterJobSpec implements Supplier<MetadataDbConnectorConfig>
|
|||
}
|
||||
|
||||
@Override
|
||||
public MetadataDbConnectorConfig get()
|
||||
public MetadataStorageConnectorConfig get()
|
||||
{
|
||||
return new MetadataDbConnectorConfig()
|
||||
return new MetadataStorageConnectorConfig()
|
||||
{
|
||||
@Override
|
||||
public String getConnectURI()
|
|
@ -1,2 +0,0 @@
|
|||
io.druid.storage.jdbc.mysql.MySQLStorageDruidModule
|
||||
postgresql.PostgreSQLStorageDruidModule
|
|
@ -24,9 +24,9 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.druid.extensions</groupId>
|
||||
<artifactId>druid-jdbc-storage</artifactId>
|
||||
<name>druid-jdbc-storage</name>
|
||||
<description>druid-jdbc-storage</description>
|
||||
<artifactId>druid-mysql-storage</artifactId>
|
||||
<name>druid-mysql-storage</name>
|
||||
<description>druid-mysql-storage</description>
|
||||
|
||||
<parent>
|
||||
<groupId>io.druid</groupId>
|
|
@ -17,13 +17,13 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.storage.jdbc.mysql;
|
||||
package io.druid.storage.mysql;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.db.MetadataDbConnectorConfig;
|
||||
import io.druid.db.MetadataTablesConfig;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
|
@ -39,7 +39,7 @@ public class MySQLConnector extends SQLMetadataConnector
|
|||
private final DBI dbi;
|
||||
|
||||
@Inject
|
||||
public MySQLConnector(Supplier<MetadataDbConnectorConfig> config, Supplier<MetadataTablesConfig> dbTables)
|
||||
public MySQLConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables)
|
||||
{
|
||||
super(config, dbTables);
|
||||
this.dbi = new DBI(getDatasource());
|
|
@ -17,44 +17,43 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.storage.jdbc.mysql;
|
||||
package io.druid.storage.mysql;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Provides;
|
||||
import io.druid.db.IndexerSQLMetadataCoordinator;
|
||||
import io.druid.db.MetadataDbConnectorConfig;
|
||||
import io.druid.db.IndexerSQLMetadataStorageCoordinator;
|
||||
import io.druid.db.MetadataRuleManager;
|
||||
import io.druid.db.MetadataRuleManagerProvider;
|
||||
import io.druid.db.MetadataSegmentManager;
|
||||
import io.druid.db.MetadataSegmentManagerProvider;
|
||||
import io.druid.db.MetadataDbConnector;
|
||||
import io.druid.db.MetadataTablesConfig;
|
||||
import io.druid.db.MetadataSegmentPublisherProvider;
|
||||
import io.druid.db.DerbyConnector;
|
||||
import io.druid.db.SQLMetadataActionHandler;
|
||||
import io.druid.db.MetadataStorageConnector;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import io.druid.db.SQLMetadataRuleManager;
|
||||
import io.druid.db.SQLMetadataRuleManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentManager;
|
||||
import io.druid.db.SQLMetadataSegmentManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import io.druid.db.SQLMetadataStorageActionHandler;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.guice.PolyBind;
|
||||
import io.druid.indexer.MetadataUpdaterJobHandler;
|
||||
import io.druid.indexer.SQLMetadataUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataActionHandler;
|
||||
import io.druid.indexer.MetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexer.SQLMetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.segment.realtime.DbSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MySQLStorageDruidModule implements DruidModule
|
||||
public class MySQLMetadataStorageModule implements DruidModule
|
||||
{
|
||||
@Override
|
||||
public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
|
||||
|
@ -65,19 +64,18 @@ public class MySQLStorageDruidModule implements DruidModule
|
|||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
bindDataBaseMySQL(binder);
|
||||
|
||||
JsonConfigProvider.bind(binder, "druid.db.tables", MetadataTablesConfig.class);
|
||||
JsonConfigProvider.bind(binder, "druid.db.connector", MetadataDbConnectorConfig.class);
|
||||
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataDbConnector.class), Key.get(DerbyConnector.class)
|
||||
);
|
||||
bindMySQL(binder);
|
||||
JsonConfigProvider.bind(binder, "druid.db.tables", MetadataStorageTablesConfig.class);
|
||||
JsonConfigProvider.bind(binder, "druid.db.connector", MetadataStorageConnectorConfig.class);
|
||||
}
|
||||
|
||||
private static void bindDataBaseMySQL(Binder binder)
|
||||
{
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataDbConnector.class))
|
||||
private void bindMySQL(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("mysql")
|
||||
.to(MySQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class))
|
||||
.addBinding("mysql")
|
||||
.to(MySQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
@ -112,19 +110,19 @@ public class MySQLStorageDruidModule implements DruidModule
|
|||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataActionHandler.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataActionHandler.class)
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataCoordinator.class))
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("mysql")
|
||||
.to(IndexerSQLMetadataCoordinator.class)
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataUpdaterJobHandler.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataUpdaterJobHandler.class)
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
|
@ -134,5 +132,4 @@ public class MySQLStorageDruidModule implements DruidModule
|
|||
{
|
||||
return dbConnector.getDBI();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
io.druid.storage.mysql.MySQLMetadataStorageModule
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>druid</artifactId>
|
||||
<groupId>io.druid</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>mysql</artifactId>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* 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.storage.mysql;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
import org.skife.jdbi.v2.tweak.HandleCallback;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MySQLConnector extends SQLMetadataConnector
|
||||
{
|
||||
private static final Logger log = new Logger(MySQLConnector.class);
|
||||
private final DBI dbi;
|
||||
|
||||
@Inject
|
||||
public MySQLConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables)
|
||||
{
|
||||
super(config, dbTables);
|
||||
this.dbi = new DBI(getDatasource());
|
||||
}
|
||||
|
||||
public void createTable(final IDBI dbi, final String tableName, final String sql)
|
||||
{
|
||||
try {
|
||||
dbi.withHandle(
|
||||
new HandleCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void withHandle(Handle handle) throws Exception
|
||||
{
|
||||
List<Map<String, Object>> table = handle.select(String.format("SHOW tables LIKE '%s'", tableName));
|
||||
if (table.isEmpty()) {
|
||||
log.info("Creating table[%s]", tableName);
|
||||
handle.createStatement(sql).execute();
|
||||
} else {
|
||||
log.info("Table[%s] existed: [%s]", tableName, table);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.warn(e, "Exception creating table");
|
||||
}
|
||||
}
|
||||
|
||||
public void createSegmentTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TINYTEXT NOT NULL, "
|
||||
+ "start TINYTEXT NOT NULL, end TINYTEXT NOT NULL, partitioned BOOLEAN NOT NULL, version TINYTEXT NOT NULL, "
|
||||
+ "used BOOLEAN NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), INDEX(used), PRIMARY KEY (id))",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createRulesTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TINYTEXT NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), PRIMARY KEY (id))",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createConfigTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE table %s (name VARCHAR(255) NOT NULL, payload BLOB NOT NULL, PRIMARY KEY(name))",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE `%s` (\n"
|
||||
+ " `id` varchar(255) NOT NULL,\n"
|
||||
+ " `created_date` tinytext NOT NULL,\n"
|
||||
+ " `datasource` varchar(255) NOT NULL,\n"
|
||||
+ " `payload` longblob NOT NULL,\n"
|
||||
+ " `status_payload` longblob NOT NULL,\n"
|
||||
+ " `active` tinyint(1) NOT NULL DEFAULT '0',\n"
|
||||
+ " PRIMARY KEY (`id`),\n"
|
||||
+ " KEY (active, created_date(100))\n"
|
||||
+ ")",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskLogTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE `%s` (\n"
|
||||
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
||||
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
||||
+ " `log_payload` longblob,\n"
|
||||
+ " PRIMARY KEY (`id`),\n"
|
||||
+ " KEY `task_id` (`task_id`)\n"
|
||||
+ ")",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskLockTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE `%s` (\n"
|
||||
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
||||
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
||||
+ " `lock_payload` longblob,\n"
|
||||
+ " PRIMARY KEY (`id`),\n"
|
||||
+ " KEY `task_id` (`task_id`)\n"
|
||||
+ ")",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public String insertOrUpdateStatement(final String tableName, final String keyColumn, final String valueColumn)
|
||||
{
|
||||
return String.format(
|
||||
"INSERT INTO %1$s (%2$s, %3$s) VALUES (:key, :value) ON DUPLICATE KEY UPDATE %3$s = :value",
|
||||
tableName, keyColumn, valueColumn
|
||||
);
|
||||
}
|
||||
|
||||
public DBI getDBI() { return dbi; }
|
||||
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* 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.storage.mysql;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Provides;
|
||||
import io.druid.db.IndexerSQLMetadataStorageCoordinator;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataRuleManager;
|
||||
import io.druid.db.MetadataRuleManagerProvider;
|
||||
import io.druid.db.MetadataSegmentManager;
|
||||
import io.druid.db.MetadataSegmentManagerProvider;
|
||||
import io.druid.db.MetadataStorageConnector;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.MetadataSegmentPublisherProvider;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import io.druid.db.SQLMetadataStorageActionHandler;
|
||||
import io.druid.db.SQLMetadataRuleManager;
|
||||
import io.druid.db.SQLMetadataRuleManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentManager;
|
||||
import io.druid.db.SQLMetadataSegmentManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentPublisher;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.guice.PolyBind;
|
||||
import io.druid.indexer.MetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexer.SQLMetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.segment.realtime.DbSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import io.druid.storage.jdbc.mysql.MySQLConnector;
|
||||
import io.druid.storage.jdbc.postgresql.PostgreSQLConnector;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: change it to JDBC
|
||||
public class MySQLMetadataStorageModule implements DruidModule
|
||||
{
|
||||
@Override
|
||||
public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
bindMySQL(binder);
|
||||
bindPostgres(binder);
|
||||
JsonConfigProvider.bind(binder, "druid.db.tables", MetadataStorageTablesConfig.class);
|
||||
JsonConfigProvider.bind(binder, "druid.db.connector", MetadataStorageConnectorConfig.class);
|
||||
}
|
||||
|
||||
private void bindMySQL(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("mysql")
|
||||
.to(MySQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class))
|
||||
.addBinding("mysql")
|
||||
.to(MySQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManager.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManagerProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManager.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataRuleManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManagerProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataRuleManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(DbSegmentPublisher.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentPublisher.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentPublisherProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("mysql")
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
private void bindPostgres(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManager.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManagerProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManager.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataRuleManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManagerProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataRuleManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(DbSegmentPublisher.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentPublisher.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentPublisherProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("postgresql")
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
public IDBI getDbi(final SQLMetadataConnector dbConnector)
|
||||
{
|
||||
return dbConnector.getDBI();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.druid.extensions</groupId>
|
||||
<artifactId>druid-postgres-storage</artifactId>
|
||||
<name>druid-postgres-storage</name>
|
||||
<description>druid-postgres-storage</description>
|
||||
|
||||
<parent>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-common</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-server</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-indexing-hadoop</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-indexing-service</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdbi</groupId>
|
||||
<artifactId>jdbi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>10.7.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -17,13 +17,13 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.storage.jdbc.postgresql;
|
||||
package io.druid.storage.postgres;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.db.MetadataDbConnectorConfig;
|
||||
import io.druid.db.MetadataTablesConfig;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
|
@ -39,7 +39,7 @@ public class PostgreSQLConnector extends SQLMetadataConnector
|
|||
private final DBI dbi;
|
||||
|
||||
@Inject
|
||||
public PostgreSQLConnector(Supplier<MetadataDbConnectorConfig> config, Supplier<MetadataTablesConfig> dbTables)
|
||||
public PostgreSQLConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables)
|
||||
{
|
||||
super(config, dbTables);
|
||||
this.dbi = new DBI(getDatasource());
|
|
@ -17,40 +17,46 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.storage.jdbc.postgresql;
|
||||
package io.druid.storage.postgres;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Provides;
|
||||
import io.druid.db.IndexerSQLMetadataCoordinator;
|
||||
import io.druid.db.IndexerSQLMetadataStorageCoordinator;
|
||||
import io.druid.db.MetadataRuleManager;
|
||||
import io.druid.db.MetadataRuleManagerProvider;
|
||||
import io.druid.db.MetadataSegmentManager;
|
||||
import io.druid.db.MetadataSegmentManagerProvider;
|
||||
import io.druid.db.MetadataDbConnector;
|
||||
import io.druid.db.MetadataSegmentPublisherProvider;
|
||||
import io.druid.db.DerbyConnector;
|
||||
import io.druid.db.MetadataStorageConnector;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import io.druid.db.SQLMetadataRuleManager;
|
||||
import io.druid.db.SQLMetadataRuleManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentManager;
|
||||
import io.druid.db.SQLMetadataSegmentManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import io.druid.db.SQLMetadataStorageActionHandler;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.guice.PolyBind;
|
||||
import io.druid.indexing.overlord.IndexerMetadataCoordinator;
|
||||
import io.druid.indexer.MetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexer.SQLMetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.segment.realtime.DbSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PostgreSQLStorageDruidModule implements DruidModule
|
||||
public class PostgresMetadataStorageModule implements DruidModule
|
||||
{
|
||||
@Override
|
||||
public List<? extends Module> getJacksonModules()
|
||||
public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
@ -58,17 +64,18 @@ public class PostgreSQLStorageDruidModule implements DruidModule
|
|||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
bindDataBasePostgreSQL(binder);
|
||||
|
||||
// TODO: Change default to Derby
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataDbConnector.class), Key.get(DerbyConnector.class)
|
||||
);
|
||||
bindPostgres(binder);
|
||||
JsonConfigProvider.bind(binder, "druid.db.tables", MetadataStorageTablesConfig.class);
|
||||
JsonConfigProvider.bind(binder, "druid.db.connector", MetadataStorageConnectorConfig.class);
|
||||
}
|
||||
|
||||
private static void bindDataBasePostgreSQL(Binder binder)
|
||||
{
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataDbConnector.class))
|
||||
private void bindPostgres(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
@ -98,18 +105,24 @@ public class PostgreSQLStorageDruidModule implements DruidModule
|
|||
.to(SQLMetadataSegmentPublisher.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
// TODO: Bind DbActionHandler
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentPublisherProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
// TODO: Bind DbUpdaterJobHandler
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataCoordinator.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(IndexerSQLMetadataCoordinator.class)
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("postgresql")
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
|
@ -119,4 +132,4 @@ public class PostgreSQLStorageDruidModule implements DruidModule
|
|||
{
|
||||
return dbConnector.getDBI();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
io.druid.storage.postgres.PostgresMetadataStorageModule
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>druid</artifactId>
|
||||
<groupId>io.druid</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>postgres</artifactId>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* 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.storage.postgres;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
import org.skife.jdbi.v2.tweak.HandleCallback;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PostgreSQLConnector extends SQLMetadataConnector
|
||||
{
|
||||
private static final Logger log = new Logger(PostgreSQLConnector.class);
|
||||
private final DBI dbi;
|
||||
|
||||
@Inject
|
||||
public PostgreSQLConnector(Supplier<MetadataStorageConnectorConfig> config, Supplier<MetadataStorageTablesConfig> dbTables)
|
||||
{
|
||||
super(config, dbTables);
|
||||
this.dbi = new DBI(getDatasource());
|
||||
|
||||
}
|
||||
|
||||
public void createTable(final IDBI dbi, final String tableName, final String sql)
|
||||
{
|
||||
try {
|
||||
dbi.withHandle(
|
||||
new HandleCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void withHandle(Handle handle) throws Exception
|
||||
{
|
||||
List<Map<String, Object>> table = handle.select(String.format("SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public' AND tablename LIKE '%s'", tableName));
|
||||
if (table.isEmpty()) {
|
||||
log.info("Creating table[%s]", tableName);
|
||||
handle.createStatement(sql).execute();
|
||||
} else {
|
||||
log.info("Table[%s] existed: [%s]", tableName, table);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.warn(e, "Exception creating table");
|
||||
}
|
||||
}
|
||||
|
||||
public void createSegmentTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TEXT NOT NULL, "
|
||||
+ "start TEXT NOT NULL, \"end\" TEXT NOT NULL, partitioned SMALLINT NOT NULL, version TEXT NOT NULL, "
|
||||
+ "used BOOLEAN NOT NULL, payload bytea NOT NULL, PRIMARY KEY (id));" +
|
||||
"CREATE INDEX ON %1$s(dataSource);"+
|
||||
"CREATE INDEX ON %1$s(used);",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createRulesTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TEXT NOT NULL, payload bytea NOT NULL, PRIMARY KEY (id));"+
|
||||
"CREATE INDEX ON %1$s(dataSource);",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createConfigTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %s (name VARCHAR(255) NOT NULL, payload bytea NOT NULL, PRIMARY KEY(name))",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %1$s (\n"
|
||||
+ " id varchar(255) NOT NULL,\n"
|
||||
+ " created_date TEXT NOT NULL,\n"
|
||||
+ " datasource varchar(255) NOT NULL,\n"
|
||||
+ " payload bytea NOT NULL,\n"
|
||||
+ " status_payload bytea NOT NULL,\n"
|
||||
+ " active SMALLINT NOT NULL DEFAULT '0',\n"
|
||||
+ " PRIMARY KEY (id)\n"
|
||||
+ ");\n" +
|
||||
"CREATE INDEX ON %1$s(active, created_date);",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskLogTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %1$s (\n"
|
||||
+ " id bigserial NOT NULL,\n"
|
||||
+ " task_id varchar(255) DEFAULT NULL,\n"
|
||||
+ " log_payload bytea,\n"
|
||||
+ " PRIMARY KEY (id)\n"
|
||||
+ ");\n"+
|
||||
"CREATE INDEX ON %1$s(task_id);",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public void createTaskLockTable(final IDBI dbi, final String tableName)
|
||||
{
|
||||
createTable(
|
||||
dbi,
|
||||
tableName,
|
||||
String.format(
|
||||
"CREATE TABLE %1$s (\n"
|
||||
+ " id bigserial NOT NULL,\n"
|
||||
+ " task_id varchar(255) DEFAULT NULL,\n"
|
||||
+ " lock_payload bytea,\n"
|
||||
+ " PRIMARY KEY (id)\n"
|
||||
+ ");\n"+
|
||||
"CREATE INDEX ON %1$s(task_id);",
|
||||
tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public String insertOrUpdateStatement(final String tableName, final String keyColumn, final String valueColumn)
|
||||
{
|
||||
return String.format(
|
||||
"BEGIN;\n" +
|
||||
"LOCK TABLE %1$s IN SHARE ROW EXCLUSIVE MODE;\n" +
|
||||
"WITH upsert AS (UPDATE %1$s SET %3$s=:value WHERE %2$s=:key RETURNING *)\n" +
|
||||
" INSERT INTO %1$s (%2$s, %3$s) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)\n;" +
|
||||
"COMMIT;",
|
||||
tableName, keyColumn, valueColumn
|
||||
);
|
||||
}
|
||||
|
||||
public DBI getDBI() { return dbi; }
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* 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.storage.postgres;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Provides;
|
||||
import io.druid.db.IndexerSQLMetadataStorageCoordinator;
|
||||
import io.druid.db.MetadataStorageConnectorConfig;
|
||||
import io.druid.db.MetadataRuleManager;
|
||||
import io.druid.db.MetadataRuleManagerProvider;
|
||||
import io.druid.db.MetadataSegmentManager;
|
||||
import io.druid.db.MetadataSegmentManagerProvider;
|
||||
import io.druid.db.MetadataStorageConnector;
|
||||
import io.druid.db.MetadataStorageTablesConfig;
|
||||
import io.druid.db.MetadataSegmentPublisherProvider;
|
||||
import io.druid.db.SQLMetadataConnector;
|
||||
import io.druid.db.SQLMetadataStorageActionHandler;
|
||||
import io.druid.db.SQLMetadataRuleManager;
|
||||
import io.druid.db.SQLMetadataRuleManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentManager;
|
||||
import io.druid.db.SQLMetadataSegmentManagerProvider;
|
||||
import io.druid.db.SQLMetadataSegmentPublisher;
|
||||
import io.druid.guice.JsonConfigProvider;
|
||||
import io.druid.guice.LazySingleton;
|
||||
import io.druid.guice.PolyBind;
|
||||
import io.druid.indexer.MetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexer.SQLMetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.segment.realtime.DbSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import io.druid.storage.jdbc.mysql.MySQLConnector;
|
||||
import io.druid.storage.jdbc.postgresql.PostgreSQLConnector;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: change it to JDBC
|
||||
public class PostgresMetadataStorageModule implements DruidModule
|
||||
{
|
||||
@Override
|
||||
public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
bindMySQL(binder);
|
||||
bindPostgres(binder);
|
||||
JsonConfigProvider.bind(binder, "druid.db.tables", MetadataStorageTablesConfig.class);
|
||||
JsonConfigProvider.bind(binder, "druid.db.connector", MetadataStorageConnectorConfig.class);
|
||||
}
|
||||
|
||||
private void bindMySQL(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("mysql")
|
||||
.to(MySQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManager.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManagerProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManager.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataRuleManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManagerProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataRuleManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(DbSegmentPublisher.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentPublisher.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentPublisherProvider.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("mysql")
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("mysql")
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
private void bindPostgres(Binder binder) {
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class))
|
||||
.addBinding("postgresql")
|
||||
.to(PostgreSQLConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManager.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentManagerProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManager.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataRuleManager.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataRuleManagerProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataRuleManagerProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(DbSegmentPublisher.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentPublisher.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataSegmentPublisherProvider.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("postgresql")
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("postgresql")
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
public IDBI getDbi(final SQLMetadataConnector dbConnector)
|
||||
{
|
||||
return dbConnector.getDBI();
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ import com.google.common.collect.Ordering;
|
|||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.logger.Logger;
|
||||
import io.druid.indexing.overlord.IndexerMetadataCoordinator;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.timeline.DataSegment;
|
||||
import io.druid.timeline.TimelineObjectHolder;
|
||||
import io.druid.timeline.VersionedIntervalTimeline;
|
||||
|
@ -52,18 +52,18 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class IndexerSQLMetadataCoordinator implements IndexerMetadataCoordinator
|
||||
public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStorageCoordinator
|
||||
{
|
||||
private static final Logger log = new Logger(IndexerSQLMetadataCoordinator.class);
|
||||
private static final Logger log = new Logger(IndexerSQLMetadataStorageCoordinator.class);
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
private final MetadataTablesConfig dbTables;
|
||||
private final MetadataStorageTablesConfig dbTables;
|
||||
private final IDBI dbi;
|
||||
|
||||
@Inject
|
||||
public IndexerSQLMetadataCoordinator(
|
||||
public IndexerSQLMetadataStorageCoordinator(
|
||||
ObjectMapper jsonMapper,
|
||||
MetadataTablesConfig dbTables,
|
||||
MetadataStorageTablesConfig dbTables,
|
||||
IDBI dbi
|
||||
)
|
||||
{
|
|
@ -20,12 +20,11 @@
|
|||
package io.druid.db;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.inject.Inject;
|
||||
import com.metamx.common.RetryUtils;
|
||||
import com.mysql.jdbc.exceptions.MySQLTransientException;
|
||||
import io.druid.indexing.overlord.MetadataActionHandler;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
import org.skife.jdbi.v2.exceptions.CallbackFailedException;
|
||||
|
@ -41,12 +40,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class SQLMetadataActionHandler implements MetadataActionHandler
|
||||
public class SQLMetadataStorageActionHandler implements MetadataStorageActionHandler
|
||||
{
|
||||
private final IDBI dbi;
|
||||
|
||||
@Inject
|
||||
public SQLMetadataActionHandler(final IDBI dbi)
|
||||
public SQLMetadataStorageActionHandler(final IDBI dbi)
|
||||
{
|
||||
this.dbi = dbi;
|
||||
}
|
|
@ -27,25 +27,25 @@ import io.druid.db.DerbyMetadataRuleManager;
|
|||
import io.druid.db.DerbyMetadataRuleManagerProvider;
|
||||
import io.druid.db.DerbyMetadataSegmentManager;
|
||||
import io.druid.db.DerbyMetadataSegmentManagerProvider;
|
||||
import io.druid.db.IndexerSQLMetadataCoordinator;
|
||||
import io.druid.db.IndexerSQLMetadataStorageCoordinator;
|
||||
import io.druid.db.MetadataRuleManager;
|
||||
import io.druid.db.MetadataSegmentManager;
|
||||
import io.druid.db.MetadataSegmentManagerProvider;
|
||||
import io.druid.db.MetadataDbConnector;
|
||||
import io.druid.db.MetadataStorageConnector;
|
||||
import io.druid.db.MetadataSegmentPublisherProvider;
|
||||
import io.druid.db.MetadataRuleManagerProvider;
|
||||
import io.druid.db.DerbyConnector;
|
||||
import io.druid.db.SQLMetadataActionHandler;
|
||||
import io.druid.db.SQLMetadataStorageActionHandler;
|
||||
import io.druid.db.SQLMetadataSegmentPublisher;
|
||||
import io.druid.db.SQLMetadataSegmentPublisherProvider;
|
||||
import io.druid.indexer.SQLMetadataUpdaterJobHandler;
|
||||
import io.druid.indexer.MetadataUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataActionHandler;
|
||||
import io.druid.indexer.SQLMetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexer.MetadataStorageUpdaterJobHandler;
|
||||
import io.druid.indexing.overlord.IndexerMetadataStorageCoordinator;
|
||||
import io.druid.indexing.overlord.MetadataStorageActionHandler;
|
||||
import io.druid.segment.realtime.DbSegmentPublisher;
|
||||
import org.skife.jdbi.v2.IDBI;
|
||||
|
||||
public class DerbyStorageDruidModule implements Module
|
||||
public class DerbyMetadataStorageDruidModule implements Module
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,7 @@ public class DerbyStorageDruidModule implements Module
|
|||
{
|
||||
bindDataBaseDerby(binder);
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataDbConnector.class), Key.get(DerbyConnector.class)
|
||||
binder, "druid.db.type", Key.get(MetadataStorageConnector.class), Key.get(DerbyConnector.class)
|
||||
);
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataSegmentManager.class), Key.get(DerbyMetadataSegmentManager.class)
|
||||
|
@ -74,20 +74,20 @@ public class DerbyStorageDruidModule implements Module
|
|||
binder, "druid.db.type", Key.get(MetadataSegmentPublisherProvider.class), Key.get(SQLMetadataSegmentPublisherProvider.class)
|
||||
);
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(IndexerMetadataCoordinator.class), Key.get(IndexerSQLMetadataCoordinator.class)
|
||||
binder, "druid.db.type", Key.get(IndexerMetadataStorageCoordinator.class), Key.get(IndexerSQLMetadataStorageCoordinator.class)
|
||||
);
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataActionHandler.class), Key.get(SQLMetadataActionHandler.class)
|
||||
binder, "druid.db.type", Key.get(MetadataStorageActionHandler.class), Key.get(SQLMetadataStorageActionHandler.class)
|
||||
);
|
||||
PolyBind.createChoice(
|
||||
binder, "druid.db.type", Key.get(MetadataUpdaterJobHandler.class), Key.get(SQLMetadataUpdaterJobHandler.class)
|
||||
binder, "druid.db.type", Key.get(MetadataStorageUpdaterJobHandler.class), Key.get(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private static void bindDataBaseDerby(Binder binder)
|
||||
{
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataDbConnector.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class))
|
||||
.addBinding("derby")
|
||||
.to(DerbyConnector.class)
|
||||
.in(LazySingleton.class);
|
||||
|
@ -122,19 +122,19 @@ public class DerbyStorageDruidModule implements Module
|
|||
.to(SQLMetadataSegmentPublisherProvider.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataCoordinator.class))
|
||||
PolyBind.optionBinder(binder, Key.get(IndexerMetadataStorageCoordinator.class))
|
||||
.addBinding("derby")
|
||||
.to(IndexerSQLMetadataCoordinator.class)
|
||||
.to(IndexerSQLMetadataStorageCoordinator.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataActionHandler.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandler.class))
|
||||
.addBinding("derby")
|
||||
.to(SQLMetadataActionHandler.class)
|
||||
.to(SQLMetadataStorageActionHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataUpdaterJobHandler.class))
|
||||
PolyBind.optionBinder(binder, Key.get(MetadataStorageUpdaterJobHandler.class))
|
||||
.addBinding("derby")
|
||||
.to(SQLMetadataUpdaterJobHandler.class)
|
||||
.to(SQLMetadataStorageUpdaterJobHandler.class)
|
||||
.in(LazySingleton.class);
|
||||
|
||||
}
|
|
@ -33,13 +33,13 @@ import com.google.common.collect.ImmutableMap;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SQLMetadataUpdaterJobHandler implements MetadataUpdaterJobHandler
|
||||
public class SQLMetadataStorageUpdaterJobHandler implements MetadataStorageUpdaterJobHandler
|
||||
{
|
||||
private static final Logger log = new Logger(SQLMetadataUpdaterJobHandler.class);
|
||||
private static final Logger log = new Logger(SQLMetadataStorageUpdaterJobHandler.class);
|
||||
private final IDBI dbi;
|
||||
|
||||
@Inject
|
||||
public SQLMetadataUpdaterJobHandler(IDBI dbi)
|
||||
public SQLMetadataStorageUpdaterJobHandler(IDBI dbi)
|
||||
{
|
||||
this.dbi = dbi;
|
||||
}
|
Loading…
Reference in New Issue