mirror of https://github.com/apache/druid.git
Merge pull request #2548 from metamx/moreLoggingJDBCNamespace
More logging for JDBCExtractionNamespaceFunctionFactory
This commit is contained in:
commit
3691fbd849
|
@ -25,6 +25,7 @@ import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.metamx.common.Pair;
|
import com.metamx.common.Pair;
|
||||||
|
import com.metamx.common.logger.Logger;
|
||||||
import io.druid.common.utils.JodaUtils;
|
import io.druid.common.utils.JodaUtils;
|
||||||
import io.druid.query.extraction.namespace.ExtractionNamespaceFunctionFactory;
|
import io.druid.query.extraction.namespace.ExtractionNamespaceFunctionFactory;
|
||||||
import io.druid.query.extraction.namespace.JDBCExtractionNamespace;
|
import io.druid.query.extraction.namespace.JDBCExtractionNamespace;
|
||||||
|
@ -51,6 +52,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
public class JDBCExtractionNamespaceFunctionFactory
|
public class JDBCExtractionNamespaceFunctionFactory
|
||||||
implements ExtractionNamespaceFunctionFactory<JDBCExtractionNamespace>
|
implements ExtractionNamespaceFunctionFactory<JDBCExtractionNamespace>
|
||||||
{
|
{
|
||||||
|
private static final Logger LOG = new Logger(JDBCExtractionNamespaceFunctionFactory.class);
|
||||||
private final ConcurrentMap<String, DBI> dbiCache = new ConcurrentHashMap<>();
|
private final ConcurrentMap<String, DBI> dbiCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,6 +123,7 @@ public class JDBCExtractionNamespaceFunctionFactory
|
||||||
final String valueColumn = namespace.getValueColumn();
|
final String valueColumn = namespace.getValueColumn();
|
||||||
final String keyColumn = namespace.getKeyColumn();
|
final String keyColumn = namespace.getKeyColumn();
|
||||||
|
|
||||||
|
LOG.debug("Updating [%s]", namespace.getNamespace());
|
||||||
final List<Pair<String, String>> pairs = dbi.withHandle(
|
final List<Pair<String, String>> pairs = dbi.withHandle(
|
||||||
new HandleCallback<List<Pair<String, String>>>()
|
new HandleCallback<List<Pair<String, String>>>()
|
||||||
{
|
{
|
||||||
|
@ -158,6 +161,7 @@ public class JDBCExtractionNamespaceFunctionFactory
|
||||||
for (Pair<String, String> pair : pairs) {
|
for (Pair<String, String> pair : pairs) {
|
||||||
cache.put(pair.lhs, pair.rhs);
|
cache.put(pair.lhs, pair.rhs);
|
||||||
}
|
}
|
||||||
|
LOG.info("Finished loading %d values for namespace[%s]", cache.size(), namespace.getNamespace());
|
||||||
return String.format("%d", System.currentTimeMillis());
|
return String.format("%d", System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue