You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/11 09:32:25 UTC
[GitHub] [shardingsphere] azexcy commented on a diff in pull request #16727: - PostgreSQL scaling auto create table optimization
azexcy commented on code in PR #16727:
URL: https://github.com/apache/shardingsphere/pull/16727#discussion_r847129504
##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java:
##########
@@ -87,9 +91,30 @@ private void prepareTarget(final JobConfiguration jobConfig, final PipelineDataS
log.info("dataSourcePreparer null, ignore prepare target");
return;
}
- JobDataNodeLine tablesFirstDataNodes = JobDataNodeLine.unmarshal(jobConfig.getHandleConfig().getTablesFirstDataNodes());
- PrepareTargetTablesParameter prepareTargetTablesParameter = new PrepareTargetTablesParameter(tablesFirstDataNodes, jobConfig.getPipelineConfig(), dataSourceManager);
- dataSourcePreparer.prepareTargetTables(prepareTargetTablesParameter);
+ LockContext lockContext = PipelineContext.getContextManager().getInstanceContext().getLockContext();
+ ShardingSphereLock lock = lockContext.getOrCreateSchemaLock(jobConfig.getWorkflowConfig().getSchemaName());
+ // TODO make sure only the first thread execute prepare
+ boolean skipPrepare = !lock.tryLock("prepareTargetTablesLock", 100);
Review Comment:
changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org