@Singleton public class DataSourceMetadataLoadTask extends LoadTask<Boolean>
DataSourceMetadataService.
Note that this uses the segmentMetadata query that touches the coordinator.
LoadTask.TaskFailureCallback| Modifier and Type | Field and Description |
|---|---|
static String |
DATASOURCE_METADATA_QUERY_FORMAT |
static String |
DRUID_SEG_LOADER_TIMER_DELAY_KEY
Parameter specifying the delay before the first run of the segment metadata loader, in milliseconds.
|
static String |
DRUID_SEG_LOADER_TIMER_DURATION_KEY
Parameter specifying the period of the segment metadata loader, in milliseconds.
|
delay, future, isPeriodic, loaderName, period| Constructor and Description |
|---|
DataSourceMetadataLoadTask(PhysicalTableDictionary physicalTableDictionary,
DataSourceMetadataService metadataService,
DruidWebService druidWebService,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Datasource metadata loader fetches data from the druid coordinator and updates the datasource metadata service.
|
| Modifier and Type | Method and Description |
|---|---|
protected SuccessCallback |
buildDataSourceMetadataSuccessCallback(DataSourceName dataSourceName)
Callback to parse druid datasource metadata response.
|
protected SuccessCallback |
buildDataSourceMetadataSuccessCallback(SingleDataSourcePhysicalTable table)
Deprecated.
Pass the DataSourceName directly, rather than via the PhysicalTable
|
protected HttpErrorCallback |
getErrorCallback(DataSourceName dataSourceName)
Get a default callback for an http error.
|
protected HttpErrorCallback |
getErrorCallback(SingleDataSourcePhysicalTable table)
Deprecated.
Pass the DataSourceName directly, rather than via the PhysicalTable
|
org.joda.time.DateTime |
getLastRunTimestamp()
Return when this loader ran most recently.
|
protected void |
queryDataSourceMetadata(DataSourceName dataSourceName)
Queries Druid for updated datasource metadata and then updates the datasource metadata service.
|
protected void |
queryDataSourceMetadata(SingleDataSourcePhysicalTable table)
Deprecated.
Pass the DataSourceName directly, rather than via the PhysicalTable
|
void |
run() |
getDefinedDelay, getDefinedPeriod, getErrorCallback, getFailureCallback, getFuture, getName, isPeriodic, toStringpublic static final String DATASOURCE_METADATA_QUERY_FORMAT
public static final String DRUID_SEG_LOADER_TIMER_DURATION_KEY
public static final String DRUID_SEG_LOADER_TIMER_DELAY_KEY
public DataSourceMetadataLoadTask(PhysicalTableDictionary physicalTableDictionary, DataSourceMetadataService metadataService, DruidWebService druidWebService, com.fasterxml.jackson.databind.ObjectMapper mapper)
physicalTableDictionary - The physical tables with data sources to updatemetadataService - The service that will store the metadata loaded by this loaderdruidWebService - The druid webservice to querymapper - Object mapper to parse druid metadatapublic void run()
@Deprecated protected void queryDataSourceMetadata(SingleDataSourcePhysicalTable table)
table - The physical table to be updated.protected void queryDataSourceMetadata(DataSourceName dataSourceName)
dataSourceName - The data source to be updated.@Deprecated protected final SuccessCallback buildDataSourceMetadataSuccessCallback(SingleDataSourcePhysicalTable table)
Typical druid datasource metadata response:
"""
{
"name": "tableName",
"properties": { },
"segments": [
{
"dataSource": "tableName",
"interval": "2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z",
"version": "2015-01-15T18:08:20.435Z",
"loadSpec": {
"type": "hdfs",
"path": "hdfs:/some_hdfs_URL/tableName/.../index.zip"
},
"dimensions": "color", "shape",
"metrics": "height", "width",
"shardSpec": {
"type":"hashed",
"partitionNum": 0,
"partitions": 2
},
"binaryVersion":9,
"size":1024,
"identifier":"tableName_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-02-15T18:08:20.435Z"
},
{
"dataSource": "tableName",
"interval": "2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z",
"version": "2015-02-01T07:02:05.912Z",
"loadSpec": {
"type": "hdfs",
"path": "hdfs:/some_hdfs_URL/tableName/.../index.zip"
},
"dimensions": "color", "shape",
"metrics": "height", "width",
"shardSpec": {
"type":"hashed",
"partitionNum": 1,
"partitions": 2
},
"binaryVersion":9,
"size":512,
"identifier":"tableName_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-02-01T07:02:05.912Z"
}
]
}"""
table - The table to inject into this callback.protected SuccessCallback buildDataSourceMetadataSuccessCallback(DataSourceName dataSourceName)
Typical druid datasource metadata response:
"""
{
"name": "tableName",
"properties": { },
"segments": [
{
"dataSource": "tableName",
"interval": "2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z",
"version": "2015-01-15T18:08:20.435Z",
"loadSpec": {
"type": "hdfs",
"path": "hdfs:/some_hdfs_URL/tableName/.../index.zip"
},
"dimensions": "color", "shape",
"metrics": "height", "width",
"shardSpec": {
"type":"hashed",
"partitionNum": 0,
"partitions": 2
},
"binaryVersion":9,
"size":1024,
"identifier":"tableName_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-02-15T18:08:20.435Z"
},
{
"dataSource": "tableName",
"interval": "2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z",
"version": "2015-02-01T07:02:05.912Z",
"loadSpec": {
"type": "hdfs",
"path": "hdfs:/some_hdfs_URL/tableName/.../index.zip"
},
"dimensions": "color", "shape",
"metrics": "height", "width",
"shardSpec": {
"type":"hashed",
"partitionNum": 1,
"partitions": 2
},
"binaryVersion":9,
"size":512,
"identifier":"tableName_2015-01-01T00:00:00.000Z_2015-01-02T00:00:00.000Z_2015-02-01T07:02:05.912Z"
}
]
}"""
dataSourceName - The datasource name to inject into this callback.public org.joda.time.DateTime getLastRunTimestamp()
@Deprecated protected HttpErrorCallback getErrorCallback(SingleDataSourcePhysicalTable table)
table - The PhysicalTable that the error callback will relate to.protected HttpErrorCallback getErrorCallback(DataSourceName dataSourceName)
dataSourceName - The data source that the error callback will relate to.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.