Estimation and Scheduling Questions
Estimating effort and building realistic schedules: estimation techniques, task sequencing, critical-path analysis, timeline development, and dependency mapping. Covers handling estimation uncertainty, schedule compression, and defending a timeline against optimism bias.
Design a practical change control process for ETL pipelines: include change request intake form, impact assessment steps (data consumers impacted, schema changes, downtime), approval gates, emergency change flow, version control and release tagging, and required test artifacts before approval. Provide a short template for the change request.
Sample Answer
Overview: A practical change control process for ETL pipelines should minimize data downtime/risk, make impact visible to consumers, enforce repeatable testing, and allow rapid but safe emergency fixes. Below is a step-by-step process, approval gates, emergency flow, versioning rules, required test artifacts, and a short change-request template.
Change request intake (what to capture)
- Title, requester, date, pipeline name & environment (dev/test/prod)
- Type: schema, logic, config, infra, dependency, bugfix, emergency
- Brief description + business reason
- Desired deploy window / SLA
- Rollback plan owner & steps
- Risk level (low/med/high) + estimated impact (rows affected, consumers)
- Links: code PR, JIRA, runbooks, dashboards
Impact assessment steps
- Identify data consumers (tables/views downstream, BI dashboards, ML jobs). List owners and notify.
- Schema analysis: additive vs. breaking change; column/data-type changes; migration strategy (backfill).
- Volume/latency: estimate throughput, runtime change, resource needs.
- Downstream job dependencies & SLOs; expected downtime or degraded correctness window.
- Data quality: define key metrics to validate (row counts, null rates, checksums).
- Security/compliance impacts.
Approval gates
- Gate A (Low risk): Dev + PR review + automated unit tests + integration tests OK → schedule deploy to prod window.
- Gate B (Medium risk or schema-additive): + Data owner sign-off + integration tests + sandbox consumer verification + pre-prod run with sample data.
- Gate C (High risk or breaking schema/infra): + Architecture review board + stakeholder sign-offs (data consumers, compliance) + full dry-run backfill + rollout plan with canary & monitoring.
Required test artifacts before approval
- Passing CI: unit tests + linters
- Integration tests against test dataset (examples)
- Regression tests for downstream consumers
- Data validation report: row counts, primary-key uniqueness, checksums, schema diff
- Pre-prod run logs & monitoring screenshots (latency, CPU/memory)
- Rollback playbook validated in test environment
Emergency change flow
- Triage: designate on-call data engineer to assess and classify emergency.
- Emergency approval: on-call + engineering manager + one stakeholder may approve expedited deploy.
- Controls: require automatic snapshot/backups, feature flag or quick rollback enabled, deploy in small canary first.
- Postmortem: within 48 hours, documented root cause, why emergency path used, corrective actions, and movement to normal change flow for permanent fix.
Version control & release tagging
- All pipeline code in Git with PRs for changes; enforce branch protection and required reviews.
- Use semantic versioning for pipeline artifacts (e.g., pipeline-service v2.3.0). Tag releases: pipeline-name/vX.Y.Z + date + env.
- Release branch per release window; hotfix branch pattern for emergency changes (hotfix/pipeline/vX.Y.Z).
- CI publishes build artifacts and immutable data schema versions (e.g., schema registry with versioned Avro/Parquet schemas).
Deployment & rollout best practices
- Canary: route small subset of producers or rows to new code for 1–2 cycles.
- Feature flags for toggling logic.
- Monitor: DQ metrics, SLA latency, consumer errors—automated alerts.
- Post-deploy validation window before full cutover.
Short change request template
Title:
Requester / Team:
Date:
Pipeline & Component:
Environment(s):
Type (schema/logic/infra/bugfix/emergency):
Description & Business Rationale:
Estimated impact (#rows, consumers, tables):
Consumers / Owners notified:
Schema changes (yes/no) — details:
Rollback plan & owner:
Risk level (low/med/high):
Desired deploy window:
Links: PR, JIRA, test reports, runbook
This process balances governance with agility: automated CI/CD and clear artifact requirements speed approvals for low-risk work while structured reviews, canaries, and explicit rollback plans protect production data for higher-risk changes.
Design an automated CI/CD pipeline for data infrastructure and ETL code. Include stages: unit tests, static analysis, integration tests with sample data, schema compatibility checks, migration scripts, canary/blue-green promotion across dev/stage/prod, artifact versioning, and automated rollback triggers. Recommend tools and explain triggers and gating logic.
Sample Answer
Situation: I’d implement a gated, reproducible CI/CD pipeline that treats ETL code and infra-as-code as first-class artifacts, with automated quality gates and safe promotion across dev → stage → prod.
Pipeline stages and tools
- Source & CI trigger
- Repo: Git (GitHub/GitLab). Pull requests trigger CI on feature branches.
- Tool: GitHub Actions / GitLab CI / Jenkins for orchestration.
- Static analysis & linting (PR gate)
- Code: Python (pylint/ruff/black), SQL (sqlfluff), Spark jobs (scalastyle for Scala).
- Infrastructure: Terraform validate + tflint.
- Fail PR if any high-severity issues.
- Unit tests (fast feedback)
- Pytest with mocks for I/O; run in CI containers.
- Coverage threshold (e.g., 80%) enforced; failing threshold blocks merge.
- Build & artifact versioning
- Build artifacts: Docker images for ETL workers, wheels/jars, Terraform modules.
- Versioning: Semantic versions + git SHA (e.g., 1.2.3+githash). Publish to container registry (ECR/GCR/ACR) and artifact repo (Nexus/Artifactory) with immutable tags.
- Store metadata in CI artifact registry and release manifest.
- Integration tests on sample data (isolated env)
- Use reproducible sample datasets (sized-down but representative) in test environment (local k8s / ephemeral Cloud test project).
- Run end-to-end ETL on sample data using Testcontainers / Docker Compose or ephemeral Airflow DAGs.
- Validate outputs with Great Expectations tests and row-level assertions.
- Schema compatibility & contract checks
- Use schema registry (Confluent Schema Registry for Avro/Protobuf) or Hive/BigQuery dataset schemas.
- Validate backward/forward compatibility on schema changes before merge using automated checks (confluent compatibility check or sqitch-like tools).
- Data contract tests: producers/consumers run contract tests; failures block promotion.
- DB/warehouse migration scripts
- Migrations managed by Flyway/Alembic/liquibase, stored in repo, versioned.
- Run dry-run and plan in staging; run migration in transaction-safe or idempotent manner.
- PR must include migration scripts; CI applies migrations to ephemeral test DB and runs smoke/integration tests.
- Pre-deploy gating & approvals
- Protected branches: merging into main triggers deployment to dev/stage via IaC (Terraform/CloudFormation) and GitOps (ArgoCD/Flux).
- Manual approvals for stage→prod or enforced automated gates (see below).
- Canary / Blue-Green promotion
- Deploy new ETL container and orchestration (Airflow worker set, k8s deployment) alongside current in prod.
- Canary: route small % of jobs/data to new version (k8s rollout with traffic-splitting or feature flags). Monitor:
- Data quality metrics (Great Expectations)
- Latency, error rate, throughput
- Business KPIs (record counts, aggregates)
- If metrics stable for the window, shift traffic gradually to 100% and decommission old version (blue-green swap).
- Alternative: blue-green via duplicate clusters and DNS/role swapping.
- Automated rollback triggers & actions
- Define rollback triggers:
- Failing data quality checks (schema mismatches, expectation failures)
- Spike in error rates or SLA breaches
- Unexpected divergence in downstream aggregates
- Critical test failures post-deploy
- Automated actions:
- Immediately halt new job scheduling and route jobs to previous artifact.
- Promote previous artifact tag in registry and redeploy (automated rollback job).
- Run compensating ETL jobs if partial writes occurred (idempotent/transactional patterns).
- Alerting: PagerDuty + Slack with incident runbook link and rollback reason.
- All rollbacks logged and require postmortem before reattempt.
Gating logic and triggers (summary)
- Pre-merge: static analysis + unit tests + schema linting (block merge on failure).
- Post-merge dev deploy: build artifacts + run integration tests on sample data (block further promotion if failing).
- Stage deploy: run full integration, migration dry-run, policy checks, and automated acceptance tests (manual/automated approval required to proceed).
- Prod promotion: gated by canary success window (metrics thresholds). Only auto-promote when all monitors green for the configured window; otherwise auto-rollback.
- Emergency route: infra changes that touch prod schema or migrations always require manual approval and a scheduled maintenance window.
Best practices & reasons
- Immutable artifacts + semantic versioning ensure reproducibility and quick rollbacks.
- Sample-data integration tests catch logic regressions; schema compatibility prevents downstream breakage.
- Canary/blue-green reduces blast radius for data regressions (critical for stateful pipelines).
- Automated rollback minimizes downtime and data corruption risk; runbooks and postmortems close the loop.
- GitOps + IaC ensures declarative, auditable deployments and simplifies compliance.
Example technologies stack
- Code repo/CI: GitHub + GitHub Actions
- Lint/tests: ruff/pylint, sqlfluff, pytest
- Schema: Confluent Schema Registry, Great Expectations
- Orchestration: Apache Airflow on Kubernetes, ArgoCD for GitOps
- Images/artifacts: ECR/GCR + Artifactory
- Infra: Terraform + Terragrunt
- Migrations: Flyway/Alembic
- Monitoring/alerts: Prometheus + Grafana + PagerDuty
- Secrets: AWS Secrets Manager / Vault
This pipeline balances developer velocity with data safety: fast feedback loops (lint/unit), deeper integration checks before promotion, and controlled canary/blue-green releases with automated rollbacks driven by concrete data-quality and reliability thresholds.
You must migrate patient healthcare (PHI) data. Decide between big-bang and phased migration and explain the compliance, audit, and governance controls you would implement: encryption at rest/in transit, access controls, immutable audit logs, consent tracking, validation and reconciliation artifacts for auditors, and how to evidence compliance during each phase.
Sample Answer
Decision: choose phased migration with parallel run and cutover waves. Rationale: PHI requires minimal risk, demonstrable controls, and the ability to validate and rollback per cohort; phased migration limits blast radius and provides continuous auditability for regulators.
Plan summary:
- Phase 0 — Prep: inventory data stores, classify PHI, map consents, and create migration runbook and test plan.
- Phase 1 — Pilot (non-critical subset): migrate small patient cohort with synthetic/obfuscated copies first, then real data.
- Phase 2 — Wave migrations: by geography or system, with parallel-read on legacy + new systems.
- Phase 3 — Cutover and decommission with final reconciliation.
Compliance, audit and governance controls (how I’d implement them):
- Encryption:
- In transit: TLS 1.2+ with mTLS for service-to-service channels. VPNs or private VPC peering for cloud-to-cloud links.
- At rest: KMS-managed keys (cloud HSM) per environment; envelope encryption for backups. Key rotation policy and separation of duties for key admins.
- Access controls:
- Principle of least privilege via IAM roles, short-lived credentials (OIDC), attribute-based access to limit dataset access to pipeline/service accounts.
- Privileged access approval workflow, periodic access reviews, and JIT elevation for emergency fixes.
- Immutable audit logs:
- Write audit events to append-only storage (WORM) + cloud object lock or ledger DB (e.g., AWS QLDB). Logs capture user/service, timestamp, action, source IP, correlation IDs.
- Use cryptographic hashing (Merkle tree) and sign logs to detect tampering.
- Consent tracking:
- Source-of-truth consent store with versioning. During migration, attach consent metadata to each record; enforce policy engine that blocks migration if consent absent/expired.
- Capture provenance: source record id, consent id, timestamp, operator.
- Validation & reconciliation artifacts:
- Create deterministic checksums (e.g., SHA-256) per record and per-batch before and after migration; maintain a reconciliation ledger with counts, hash aggregates, and schema diffs.
- Row-level status reports: migrated, transformed, failed, skipped (with reason). Store artifacts in immutable storage and link to migration ticket.
- Automated data quality tests (nulls, referential integrity, business rules) executed in CI and during migration; results stored versioned.
- Evidence for auditors during each phase:
- Phase-specific evidence packet including: inventory, migration runbook, test reports, checksum reconciliation report, consent verification logs, KMS key access logs, IAM access review snapshots, and immutable audit log extracts (signed).
- Provide reproducible run: pipeline execution trace with correlation IDs, raw input and output manifests (obfuscated entries where needed), and replayable DAG logs.
- Weekly compliance review checkpoints and ad-hoc access to append-only logs via read-only auditor role.
Operational safeguards:
- Automated rollback on thresholds (error rate, reconciliation mismatch).
- Canary validations and shadow writes to detect behavioral differences.
- Retention and purge aligned to retention policy; maintain legal hold mechanism.
This phased approach balances risk, provides granular auditor evidence, and enforces end-to-end governance for PHI migration.
You discover during migration that the source system's schema changed mid-migration, causing a subset of records to fail. Draft an immediate remediation plan: detection, triage, whether to pause migration, compatibility-layer options, potential rollback steps, and a backfill strategy to reconcile missing or malformed data.
Sample Answer
Situation: Midway through a migration I’m running from SourceDB → Data Lake, I detect a schema change in the source that caused a subset of records to fail validation and land as malformed rows.
Immediate remediation plan
- Detection & alerting
- Stop-gap: auto-alert from ETL (schema-validation errors, spike in rejects). Confirm with source change logs (CDC/DB audit), and check ingestion logs (Spark executor errors, failed batches).
- Run quick query to quantify failures: count, affected tables, time window, sample rows.
- Triage
- Classify failures: schema-addition (new nullable column), rename, type-change, or structural (nested object changed).
- Assess impact: percentage of records, critical downstream consumers, data correctness vs availability SLA.
- Pause decision
- If >5–10% of records or key tables affected, or change breaks downstream consumers, pause automated ingestion for the affected pipeline(s).
- Otherwise, put into degraded mode: continue ingesting raw payloads to a quarantined staging area for triage.
- Compatibility-layer options
- Lightweight fixes first:
- Apply mapping rules: treat new columns as optional, supply defaults; map renamed fields via transformation layer.
- Use schema-on-read: store raw JSON/Avro in landing zone and adapt readers.
- Runtime schema evolution in Spark/Avro/Parquet (merge schemas) if safe.
- Implement a transformation that normalizes incoming records into expected schema using a versioned schema registry.
- Rollback steps (if required)
- If source change is accidental and upstream can revert, stop ingest, roll back to last consistent checkpoint (Kafka offsets or Spark offsets), confirm upstream revert, then resume.
- If rollback upstream not possible, do logical rollback: revert downstream schema to accept both versions via compatibility layer and backfill.
- Backfill strategy
- Quarantine bad records into staging with metadata (source timestamp, schema version).
- Create per-version ETL jobs to transform quarantined data into canonical schema:
- Use Spark job that applies field mappings, type casts, and validation rules.
- Validate output against data quality checks and reconcile counts.
- Run idempotent writes (upserts with primary keys or dedupe by watermark) to target.
- Monitor metrics and run reconciliation (row counts, checksums) against source.
Communication & follow-up
- Notify stakeholders with impact, actions, ETA. Create postmortem: root cause (why schema changed mid-migration), add preventive controls: stricter schema contracts, gating changes via CI, more robust schema registry, automated tests for schema drift, and runbooks for future incidents.
Multiple teams produce overlapping event streams causing downstream duplication and schema conflicts. Propose a sequencing and schema evolution strategy that includes namespace strategy, event versioning, producer/consumer contracts, idempotency keys, compatibility tests, and a migration path to consolidate streams with minimal downtime.
Sample Answer
Situation & goals: multiple producer teams emit overlapping event streams that cause duplicate events and schema conflicts downstream. We need a sequencing + schema evolution strategy that enables safe consolidation with minimal downtime, strong contracts, idempotent processing, and automated compatibility testing.
Sequencing & deduplication
- Assign a stable event key (natural id, e.g., order_id) and a producer-scoped monotonically increasing sequence number (producer_seq) plus event_timestamp. The tuple (event_key, producer_id, producer_seq) gives total ordering per producer.
- For cross-producer global order when needed, use an ingest sequencer (Kafka partition key by event_key; Kafka offset acts as canonical sequence) or a lightweight global logical clock service if strict ordering is required.
- Downstream dedupe: keep last_seen (producer_id, producer_seq) per event_key; accept event only if producer_seq > last_seen for that producer OR if idempotency_key not seen. Use log-compaction (Kafka) or state store (Redis/DB) with TTL windows to bound state.
Namespace & stream consolidation
- Use a namespace convention: <domain>.<entity>.<version>. Example: orders.events.v1, orders.events.v2. Producers write to their domain-entity streams. For consolidation, create an aggregated topic: orders.events.consolidated.v1 which consumers read.
- Use topics with clear ownership metadata and tag each event with source_producer and canonical_namespace fields.
Schema evolution & versioning
- Use a schema registry (Avro/Protobuf/JSON Schema) and enforce compatibility rules:
- Backward compatible: new consumers can read old data (add optional fields).
- Forward compatible: old consumers can skip unknown fields.
- Prefer forward+backward (full) for critical shared schemas.
- Version events by schema id and semantic versioning: major bump for incompatible changes, minor/patch for additive/non-breaking.
- Embed schema_id and schema_version in the event envelope.
Producer/consumer contracts
- Define explicit contracts in registry: required fields, types, semantics, TL;DR examples.
- Contract tests: producers run schema-validation tests against the registry in CI; consumers run consumer-driven contract tests using captured producer schemas (pact-like).
- CI gate: reject incompatible schema pushes unless flagged and approved.
Idempotency & keys
- Each event includes an idempotency_key: deterministic UUID derived from (event_key, event_type, producer_seq) or a UUID v4 when natural id absent.
- Consumers must process idempotently: operations keyed by idempotency_key; updates should be upserts by event_key with last-write-wins using (producer_id, producer_seq) tie-breaker.
- Persist processed idempotency_keys with TTL to support dedupe windows; for long-lived entities use last_applied_seq per producer.
Compatibility tests & automation
- Automated schema compatibility checks in CI using the registry API (verify backward/forward/full per policy).
- Integration tests: replay historical events into a staging pipeline; run consumer suites to assert semantics.
- Contract test tooling: snapshot schemas + sample events; run consumers in CI against those snapshots.
Migration path to consolidate streams (minimal downtime)
- Preparation:
- Standardize envelope (schema_id, idempotency_key, source_producer, producer_seq, event_key, timestamp).
- Implement schema registry and compatibility gates.
- Add producer metadata and idempotency_key in all producer clients (small code change).
- Dual-write phase:
- Producers write to their legacy topic AND to consolidated topic (feature flagged). Consolidated topic uses canonical namespace/v1.
- Consumers start reading consolidated topic in parallel (read-only) to validate behavior (shadow mode).
- Backfill and reconcile:
- Backfill consolidated topic with historical events from legacy streams, normalizing to canonical envelope.
- Run reconciliation jobs to detect duplicates and conflicts; reconcile using deterministic rules (producer_seq precedence, latest timestamp, or conflict resolution policy).
- Cutover:
- Gradually switch consumers to consolidated topic by traffic %, monitor metrics (duplicates, processing errors).
- When stable, flip producers from dual-write to single consolidated write; then deprecate legacy topics.
- Clean-up:
- Run final backfill to catch any missed events during cutover window.
- Retire legacy schemas/topics after TTL and notify teams.
Trade-offs & monitoring
- Trade-off: strict global ordering costs (latency/coordination); use per-key ordering where possible.
- Monitor: duplicate rate, schema incompatibility events, consumer error rates, processing lag, idempotency cache hit ratio.
- Alert on schema registry rejections and high reconciliation counts.
Example idempotency key pattern
- idempotency_key = SHA256("{producer_id}|{event_key}|{producer_seq}") — deterministic, small, collision-resistant.
This approach delivers:
- Clear namespaces and canonical topics for consolidation
- Enforced contract + automated compatibility testing
- Deterministic dedupe via idempotency keys and per-producer sequence
- Low-downtime migration: dual-write, shadow consumers, backfill, gradual cutover
- Observability and reconciliation to ensure correctness during transition.
Unlock Full Question Bank
Get access to all 41 Estimation and Scheduling interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.