Skip to content

Dedicated Changelog Queue for Policy Changes – Lake Formation Connector

Configure the Lake Formation connector to process policy changes on their own queue, so a policy change is applied without waiting behind a long permission reconcile or resource sync.

Overview

By default, the connector processes every offline changelog (policy changes, principal changes, resource syncs and permission reconciles) one after another on a single queue. A policy change that arrives while a long SERVICE_PERMISSIONS reconcile is running waits until that reconcile finishes.

When the dedicated changelog queue is enabled:

  • Policy changes (RANGER_POLICIES) and, optionally, principal changes (RANGER_PRINCIPALS) go to a separate fast queue with its own processing thread and worker pool.
  • Resource syncs, reconciles, role, GDS and user-store changes stay on the offline queue and run in parallel with the fast queue.
  • Grants and revokes from the fast and offline queues on the same AWS account are serialized by a shared per-account lock, so the two queues never call BatchGrantPermissions or BatchRevokePermissions on the same account at the same time. Grants for different accounts run in parallel. The account is taken from the IAM role ARN of the grantee; for users, groups and other principals it falls back to the catalog ID.
  • On-demand access requests (ops-server tasks) keep their own lock, so they are not queued behind the fast or offline queue.
  • When a reconcile finds a resource out of sync that a policy change also touches, the resource is re-applied on the fast queue with the latest policies, not on the offline queue.

Use this when policy changes must reach Lake Formation quickly in an environment with long-running reconciles, for example when grants on a federated catalog retry for a long time.

Same-account changes can still wait for the lock

The per-account lock is held while one apply sends its grants (or revokes) for that account, in AWS batch calls of up to 20 entries each, including their AWS retries. A policy change no longer waits for the whole reconcile, but it can still wait for the offline apply that holds the lock for the same account. For each additional account, a grant runs without waiting.

Prerequisites

The per-account lock that keeps the two queues apart only runs in batch mode with serialization by account. Enable both before you enable the dedicated queue:

Warning

If the dedicated queue is enabled without these two properties, the fast and offline queues can grant and revoke on the same AWS account at the same time. Always set all three properties together.

The connector does not check these two properties. If either is off, it starts normally and logs no warning, but the per-account lock is skipped. Confirm both after setup (see Verify the configuration).

Configuration properties

Property Description Default Allowed values
CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_ENABLED Processes the changelog types below on a dedicated queue and thread. When false, all changelogs share the offline queue. false true, false
CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_CHANGELOG_TYPES Comma-separated changelog types routed to the dedicated queue when it is enabled. RANGER_POLICIES is always included, and RANGER_PRINCIPALS is the only other supported value; any other value is logged and ignored. RANGER_POLICIES RANGER_POLICIES, RANGER_PRINCIPALS
CONNECTOR_LAKEFORMATION_RESOURCE_PROCESS_THREAD_MIN_FAST Worker threads of the fast queue that normally run. Empty uses the same size as the offline queue. Empty (5; thread pool V2: 3) Positive integer
CONNECTOR_LAKEFORMATION_RESOURCE_PROCESS_THREAD_MAX_FAST Maximum worker threads of the fast queue in total, used while its task queue is full. Empty uses the same size as the offline queue. Empty (10; thread pool V2: 10) Positive integer, at least the minimum

Matching connector properties:

Connector property Default
ranger.policysync.connector.0.dedicated.queue.enabled false
ranger.policysync.connector.0.dedicated.queue.changelog.types RANGER_POLICIES
ranger.policysync.connector.0.resource.process.thread.min.fast Not set
ranger.policysync.connector.0.resource.process.thread.max.fast Not set

Sizing the fast queue

Grants on the same AWS account run one at a time across the fast and offline queues, so extra fast-queue workers help only when policy changes touch several accounts. Size CONNECTOR_LAKEFORMATION_RESOURCE_PROCESS_THREAD_MIN_FAST by the number of accounts you grant to, not by the number of resources.

