Skip to content

Separate Warehouse for On-Demand Tasks for Databricks Unity Catalog

Run the connector's on-demand work on its own Databricks SQL warehouse, so that latency-sensitive on-demand access changes are not slowed by the connector's bulk work (the scheduled resource reconcile and the permission sync) running on the same warehouse.

Note

This feature is for the connector managing permissions over JDBC (the default). When the connector uses the Databricks API to manage permissions, grants and loads go through the API and are not routed; the on-demand warehouse is then used only for the SQL the connector still runs over JDBC for an on-demand sync, such as row-filter and masking DDL when those features are enabled.

Overview

By default the connector uses one warehouse, set by jdbc.url, for all of its work. During a reconcile window, on-demand grant and revoke response time can climb because on-demand statements queue behind the bulk work, both in the connection pool and in the warehouse.

With this feature you set a second warehouse URL for on-demand work. The connector builds a separate connection pool for it and runs on that warehouse:

  • the event-driven (on-demand) resource and permission sync, and
  • the grants, revokes and row-filter / masking DDL that the on-demand sync applies.

Everything else keeps using jdbc.url: the scheduled resource reconcile, the permission sync, policy and principal changes, and SQL audit loading. When the on-demand URL is not set, the connector behaves exactly as before (a single pool on jdbc.url).

Configuration properties

All properties are optional and empty by default.

Property Description Default
CONNECTOR_DATABRICKS_UNITY_CATALOG_JDBC_URL_ON_DEMAND JDBC URL of the warehouse for on-demand work. (unset — uses jdbc.url)
CONNECTOR_DATABRICKS_UNITY_CATALOG_JDBC_URL_ON_DEMAND_MAX_POOL_SIZE Maximum pool size for the on-demand pool. (unset — uses the global pool size)
CONNECTOR_DATABRICKS_UNITY_CATALOG_JDBC_URL_ON_DEMAND_MIN_IDLE_CONNECTION Minimum idle connections for the on-demand pool. A dedicated warehouse defaults this to 0 so it can auto-stop. (unset — 0)
CONNECTOR_DATABRICKS_UNITY_CATALOG_JDBC_PURPOSE_POOL_UNAVAILABLE_RECHECK_MS How long the on-demand pool fails fast before it rechecks a warehouse that was unreachable. (unset — 5000)

Matching custom properties (Portal and PrivaceraCloud):

Custom property Default
ranger.policysync.connector.0.jdbc.url.on_demand (unset)
ranger.policysync.connector.0.jdbc.url.on_demand.maximum.pool.size (unset)
ranger.policysync.connector.0.jdbc.url.on_demand.min.idle.connection (unset)
ranger.policysync.connector.0.jdbc.purpose.pool.unavailable.recheck.ms 5000
ranger.policysync.connector.0.jdbc.purpose.pool.load.wait.ms 120000

jdbc.purpose.pool.load.wait.ms is how long an on-demand permission load waits for the on-demand warehouse when it is briefly unreachable, before the load fails. 0 fails at once.

Example

Give on-demand work its own warehouse while everything else keeps using jdbc.url:

YAML
CONNECTOR_DATABRICKS_UNITY_CATALOG_JDBC_URL_ON_DEMAND: "jdbc:databricks://<workspace-host>:443/default;transportMode=http;ssl=1;AuthMech=3;httpPath=/sql/1.0/warehouses/<on-demand-warehouse-id>;"

The URL uses the same format and the same credentials as jdbc.url; it differs only in the httpPath warehouse id. At startup the connector checks that the on-demand warehouse reaches the same Unity Catalog metastore as jdbc.url, and uses it only if it does.

Verify routing from the audit

When the on-demand warehouse is configured, each grant's access audit records which warehouse ran it in extraInfo.jdbc.warehouse (the warehouse id from the httpPath). On-demand grants show the on-demand warehouse id; everything else shows the default warehouse id. When it is not configured, this field is not added, so existing audits are unchanged.

The on-demand warehouse must be serverless or always on

Use a serverless or always-on warehouse for on-demand work. A cold, auto-stopped classic warehouse adds start-up latency to the first statement, and the GRANT / DESCRIBE statement timeouts are shared with the default pool, so a cold start can fail the first grant or load a foreign table without its columns.

No fallback to the default warehouse

When the on-demand warehouse is unreachable, on-demand grants fail at once and are recorded as FAILED in the audit; an on-demand permission load first waits up to jdbc.purpose.pool.load.wait.ms (default 120 s) and then fails. The connector does not fall back to the default warehouse, so on-demand revokes are delayed until the warehouse recovers or the next scheduled sync.

Alert on the ps.core.jdbc.purpose.pool.state{pool} gauge being below 1 (1 verified, 0 not verified or unreachable, -1 disabled for a metastore mismatch): it stays below 1 for as long as the warehouse is unusable. The ps.core.jdbc.purpose.pool.unavailable counter goes up once per outage, not once per failed statement, so an alert on it alone fires once and clears while on-demand grants keep failing.