Migration job organization and scheduling

Updated at:

MaxCompute Migration Service (MMS) lets you create migration jobs for a specified scope, such as a database, table, or partition, and intelligently allocates migration tasks. This topic describes how migration jobs are organized and scheduled.

Task assignment

Key concepts

  • migration job

    The largest logical unit for a migration, defined by a migration scope, such as an entire database, a specific set of tables, or partitions.

  • migration task

    The smallest, independently schedulable unit of execution. MMS automatically splits a migration job into one or more parallel migration tasks based on the job's scope and assignment rules.

Organizational structure

  1. A migration job can specify a database, multiple tables, or multiple partitions as its migration scope.

    Note

    The service does not re-migrate non-partitioned tables or partitions if they have already been migrated and their source data is unchanged.

  2. A migration job contains one or more migration tasks.

  3. A migration task migrates either one non-partitioned table or one or more partitions from a single partitioned table.

image

Task assignment rules

After a migration job is created, the system splits tables and partitions into migration tasks in two steps: data filtering and data grouping.

Step 1: Data filtering

The system filters non-partitioned tables and partitions from the job's specified scope to determine the actual objects for migration. An object is selected for migration if it meets all of the following conditions:

  1. Its status meets either of the following criteria:

    1. The migration status is not succeeded.

    2. The migration status is succeeded, but the source data has been updated.

      Note

      Logic for determining if source data is updated:

      When metadata is refreshed, MMS pulls metadata (databases, tables, and partitions) from the data source and caches it. MMS then compares the latest cache with the previous one. If specific metadata has changed, the corresponding table or partition is marked as data updated.

      • Metadata attributes for comparison:

        • non-partitioned table: The tableSchema, size, numRows, lastDdlTime, and type attributes are compared. If any of these differ, the table is marked as data updated.

        • partitioned table: The size, numRows, and lastDdlTime attributes are compared. If any of these differ, the partition is marked as data updated.

      • Source of attribute values for different data sources:

        • BigQuery uses total_logical_bytes and total_rows as the values for size and numRows, respectively.

        • Hive uses the metastore table property values rawDataSize and numRows for size and numRows, respectively.

        • Databricks delta tables also use lastUpdateVersion for comparison.

        • For MaxCompute, lastDdlTime is derived from last_data_modified_time.

  2. It matches the allowlist/denylist configuration of the data source and the partition filtering rules of the migration job.

Step 2: Data grouping

The system uses different task assignment strategies based on the table type:

  • non-partitioned table

    Each non-partitioned table is assigned to a separate migration task.

  • partitioned table

    The system groups partitions from the same partitioned table into one or more migration tasks based on two settings in the data source configuration: maximum number of partitions per task and maximum data size per task (GB). A new task is created when either threshold is met.

    Example of task assignment for a partitioned table:

    • Example 1: If the maximum number of partitions per task is set to 1, each migration task will contain only one partition.

    • Example 2: If the maximum number of partitions per task is set to 100 and the maximum data size per task (GB) is set to 1, and a partitioned table contains two partitions, each larger than 1 GB, the system creates two migration tasks for this table. Each task contains one partition.

Usage examples

Example 1: Create a database migration job

Assume you create a migration job to migrate a database named database_a, which contains the following tables:

  • Non-partitioned tables: table_a and table_b

  • Partitioned tables: table_c (with 100 partitions, each 10 KB in size) and table_d (with 2 partitions, each 10 GB in size)

When you submit the migration job, the data source has the following settings: maximum number of partitions per task=50, maximum data size per task (GB)=5.

The system generates the following migration tasks:

  • Task 1: Migrates table_a

  • Task 2: Migrates table_b

  • Task 3: Migrates partitions 1-50 of table_c

  • Task 4: Migrates partitions 51-100 of table_c

  • Task 5: Migrates partition 1 of table_d

  • Task 6: Migrates partition 2 of table_d

image

