Inspect view load status
View update in Druid is not atomic. This API provides a summary of the freshness of a view definition across the cluster for a single view. You can use this API to check that a view is available and current before you issue queries against it. To ensure all brokers are up to date and using the most recent view definition, each broker should have "fresh" status. See Sample responses.
The API response contains five lists which represent the freshness of the view definition on the Broker compared to the view definition on the Coordinator. Each list contains the hostnames and ports of Brokers in the cluster organized with the corresponding state of freshness as follows:
fresh
: the Broker view definition has the same modification time as the view definition on the Coordinator.stale
: the Broker view definition is older than the view definition on the Coordinator.newer
: the Broker view definition is more recent than view definition on the Coordinator. This could occur when the view definition changes while the API is processing load status. The API may register an older timestamp for the Coordinator view definition, but register the later timestamp for the Broker view definition.unknown
: Brokers with undeterminable view definition version. For example if network errors prevent communication with the Broker.absent
: Brokers have not yet loaded a view definition.
URL
GET /druid-ext/view-manager/v1/views/loadstatus/{view name}
Required resource
The create view API requires the following resource:
{view name}
:The name of the view for which you're checking load status
Success response
Code | Example Body |
---|---|
200 OK | See Sample responses |
Selected error responses
Code | Example Body |
---|---|
404 Not Found | {"error": "View[nonexistent] not found."} |
Sample request
curl --location --request POST 'http://localhost:8081/druid-ext/view-manager/v1/views/english' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic <encoded authorization string>' \
--data-raw '{
"viewSql": "SELECT __time, added, channel, page FROM druid.wikipedia WHERE channel = '\''#en.wikipedia'\''"
}'
Sample responses
The following example demonstrates all brokers with "fresh" status:
{
"fresh": [
"broker01:8082", "broker02:8082", "broker03:8082", "broker04:8082", "broker05:8082"
],
"stale": [],
"newer": [],
"unknown": [],
"absent": []
}
The following example demonstrates one broker with each available status:
{
"fresh": [
"broker01:8082"
],
"stale": [
"broker02:8082"
],
"newer": [
"broker03:8082"
],
"unknown": [
"broker04:8082"
],
"absent": [
"broker05:8082"
]
}
Learn more
See the following topics for more information:
- View Manager APIs for a full list of View Manager APIs and links to examples.
- Row and column level security to learn how to use views to secure data.
- View Manager for a description of the Imply View Manager.