Not supported with tag-based masking or tag sync

The dedicated changelog queue does not support tag-based masking or tag sync in this version. If either is enabled for the connector, the connector ignores CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_ENABLED and keeps using the single offline queue:

Feature Property PM variable Default
Tag-based masking ranger.policysync.connector.0.tag.masking.enabled, or the global tag.masking.enabled when the connector property is not set ENABLE_TAG_MASKING false
Tag sync ranger.policysync.connector.0.purview.tag.sync.enabled CONNECTOR_PURVIEW_TAG_SYNC_ENABLED false

Both are false by default, so you only need to change them if you turned either feature on.

Setup

  1. SSH into the instance where Privacera Manager is installed.

  2. Open the Lake Formation connector configuration file for editing:

    Note

    Replace instance1 with the appropriate connector instance name, if you have multiple connectors.

    Bash
    vi ~/privacera/privacera-manager/config/custom-vars/connectors/lakeformation/instance1/vars.connector.lakeformation.push.yml
    
  3. Add or set the following properties:

    YAML
    1
    2
    3
    4
    5
    6
    7
    CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_ENABLED: "true"
    CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_CHANGELOG_TYPES: "RANGER_POLICIES"
    CONNECTOR_LAKEFORMATION_BATCH_PERMISSIONS_UPDATE_ENABLE: "true"
    CONNECTOR_LAKEFORMATION_BATCH_GRANT_SERIALIZE_BY_ACCOUNT_ENABLE: "true"
    # Optional: fast-queue worker threads
    CONNECTOR_LAKEFORMATION_RESOURCE_PROCESS_THREAD_MIN_FAST: "10"
    CONNECTOR_LAKEFORMATION_RESOURCE_PROCESS_THREAD_MAX_FAST: "30"
    
  4. After updating the values, apply the changes by running the following commands:

    Step 1 - Setup which generates the helm charts. This step usually takes few minutes.

    Bash
    cd ~/privacera/privacera-manager
    ./privacera-manager.sh setup
    
    Step 2 - Apply the Privacera Manager helm charts.
    Bash
    cd ~/privacera/privacera-manager
    ./pm_with_helm.sh upgrade
    
    Step 3 - (Optional) Post-installation step which generates Plugin tar ball, updates Route 53 DNS and so on. This step is not required if you are updating only connector properties.

    Bash
    cd ~/privacera/privacera-manager
    ./privacera-manager.sh post-install
    

To turn the feature off, set CONNECTOR_LAKEFORMATION_DEDICATED_QUEUE_ENABLED to false and update the Privacera Manager instance. The connector returns to the single offline queue and removes the per-resource tracking data it kept for the dedicated queue.

Verify the configuration

  • The generated connector properties have ranger.policysync.connector.0.enable.batch.permissions.update=true and ranger.policysync.connector.0.enable.batch.grant.serialize.by.account=true. Alternatively, after the first policy change, the lock metrics below appear with lane="fast"; they are recorded only when the per-account lock runs.
  • On startup with the flag on, the connector log shows dedicated changelog queue enabled: [RANGER_POLICIES] use the fast queue, and resource.process threads per changelog queue (min/max) lists the fast pool size.
  • If the connector ignored the flag because tag-based masking or tag sync is on, the log shows an ERROR containing does not support tag-based masking or tag sync, and the connector audits a DEDICATED QUEUE FALLBACK activity with the reason.
  • Policy changes are logged with dedicated queue lane=fast, and reconciles with dedicated queue lane=offline.
  • Connector metrics show the per-account lock by queue (lane is fast, offline or on-demand):
    • lakeformation_batch_grant_serialize_lock_waiters{lane}: threads waiting for an account lock right now.
    • lakeformation_batch_grant_serialize_lock_wait_time_seconds{lane,phase}: how long grants and revokes waited for the lock.
    • lakeformation_batch_grant_serialize_grantee_locks_size{lane="shared"}: the number of accounts the connector has locked so far.