Example 2: Incremental migration

After the initial migration of database_a, the following changes occur at the source:

  • New data is inserted into the non-partitioned table table_b.

  • A new non-partitioned table table_e is added.

  • The partitioned table table_d is deleted.

  • For the partitioned table table_c:

    • New data is inserted into partition pt_100.

    • Partition pt_99 is deleted.

    • Partition pt_101 is added.

  • A new partitioned table table_f is added with no partitions.

When you create another migration job for database_a, the system generates the following migration tasks:

  • Task 1: Migrates table_b

  • Task 2: Migrates partitions pt_100 and pt_101 of table_c

  • Task 3: Migrates the table schema of table_f

image

Migration statuses

Migration job status

Status

Description

Trigger condition

pending

The job has been created and is awaiting scheduling.

The initial status after a job is successfully created.

running

At least one task in the job is running.

A migration task in the job starts to run.

succeeded

All tasks in the job have succeeded.

All migration tasks have a status of succeeded.

failed

An error occurred during job execution.

All migration tasks have finished running, and at least one has failed.

stopped

The job has been stopped manually.

The job is stopped manually.

Migration job status workflow:

image

Migration task status

Status

Description

Trigger condition

pending

The task has been created and is awaiting execution.

The initial status after a task is successfully created.

running

The task is actively migrating data.

The task starts migrating data.

succeeded

The task has successfully migrated its assigned data.

The task completes the migration of its assigned data.

failed

An error occurred during task execution.

An exception occurs during data migration.

stopped

The task has been stopped.

The parent job is stopped while the task is pending or running.

Migration task status workflow:

image

Table status

Status

Description

Applicable objects

not migrated

The table has not yet started migrating.

Non-partitioned tables, partitioned tables

migrating

The table is being migrated.

Non-partitioned tables, partitioned tables

partially completed

Some, but not all, partitions of the table have migrated successfully.

Partitioned tables only

succeeded

The table has been successfully migrated.

Non-partitioned tables; partitioned tables where all partitions have succeeded

failed

An error occurred during the table migration.

Non-partitioned tables, partitioned tables

Note
  • The partially completed status does not apply to non-partitioned tables.

  • A partitioned table's status changes to succeeded only after all its partitions have succeeded.

  • Non-partitioned table status workflow

    image

  • Partitioned table status workflow

    image

Partition status

Status

Description

Trigger condition

not migrated

The partition has not yet started migrating.

The initial status when the partition is identified for migration.

migrating

The partition is being migrated.

The task that contains the partition starts running.

succeeded

The partition has been successfully migrated.

The task that contains the partition succeeds.

failed

An error occurred during the partition migration.

The task that contains the partition fails.

Partition status workflow:

image

Retry on failure

You can retry a migration job that is failed. After you click Retry, the job status does not change immediately. The status updates only after the failed tasks are rescheduled and begin to run.

Note

The retry operation re-runs only the failed tasks. Succeeded tasks are not re-run.

Impact of changing the destination on status

If you change the migration destination for a database, table, or partition, the system resets the status of the affected tables and partitions to not migrated.

Note

After you change the destination, the original migration tasks no longer update the status of the affected objects.

FAQ

Incremental synchronization after migration

  • Scenario 1: Synchronize new or modified tables and partitions in a database

    1. On the data source management page, resynchronize the metadata.

    2. Resubmit the migration job for the specific database.

    Note

    Based on the data filtering rules, the migration job migrates only new and modified tables and partitions.

  • Scenario 2: Synchronize new or modified partitions in a specific table

    1. On the data source management page, resynchronize the metadata.

    2. Resubmit the migration job for the specific table.

Re-migrating succeeded tables or partitions

To re-migrate a succeeded table or partition whose source data has not changed, follow these steps:

  1. In the Table List or Partition List, select the objects that you want to re-migrate.

  2. Reset their status to not migrated.

  3. Resubmit the migration job.