Skip to content

Commit

Permalink
Merge pull request #1469 from guobingkun/table_config
Browse files Browse the repository at this point in the history
Inconsistent property names for "druid.metadata.storage.tables.xxx"
  • Loading branch information
fjy committed Jul 17, 2015
2 parents 19af3bc + 4a0ae7d commit e21195f
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/content/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ These properties specify the jdbc connection and other configuration around the
|`druid.metadata.storage.connector.password`|The password to connect with.|none|
|`druid.metadata.storage.connector.createTables`|If Druid requires a table and it doesn't exist, create it?|true|
|`druid.metadata.storage.tables.base`|The base name for tables.|druid|
|`druid.metadata.storage.tables.segmentTable`|The table to use to look for segments.|druid_segments|
|`druid.metadata.storage.tables.ruleTable`|The table to use to look for segment load/drop rules.|druid_rules|
|`druid.metadata.storage.tables.configTable`|The table to use to look for configs.|druid_config|
|`druid.metadata.storage.tables.segments`|The table to use to look for segments.|druid_segments|
|`druid.metadata.storage.tables.rules`|The table to use to look for segment load/drop rules.|druid_rules|
|`druid.metadata.storage.tables.config`|The table to use to look for configs.|druid_config|
|`druid.metadata.storage.tables.tasks`|Used by the indexing service to store tasks.|druid_tasks|
|`druid.metadata.storage.tables.taskLog`|Used by the indexing service to store task logs.|druid_taskLog|
|`druid.metadata.storage.tables.taskLock`|Used by the indexing service to store task locks.|druid_taskLock|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.druid.guice;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Provides;
import io.druid.jackson.DefaultObjectMapper;
import io.druid.metadata.MetadataStorageTablesConfig;
import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;
import java.util.Properties;

public class MetadataStorageTablesConfigTest
{
@Test
public void testSerdeMetadataStorageTablesConfig() throws Exception
{
Injector injector = Guice.createInjector(
new Module()
{
@Override
public void configure(Binder binder)
{
binder.install(new PropertiesModule(Arrays.asList("test.runtime.properties")));
binder.install(new ConfigModule());
binder.install(new DruidGuiceExtensions());
JsonConfigProvider.bind(binder, "druid.metadata.storage.tables", MetadataStorageTablesConfig.class);
}

@Provides
@LazySingleton
public ObjectMapper jsonMapper()
{
return new DefaultObjectMapper();
}
}
);

Properties props = injector.getInstance(Properties.class);
MetadataStorageTablesConfig config = injector.getInstance(MetadataStorageTablesConfig.class);

Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.base"), config.getBase());
Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.segments"), config.getSegmentsTable());
Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.rules"), config.getRulesTable());
Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.config"), config.getConfigTable());
Assert.assertEquals(
props.getProperty("druid.metadata.storage.tables.tasks"),
config.getEntryTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE)
);
Assert.assertEquals(
props.getProperty("druid.metadata.storage.tables.taskLog"),
config.getLogTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE)
);
Assert.assertEquals(
props.getProperty("druid.metadata.storage.tables.taskLock"),
config.getLockTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE)
);
}
}
8 changes: 8 additions & 0 deletions processing/src/test/resources/test.runtime.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
druid.metadata.storage.tables.base=druid
druid.metadata.storage.tables.segments=aaa_segments
druid.metadata.storage.tables.rules=bbb_rules
druid.metadata.storage.tables.config=ccc_config
druid.metadata.storage.tables.tasks=ddd_tasks
druid.metadata.storage.tables.taskLog=eee_tasklog
druid.metadata.storage.tables.taskLock=fff_tasklock
druid.metadata.storage.tables.audit=ggg_audit
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

public abstract class DbSegmentPublisherConfig
{
@Config("druid.metadata.storage.tables.segmentTable")
@Config("druid.metadata.storage.tables.segments")
public abstract String getSegmentTable();
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private static String parseJdbcUrl(String jdbcUrl){
new Remove("druid.db.connector.useValidationQuery"),
new Rename("druid.db.connector.createTables", "druid.metadata.storage.connector.createTables"),
new Rename("druid.db.tables.base", "druid.metadata.storage.tables.base"),
new Rename("druid.db.tables.configTable", "druid.metadata.storage.tables.configTable"),
new Rename("druid.db.tables.segmentTable", "druid.metadata.storage.tables.segmentTable"),
new Rename("druid.db.tables.ruleTable", "druid.metadata.storage.tables.ruleTable"),
new Rename("druid.db.tables.configTable", "druid.metadata.storage.tables.config"),
new Rename("druid.db.tables.segmentTable", "druid.metadata.storage.tables.segments"),
new Rename("druid.db.tables.ruleTable", "druid.metadata.storage.tables.rules"),
new Rename("druid.db.tables.taskLock", "druid.metadata.storage.tables.taskLock"),
new Rename("druid.db.tables.tasks", "druid.metadata.storage.tables.tasks"),
new Rename("druid.db.tables.taskLog", "druid.metadata.storage.tables.taskLog"),
Expand Down
6 changes: 3 additions & 3 deletions services/src/test/resources/convertProps/new.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ druid.metadata.storage.connector.password=diurd
druid.metadata.storage.connector.user=druid

druid.metadata.storage.tables.base=druid
druid.metadata.storage.tables.segmentTable=druid_segments
druid.metadata.storage.tables.ruleTable=druid_rules
druid.metadata.storage.tables.configTable=druid_config
druid.metadata.storage.tables.segments=druid_segments
druid.metadata.storage.tables.rules=druid_rules
druid.metadata.storage.tables.config=druid_config
druid.metadata.storage.tables.tasks=druid_tasks
druid.metadata.storage.tables.taskLog=druid_taskLog
druid.metadata.storage.tables.taskLock=druid_taskLock
Expand Down

0 comments on commit e21195f

Please sign in to comment.