Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication job to trigger setup and carbon flow for replica tables [WIP] #276

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rohitkum2506
Copy link
Collaborator

@rohitkum2506 rohitkum2506 commented Jan 9, 2025

Summary

New job workflow to run Replication setup process on Airflow. Applies to primary tables with defined ReplicationConfig.

Design decisions:

  1. The Replication job does not use JobsClient to trigger a job.
    Instead it will use Airflow client to trigger and manage lifecycle of a Airflow job.
  2. Replication will have the task definition in Li-Openhouse side since it needs to leverage AirflowClient.
  3. As there can be multiple ReplicationConfigs for a table. The ReplicationTask goes over each config sequentially to trigger a setup job corresponding to the config.

Future work:

  1. Develop AirflowClient which will allow triggering, managing state of Airflow jobs and integrate with Replication job run.
  2. Develop CarbonClient which can trigger carbon jobs to setup scheduled replication flows.
  3. Integrate CarbonClient with Replica table setup job

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests
    For all the boxes checked, please include additional details of the changes made in this pull request.

Testing Done

  • Manually Tested on local docker setup. Please include commands ran, and their output.
  • Added new tests for the changes made.
  • Updated existing tests to reflect the changes made.
  • No tests added or updated. Please explain why. If unsure, please feel free to ask for help.
  • Some other form of testing like staging or soak time in production. Please explain.

Tested on Local docker setup:

Ran the new Replication Job with Local Docker setup. Added a table with replicationConfig.
Observed:

  1. The new job gets picked up by the JobScheduler and follows the task flow
  2. Only Primary tables with defined replicationConfig are considered and others are filtered out
Screenshot 2025-01-08 at 10 17 11 PM Screenshot 2025-01-08 at 3 30 15 PM

For all the boxes checked, include a detailed description of the testing done for the changes made in this pull request.

Additional Information

  • Breaking Changes
  • Deprecations
  • Large PR broken into smaller PRs, and PR plan linked in the description.

For all the boxes checked, include additional details of the changes made in this pull request.

@rohitkum2506 rohitkum2506 force-pushed the rohikuma/ReplicationJob branch from 727def4 to 4ceabdd Compare January 9, 2025 18:47
@rohitkum2506 rohitkum2506 marked this pull request as ready for review January 9, 2025 20:51
Copy link
Member

@abhisheknath2011 abhisheknath2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rohitkum2506. Did initial pass and added some comments.

}
List<ReplicationConfig> replicationConfigList = new ArrayList<>();
Replication replication = response.getPolicies().getReplication();
List<com.linkedin.openhouse.tables.client.model.ReplicationConfig> replicationConfig =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we are using two classes here with different namespace. Is the class com.linkedin.openhouse.jobs.util.ReplicationConfig internal here and returned as part of method response?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, com.linkedin.openhouse.jobs.util.ReplicationConfig is meant as translation layer between jobs model object and maintenance jobs

.filter(m -> m.isPrimary() && (m.getReplicationConfig() != null))
.collect(Collectors.toList());
log.info(
"Fetched metadata for {} tables for replication setup task",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Better to print the table names as comma separated list.

Copy link
Member

@abhisheknath2011 abhisheknath2011 Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the list can be more. Is there a way to track for which tables replication is being setup for every scheduled run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List of tables could be large. Each task will run for a table and log should capture this detail task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@@ -86,6 +93,31 @@ private Optional<RetentionConfig> getTableRetention(GetTableResponseBody respons
.build());
}

private Optional<List<ReplicationConfig>> getTableReplication(GetTableResponseBody response) {
Copy link
Member

@abhisheknath2011 abhisheknath2011 Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we plan to filter tables as replication setup is one time activity? Would that be part of li repo?

  • Identify the tables for which replication setup is needed like recent tables.
  • Identify the tables for which replication config is updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can consider last updated time and include the change in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants