sandynz commented on code in PR #20498:
URL: https://github.com/apache/shardingsphere/pull/20498#discussion_r953770829


##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobPreparer.java:
##########
@@ -100,15 +100,18 @@ private void prepareAndCheckTargetWithLock(final 
MigrationJobItemContext jobItem
         String lockName = "prepare-" + jobConfig.getJobId();
         LockContext lockContext = 
PipelineContext.getContextManager().getInstanceContext().getLockContext();
         LockDefinition lockDefinition = new ExclusiveLockDefinition(lockName);
-        JOB_API.persistJobItemProgress(jobItemContext);
         if (lockContext.tryLock(lockDefinition, 180000)) {
             log.info("try lock success, jobId={}, shardingItem={}", 
jobConfig.getJobId(), jobItemContext.getShardingItem());
+            if (null == JOB_API.getJobProgress(jobItemContext.getJobId())) {
+                JOB_API.persistJobItemProgress(jobItemContext);
+            }

Review Comment:
   1, Seems `getJobProgress` won't return null.
   
   2, Could we just check jobItemProgress?
   



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/check/datasource/PostgreSQLDataSourceChecker.java:
##########
@@ -54,9 +54,11 @@ private void checkPrivilege(final DataSource dataSource) {
                     throw new 
PipelineJobPrepareFailedException(String.format("No role exists, rolname: %s.", 
metaData.getUserName()));
                 }
                 String isSuperRole = resultSet.getString("rolsuper");
+                // compatible openGauss database, role name is SYSADMIN;
+                String isSystemAdminRole = 
resultSet.getString("rolsystemadmin");
                 String isReplicationRole = 
resultSet.getString("rolreplication");
-                log.info("checkPrivilege: isSuperRole: {}, isReplicationRole: 
{}", isSuperRole, isReplicationRole);
-                if (StringUtils.equalsIgnoreCase(isSuperRole, "f") && 
StringUtils.equalsIgnoreCase(isReplicationRole, "f")) {
+                log.info("checkPrivilege: isSuperRole: {}, isReplicationRole: 
{}, isSystemAdminRole:{}", isSuperRole, isReplicationRole, isSystemAdminRole);

Review Comment:
   Is it just available in openGauss? If it's, could we create a openGauss impl 
of DataSourceChecker?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to