Fix inconsistent druid property names for "druid.metadata.storage.tables.xxx" between document and code

This commit is contained in:
Bingkun Guo 2015-06-26 15:35:43 -05:00
parent 0c85c8c60a
commit 4a0ae7d8d5
6 changed files with 100 additions and 10 deletions

View File

@ -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|

View File

@ -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)
);
}
}

View File

@ -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

View File

@ -21,6 +21,6 @@ import org.skife.config.Config;
public abstract class DbSegmentPublisherConfig
{
@Config("druid.metadata.storage.tables.segmentTable")
@Config("druid.metadata.storage.tables.segments")
public abstract String getSegmentTable();
}

View File

@ -72,9 +72,9 @@ public class ConvertProperties implements Runnable
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"),

View File

@ -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