Area: Deployment
Sub-Area: Event Streaming
Applies to: OSS
Issue
Metadata you write to DataHub takes a long time to appear in the UI or in search. Kafka consumers for the MetadataChangeProposal (MCP) and MetadataChangeLog (MCL) topics show high lag. Lag is normal during bulk ingestion.
The steps below apply to self-hosted DataHub only. If you use DataHub Cloud, you have no access to Kafka, kubectl or Helm. Contact DataHub Support about processing lag.
You Might Be Asking
- Why is my metadata taking so long to appear?
- How do I check Kafka consumer lag?
- What causes Kafka lag in DataHub?
Cause
DataHub processes metadata in two stages:
- MetadataChangeProposal_v1 (MCP) events are written to storage. By default, GMS consumes this topic itself. The default consumer group is
generic-mce-consumer-job-client. You can override it withMETADATA_CHANGE_PROPOSAL_KAFKA_CONSUMER_GROUP_ID. - MetadataChangeLog (MCL) events (
MetadataChangeLog_Versioned_v1andMetadataChangeLog_Timeseries_v1) are consumed by MCL hooks, including the UpdateIndicesHook. These hooks update the search and graph indices. Other hooks in the same consumer group can delay the UpdateIndicesHook. That delays index updates, so the UI shows old data.
Check both stages. Lag on the MCL side is a common reason why written metadata is not visible yet.
Standalone MCE and MAE consumers are optional and off by default (global.datahub_standalone_consumers_enabled: false). Quickstart also runs the consumers inside GMS.
Solution
-
Check lag for all consumers with the DataHub CLI. Point the CLI at your server with
DATAHUB_GMS_URLandDATAHUB_GMS_TOKEN, or with~/.datahubenv.datahub check get-kafka-consumer-offsets datahub check get-kafka-consumer-offsets -o jsonThe command prints offset and lag per consumer type (mcp, mcl, mcl-timeseries), consumer group, topic and partition. It also shows avg, max and total lag. Compare lag across the three types to see which stage is behind.
-
Find the pod names for your install. Pod names depend on your release name. With release name
datahub, GMS pods look likedatahub-datahub-gms-<hash>, and prerequisite pods look likeprerequisites-kafka-0.kubectl get pods -n <namespace> -
Check the logs for consumer errors. Use the real pod names from step 2.
kubectl logs <gms-pod-name> -n <namespace> | grep -i "error\|exception"If you run standalone consumers, check the
datahub-datahub-mce-consumer-<hash>anddatahub-datahub-mae-consumer-<hash>pods the same way. -
Add consumer capacity.
- By default GMS consumes the topics, so scale GMS.
- If you enabled standalone consumers (
global.datahub_standalone_consumers_enabled: true), scale thedatahub-mce-consumersubchart. SetreplicaCountorresourcesin your Helm values for that subchart. If standalone consumers are off, scaling that subchart has no effect.
-
Check topic partitions. Topics default to 1 partition (
PARTITIONS, default 1). Per-topic overrides exist, for exampleMETADATA_CHANGE_PROPOSAL_TOPIC_PARTITIONS.DATAHUB_AUTO_INCREASE_PARTITIONSdefaults to false. More partitions help only up to the number of consumers. Partitions can't be reduced. You can raise partitions with standard Apache Kafka tools on your own brokers. -
If lag persists outside bulk ingestion, lower the ingestion batch rate or add consumer capacity as in step 4.