How luizsilvadba/db2_parallel_load works
Purpose and Entry Point
This repository is a DB2 bulk-migration utility that runs multiple table loads concurrently. Its sole executable entry point is parallel_load.sh, invoked with source database, target database, and desired parallel-load count.
Orchestration Model
parallel_load.sh coordinates a bounded set of forked DB2 load processes. Workers claim pending migration records, execute independent source-to-target loads, and continue claiming work so available concurrency remains utilized while rows remain queued.
Paths:
• parallel_load.sh
Migration Work Queue and State
The target DB’s MIGRATION.CONTROL_LOAD table is the durable work queue and operational state store. Each row identifies source/target schema and table, optional source predicate, timing fields, DB2 load counters, and a worker/process identifier. State transitions distinguish pending, running, and completed loads.
The README provides the required DDL and monitoring queries; the table is external database infrastructure rather than a repository-managed schema artifact.
Paths:
• README.md
• parallel_load.sh
Source-to-Target Data Boundary
The script runs under the target DB2 instance identity, while the source database must be cataloged in that same DB2 instance directory. A worker reads a source table (optionally constrained by SOURCE_FILTER) and submits data to DB2’s target-side LOAD capability. Source and target tables normally require compatible, one-to-one column definitions.
Paths:
• parallel_load.sh
• README.md
Column Mapping Override
MIGRATION.COLUMN_MAPPING is an optional metadata layer for migrations where source and target columns do not align directly. It maps a source column expression to each target column, allowing the generated source selection to differ from the default same-column-list behavior.
Paths:
• README.md
• parallel_load.sh
Parallelism and Large Partitioned Tables
Parallelism is process-based, controlled by the final CLI argument rather than an application server or scheduler. Large range-partitioned source tables can be represented as multiple control rows with distinct partition-range filters, loaded into temporary target tables concurrently, then attached afterward through DB2 administration steps outside this script.
Paths:
• parallel_load.sh
• README.md
Operations and Observability
Progress is persisted in DB2 control-table timestamps, worker IDs, and row-level load statistics (rows_read, loaded, rejected, committed, etc.). Per-worker shell/DB2 output is written to files matching *._parallel_load_from_*.out, enabling live log tailing. parallel_load.sh is the only runtime artifact; execution depends on a DB2 CLI environment, cataloged source database, target database, and pre-created MIGRATION control tables.
Paths:
• parallel_load.sh
• README.md
Main entry points: parallel_load.sh Forked load workers · README.md Partitioned-table workflow
Components 13
Shell Runtime
- CLI invocation · Source DB, target DB, and worker-count arguments.
parallel_load.sh - parallel_load.sh · Bounds and replenishes forked load workers.
parallel_load.sh - Forked load workers · Each worker repeatedly claims and loads one migration row.
parallel_load.sh
DB2 Data Plane
- Target DB2 instance · Must catalog the source database under the target instance identity.
- MIGRATION.CONTROL_LOAD · Stores migration definition, state, worker ID, timing, and load counters.
- MIGRATION.COLUMN_MAPPING · Optional source-expression to target-column overrides.
- Cataloged source database · Provides source tables and optional row filters.
- Target database · Receives table loads and hosts migration metadata.
- DB2 LOAD · Loads selected source data into target tables.
parallel_load.sh - Partitioned-table workflow · Concurrent temporary-table loads can be attached afterward outside the script.
README.md
Operations
- Per-worker output files · Files match *._parallel_load_from_*.out for live tailing.
parallel_load.sh - Progress monitoring · Reads timestamps, worker IDs, and row-level load statistics.
README.md - DDL and runbook · Defines required migration tables and operating guidance.
README.md
Connections 14
- CLI invocation → parallel_load.sh: invokes
- parallel_load.sh → Forked load workers: forks up to requested count
- parallel_load.sh → Target DB2 instance: runs under
- Forked load workers → MIGRATION.CONTROL_LOAD: claim pending work; update state
- Forked load workers → MIGRATION.COLUMN_MAPPING: reads when present
- Forked load workers → Cataloged source database: selects source rows
- Forked load workers → DB2 LOAD: submits selected data
- DB2 LOAD → Target database: bulk loads target table
- DB2 LOAD → MIGRATION.CONTROL_LOAD: records load counters and completion
- Forked load workers → Per-worker output files: writes DB2 and shell output
- Progress monitoring → MIGRATION.CONTROL_LOAD: queries progress
- DDL and runbook → MIGRATION.CONTROL_LOAD: documents required DDL
- Cataloged source database → Partitioned-table workflow: range-filtered control rows
- Partitioned-table workflow → Target database: attach temporary loads