diff --git a/aixun-api/aixun-api-integration/src/main/java/cn/aixunkeji/datagov/integration/api/RealtimeCollectionService.java b/aixun-api/aixun-api-integration/src/main/java/cn/aixunkeji/datagov/integration/api/RealtimeCollectionService.java new file mode 100644 index 0000000..d4e783c --- /dev/null +++ b/aixun-api/aixun-api-integration/src/main/java/cn/aixunkeji/datagov/integration/api/RealtimeCollectionService.java @@ -0,0 +1,65 @@ +package cn.aixunkeji.datagov.integration.api; + +import java.io.Serializable; +import java.util.List; + +/** Internal owner-authorized CDC execution contract; never exposed as a public request. */ +public interface RealtimeCollectionService { + Check check(Command command); + Result execute(Command command, String action, String externalId, String restoreId); + List relays(long actorId,long orgId,long sourceId); + record RelayOption(String id,String name,String schema,String table,String format) implements Serializable { } + record Spec(String name, long sourceId, long sourceVersion, String sourceDatabase, String sourceTable, + long targetResourceId, long targetSpaceId, String targetTable, int httpPort, + String startupMode, int checkpointSeconds, long serverId, String sourceSchema, + String oracleDatabase,String cdcChannel,String oraclePdb,String oracleCdbService) implements Serializable { + public Spec(String name,long sourceId,long sourceVersion,String sourceDatabase,String sourceTable, + long targetResourceId,long targetSpaceId,String targetTable,int httpPort,String startupMode, + int checkpointSeconds,long serverId,String sourceSchema,String oracleDatabase,String cdcChannel) { + this(name,sourceId,sourceVersion,sourceDatabase,sourceTable,targetResourceId,targetSpaceId,targetTable, + httpPort,startupMode,checkpointSeconds,serverId,sourceSchema,oracleDatabase,cdcChannel,null,null); + } + public Spec(String name,long sourceId,long sourceVersion,String sourceDatabase,String sourceTable, + long targetResourceId,long targetSpaceId,String targetTable,int httpPort,String startupMode, + int checkpointSeconds,long serverId,String sourceSchema,String oracleDatabase) { + this(name,sourceId,sourceVersion,sourceDatabase,sourceTable,targetResourceId,targetSpaceId,targetTable, + httpPort,startupMode,checkpointSeconds,serverId,sourceSchema,oracleDatabase,null); + } + public Spec(String name, long sourceId, long sourceVersion, String sourceDatabase, String sourceTable, + long targetResourceId, long targetSpaceId, String targetTable, int httpPort, + String startupMode, int checkpointSeconds, long serverId) { + this(name, sourceId, sourceVersion, sourceDatabase, sourceTable, targetResourceId, targetSpaceId, + targetTable, httpPort, startupMode, checkpointSeconds, serverId, null, null); + } + /** Keep existing MySQL checkpoint fingerprints stable across the contract extension. */ + public String fingerprintText() { + String legacy = "Spec[name="+name+", sourceId="+sourceId+", sourceVersion="+sourceVersion+ + ", sourceDatabase="+sourceDatabase+", sourceTable="+sourceTable+", targetResourceId="+targetResourceId+ + ", targetSpaceId="+targetSpaceId+", targetTable="+targetTable+", httpPort="+httpPort+ + ", startupMode="+startupMode+", checkpointSeconds="+checkpointSeconds+", serverId="+serverId+"]"; + if(oraclePdb!=null || oracleCdbService!=null)return toString(); + String previous=toString().replace(", oraclePdb=null, oracleCdbService=null]","]"); + if(cdcChannel!=null)return previous; + return sourceSchema == null && oracleDatabase == null ? legacy : previous.replace(", cdcChannel=null]","]"); + } + } + record Command(long actorId, long orgId, long taskId, long attempt, Spec spec, + DataCollectionIntegrationService.StorageExecutionProfile target, String fingerprint, + RecoveryEvidence recovery) implements Serializable { + public Command(long actorId,long orgId,long taskId,long attempt,Spec spec, + DataCollectionIntegrationService.StorageExecutionProfile target,String fingerprint) { + this(actorId,orgId,taskId,attempt,spec,target,fingerprint,null); + } + } + /** Supplied only by DataOps from its locked, owner-authorized persisted task. */ + record RecoveryEvidence(String jobId,String status,String checkpointId) implements Serializable { } + record Check(boolean ready, String summary, String fingerprint, List fields, List primaryKeys) + implements Serializable { } + record Result(String status, String externalId, String summary, String checkpointId, Long readRows, + Long writeRows) implements Serializable { } + static String identity(long org, long task, long attempt) { return "realtime:" + org + ':' + task + ':' + attempt; } + static String jobName(long task, long attempt) { return "aixun_cdc_" + task + '_' + attempt; } + static String jobId(long org, long task, long attempt) { + return Long.toString(DataCollectionIntegrationService.stableJobId(identity(org, task, attempt))); + } +} diff --git a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionService.java b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionService.java index 30a377c..52c6e88 100644 --- a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionService.java +++ b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionService.java @@ -75,6 +75,14 @@ public class UnifiedIngestionService { } public SourcePage sources(String keyword) { + return sources(keyword, false); + } + + public SourcePage realtimeSources(String keyword) { + return sources(keyword, true); + } + + private SourcePage sources(String keyword, boolean realtime) { BatchActor actor = actors.current(); var result = sources.sources(actor.actorId(), actor.orgScopeId(), List.of(), keyword, 200); if (result == null || !"AVAILABLE".equals(result.status()) || result.entries() == null) @@ -86,8 +94,12 @@ public class UnifiedIngestionService { && Set.of("ORACLE", "DAMENG", "KINGBASE").contains(item.type().toUpperCase(java.util.Locale.ROOT)); boolean available = mysql && item.previewEligible() || (sqlServer || pilot) && item.credentialConfigured() && "SUCCEEDED".equals(item.status()) && item.databaseName() != null && !item.databaseName().isBlank(); + if (realtime) available = Set.of("MYSQL","SQLSERVER","ORACLE","DAMENG","KINGBASE").contains(item.type()) + && item.credentialConfigured() && "SUCCEEDED".equals(item.status()) + && item.databaseName() != null && !item.databaseName().isBlank(); String reason = mysql ? item.previewReason() : sqlServer ? "请先配置数据库凭据并通过连接测试" : "该数据源类型暂不可用于数据采集"; + if (realtime) reason = "请在数据源管理中配置凭据并通过连接测试"; return new Source(item.id(), item.name(), item.type(), item.status(), item.databaseName(), available, available ? null : reason, item.version()); }).toList(); @@ -163,7 +175,7 @@ public class UnifiedIngestionService { throw BatchIngestionException.validation("请选择Hive或Doris目标"); var page = storage.page(null, type, true, 1, 100); List rows = page.getRows().stream().map(resource -> { - var detail = storage.detail(resource.resourceId()); + var detail = storage.selectionDetail(resource.resourceId()); List databases = detail.spaces().stream().filter(space -> space.enabled()) .map(space -> new TargetDatabase(space.spaceId(), space.name(), space.externalObjectId(), space.version())) .toList(); diff --git a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeController.java b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeController.java new file mode 100644 index 0000000..e27ce73 --- /dev/null +++ b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeController.java @@ -0,0 +1,34 @@ +package cn.aixunkeji.datagov.dataops.realtime; + +import cn.aixunkeji.common.core.domain.R; +import cn.aixunkeji.common.log.annotation.Log; +import cn.aixunkeji.common.log.enums.BusinessType; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Spec; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/dataops/v1/realtime-ingestions") +public class RealtimeController { + private final RealtimeService service; + public RealtimeController(RealtimeService service){this.service=service;} + @org.springframework.beans.factory.annotation.Autowired + private cn.aixunkeji.datagov.dataops.batchingestion.UnifiedIngestionService directory; + @GetMapping("/source-options") @SaCheckPermission("aixun:dataops:realtime:manage") + public R sources(@RequestParam(required=false) String keyword){return R.ok(directory.realtimeSources(keyword));} + @GetMapping("/relay-options") @SaCheckPermission("aixun:dataops:realtime:manage") + public R> relays(@RequestParam long sourceId){return R.ok(service.relays(sourceId));} + @GetMapping @SaCheckPermission("aixun:dataops:realtime:view") + public R list(@RequestParam(defaultValue="1") int pageNum,@RequestParam(defaultValue="20") int pageSize){return R.ok(service.list(pageNum,pageSize));} + @GetMapping("/{id}") @SaCheckPermission("aixun:dataops:realtime:view") + public R get(@PathVariable long id){return R.ok(service.get(id));} + @PostMapping @SaCheckPermission("aixun:dataops:realtime:manage") + @Log(title="实时采集创建",businessType=BusinessType.INSERT,isSaveRequestData=false,isSaveResponseData=false) + public R create(@RequestBody Spec spec,@RequestHeader("Idempotency-Key") String key){return R.ok(service.create(spec,key));} + @PostMapping("/{id}/{action}") @SaCheckPermission("aixun:dataops:realtime:manage") + @Log(title="实时采集操作",businessType=BusinessType.OTHER,isSaveRequestData=false,isSaveResponseData=false) + public R action(@PathVariable long id,@PathVariable String action,@RequestBody RealtimeService.Action request){return R.ok(service.action(id,action,request));} + @PutMapping("/{id}") @SaCheckPermission("aixun:dataops:realtime:manage") + @Log(title="实时采集修改",businessType=BusinessType.UPDATE,isSaveRequestData=false,isSaveResponseData=false) + public R update(@PathVariable long id,@RequestBody RealtimeService.Update request){return R.ok(service.update(id,request));} +} diff --git a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeService.java b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeService.java new file mode 100644 index 0000000..a37e891 --- /dev/null +++ b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeService.java @@ -0,0 +1,216 @@ +package cn.aixunkeji.datagov.dataops.realtime; + +import cn.aixunkeji.common.core.exception.ServiceException; +import cn.aixunkeji.common.json.utils.JsonUtils; +import cn.aixunkeji.common.mybatis.utils.IdGeneratorUtil; +import cn.aixunkeji.common.satoken.utils.LoginHelper; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.*; +import cn.aixunkeji.datagov.integration.api.DataCollectionIntegrationService.StorageExecutionProfile; +import cn.aixunkeji.datagov.dataops.storage.StorageTableFileReferenceDirectory; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.stereotype.Service; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.transaction.support.TransactionTemplate; +import java.time.LocalDateTime; +import java.util.*; + +@Service +public class RealtimeService { + private final JdbcTemplate db; + private final TransactionTemplate tx; + private final StorageTableFileReferenceDirectory targets; + @DubboReference(check=false,timeout=120000,retries=0) private RealtimeCollectionService integration; + public RealtimeService(JdbcTemplate db,TransactionTemplate tx,StorageTableFileReferenceDirectory targets) { + this.db=db;this.tx=tx;this.targets=targets; + } + public record View(String id,Spec spec,String status,long version,long attempt,String externalId, + String checkpointId,String summary,Long readRows,Long writeRows,LocalDateTime observedAt, + List> history) { } + public record Page(List rows,long total) { } + public record Action(long version,String key) { } + public record Update(long version,Spec spec) { } + record Row(long id,long owner,long org,Spec spec,String status,long version,long attempt,String external, + String fingerprint,String checkpoint,String summary,Long readRows,Long writeRows, + LocalDateTime observedAt,LocalDateTime busyUntil) { } + private long actor() {Long id=LoginHelper.getUserId();if(id==null)throw new ServiceException("请先登录");return id;} + private long org() {Long id=LoginHelper.getDeptId();if(id==null)throw new ServiceException("缺少组织信息");return id;} + private static void key(String k) {if(k==null||!k.matches("[A-Za-z0-9_-]{16,80}"))throw new ServiceException("请求标识无效");} + public Page list(int page,int size) { + if(page<1||size<1||size>100)throw new ServiceException("分页参数无效"); + long a=actor(),o=org(); + long total=db.queryForObject("SELECT COUNT(*) FROM ing_realtime_task WHERE org_id=? AND owner_id=? AND status<>'ARCHIVED'",Long.class,o,a); + var rows=db.query("SELECT * FROM ing_realtime_task WHERE org_id=? AND owner_id=? AND status<>'ARCHIVED' ORDER BY updated_at DESC,id DESC LIMIT ? OFFSET ?", + (rs,n)->map(rs),o,a,size,(long)(page-1)*size); + return new Page(rows.stream().map(r->view(r,false)).toList(),total); + } + public View get(long id) {return view(require(id,false),true);} + public List relays(long sourceId){return integration.relays(actor(),org(),sourceId);} + private Row require(long id,boolean lock) { + var rows=db.query("SELECT * FROM ing_realtime_task WHERE id=? AND org_id=? AND owner_id=?"+(lock?" FOR UPDATE":""), + (rs,n)->map(rs),id,org(),actor()); + if(rows.size()!=1)throw new ServiceException("任务不存在或无权访问");return rows.getFirst(); + } + public View create(Spec p,String key) { + key(key); validate(p); + return tx.execute(status->{ + var old=db.query("SELECT * FROM ing_realtime_task WHERE org_id=? AND owner_id=? AND create_key=?",(rs,n)->map(rs),org(),actor(),key); + if(!old.isEmpty()) {if(!old.getFirst().spec().equals(p))throw new ServiceException("请求标识已用于其他配置");return view(old.getFirst(),false);} + long id=IdGeneratorUtil.nextLongId(); + // Resolve the owner-approved target before storing a public configuration. + target(actor(),org(),p); + try {db.update("INSERT INTO ing_realtime_task(id,owner_id,org_id,create_key,config_json,source_id,server_id,target_key,status,version,attempt,created_at,updated_at) VALUES(?,?,?,?,?,?,?,?, 'DRAFT',0,0,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)", + id,actor(),org(),key,JsonUtils.toJsonString(p),p.sourceId(),p.serverId(),p.targetResourceId()+":"+p.targetSpaceId()+":"+p.targetTable());} + catch(org.springframework.dao.DuplicateKeyException ex){throw new ServiceException("同一源库的server-id或目标表已被实时任务占用,请检查已有任务");} + return view(require(id,false),false); + }); + } + static void validate(Spec p) { + if(p==null||p.name()==null||p.name().isBlank()||p.name().length()>100||p.sourceId()<1||p.sourceVersion()<0|| + p.targetResourceId()<1||p.targetSpaceId()<1||p.httpPort()<1||p.httpPort()>65535||p.serverId()<1||p.serverId()>4294967295L|| + p.checkpointSeconds()<10||p.checkpointSeconds()>3600||p.startupMode()==null||!Set.of("initial","latest").contains(p.startupMode())) + throw new ServiceException("实时采集配置不完整或超出允许范围"); + if(p.sourceDatabase()==null||!p.sourceDatabase().matches("[A-Za-z_][A-Za-z0-9_.-]{0,127}")) + throw new ServiceException("来源数据库或服务名格式无效"); + for(String v:Arrays.asList(p.sourceTable(),p.targetTable())) + if(v==null||!v.matches("[A-Za-z_][A-Za-z0-9_]{0,63}"))throw new ServiceException("库表名称只支持字母、数字和下划线"); + for(String v:Arrays.asList(p.sourceSchema(),p.oracleDatabase(),p.oraclePdb())) + if(v!=null&&!v.matches("[A-Za-z_][A-Za-z0-9_$#]{0,127}"))throw new ServiceException("架构、Oracle数据库或PDB名称格式无效"); + if(p.cdcChannel()!=null&&!p.cdcChannel().matches("[A-Za-z0-9_-]{1,64}"))throw new ServiceException("日志通道标识无效"); + if(p.oracleCdbService()!=null&&!p.oracleCdbService().matches("[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}")) + throw new ServiceException("CDB根容器服务名格式无效"); + } + public View update(long id,Update request) { + if(request==null)throw new ServiceException("请求不能为空");validate(request.spec()); + return tx.execute(status->{ + var r=require(id,true);allowed(r,"CHECK"); + if(r.version()!=request.version() || r.busyUntil()!=null&&r.busyUntil().isAfter(LocalDateTime.now())) + throw new ServiceException("任务已变化或正在处理,请刷新"); + var p=request.spec();target(r.owner(),r.org(),p); + try {db.update("UPDATE ing_realtime_task SET config_json=?,source_id=?,server_id=?,target_key=?,fingerprint=NULL,status='DRAFT',summary=NULL,version=version+1,updated_at=CURRENT_TIMESTAMP WHERE id=?", + JsonUtils.toJsonString(p),p.sourceId(),p.serverId(),p.targetResourceId()+":"+p.targetSpaceId()+":"+p.targetTable(),id);} + catch(org.springframework.dao.DuplicateKeyException e){throw new ServiceException("server-id或目标表已被其他任务占用");} + return view(require(id,false),false); + }); + } + public View action(long id,String action,Action request) { + if(request==null)throw new ServiceException("请求不能为空");key(request.key()); + if(!Set.of("CHECK","START","REFRESH","STOP","RESUME","ARCHIVE","DELETE","RECREATE").contains(action))throw new ServiceException("操作无效"); + Row prior=require(id,false); + Row reserved=tx.execute(status->{ + Row r=require(id,true); + var previous=db.queryForList("SELECT action FROM ing_realtime_event WHERE task_id=? AND request_key=?",id,request.key()); + if(!previous.isEmpty()) { + if(!action.equals(previous.getFirst().get("ACTION"))&&!action.equals(previous.getFirst().get("action")))throw new ServiceException("请求标识已被其他操作使用"); + return null; + } + if(r.version()!=request.version())throw new ServiceException("任务版本已变化,请刷新"); + if(r.busyUntil()!=null&&r.busyUntil().isAfter(LocalDateTime.now()))throw new ServiceException("操作仍在处理中,请稍后刷新"); + allowed(r,action); + // SeaTunnel 2.3.13 restores the same job ID; a new ID would start a new snapshot. + long nextAttempt=r.attempt()+(action.equals("START")?1:0); + String external=nextAttempt>0?RealtimeCollectionService.jobId(r.org(),r.id(),nextAttempt):null; + String state=action.equals("START")||action.equals("RESUME")?"SUBMITTING":action.equals("STOP")?"STOPPING":r.status(); + db.update("UPDATE ing_realtime_task SET status=?,version=version+1,attempt=?,external_id=?,busy_until=?,updated_at=CURRENT_TIMESTAMP WHERE id=?",state,nextAttempt,external,LocalDateTime.now().plusMinutes(3),id); + db.update("INSERT INTO ing_realtime_event(id,task_id,request_key,action,status,created_at) VALUES(?,?,?,?, 'PENDING',CURRENT_TIMESTAMP)",IdGeneratorUtil.nextId(),id,request.key(),action); + return require(id,false); + }); + if(reserved==null) { + if("RECREATE".equals(action)) { + var replacement=db.query("SELECT * FROM ing_realtime_task WHERE org_id=? AND owner_id=? AND create_key=?", + (rs,n)->map(rs),org(),actor(),request.key()); + if(!replacement.isEmpty())return view(replacement.getFirst(),true); + } + return get(id); + } + Row r=reserved; + String state="UNKNOWN",summary="外部结果待确认,请刷新状态",fingerprint=r.fingerprint(),checkpoint=r.checkpoint(); + Long read=r.readRows(),written=r.writeRows(); long attempt=r.attempt(); String external=r.external(); + boolean invoked=false; + try { + if(action.equals("ARCHIVE") || action.equals("DELETE") && r.attempt()==0) { + state="ARCHIVED";summary=action.equals("DELETE")?"任务已删除,历史操作记录保留":"草稿已归档"; + } + else { + var command=new Command(r.owner(),r.org(),r.id(),r.attempt(),r.spec(), + Set.of("CHECK","START","RESUME").contains(action)?target(r.owner(),r.org(),r.spec()):null,r.fingerprint(), + action.equals("RESUME")?new RecoveryEvidence(prior.external(),prior.status(),prior.checkpoint()):null); + if(action.equals("CHECK")) { + var c=integration.check(command);state=c.ready()?"READY":"DRAFT";summary=c.summary();fingerprint=c.fingerprint(); + } else { + invoked=true; + var result=integration.execute(command,action.equals("DELETE")?"REFRESH":action,r.external(),action.equals("RESUME")? + r.external():null); + if(result==null || !Objects.equals(r.external(),result.externalId()))throw new IllegalStateException("CDC_RESULT_IDENTITY_MISMATCH"); + result=retainConfirmedTerminal(action,prior,result); + state=result.status();summary=result.summary();checkpoint=result.checkpointId();read=result.readRows();written=result.writeRows(); + if(action.equals("DELETE")) { + if(terminal(state)) {state="ARCHIVED";summary="任务已删除,历史操作记录保留";} + else summary="未删除:外部作业尚未确认结束,请同步状态后重试"; + } + if("REJECTED".equals(state)) { + attempt=prior.attempt();state=prior.status();external=prior.external();checkpoint=prior.checkpoint(); + } + } + } + } catch(RuntimeException ex) { + if(action.equals("CHECK")) {state="DRAFT";summary="校验未完成,请检查来源、目标授权和集成服务";} + else if(!invoked && Set.of("START","RESUME").contains(action)) { + state=prior.status();attempt=prior.attempt();external=prior.external();checkpoint=prior.checkpoint(); + summary="来源或目标授权检查未通过,未提交外部作业"; + } + } + final String finalState=state, finalSummary=summary, finalFingerprint=fingerprint, finalCheckpoint=checkpoint,finalExternal=external; + final Long finalRead=read, finalWritten=written;final long finalAttempt=attempt; + return tx.execute(status->{ + boolean recreate="RECREATE".equals(action) && "ABSENT".equals(finalState); + String storedState=recreate?"ARCHIVED":finalState; + int changed=db.update("UPDATE ing_realtime_task SET status=?,summary=?,fingerprint=?,checkpoint_id=?,read_rows=?,write_rows=?,attempt=?,external_id=?,observed_at=CURRENT_TIMESTAMP,busy_until=NULL,version=version+1,updated_at=CURRENT_TIMESTAMP WHERE id=? AND version=?", + storedState,finalSummary,finalFingerprint,finalCheckpoint,finalRead,finalWritten,finalAttempt,finalExternal,id,r.version()); + db.update("UPDATE ing_realtime_event SET status=?,summary=? WHERE task_id=? AND request_key=?", + changed==1?storedState:"STALE",finalSummary,id,request.key()); + if(changed==1 && "ARCHIVED".equals(storedState)) db.update("UPDATE ing_realtime_task SET target_key=?,server_id=? WHERE id=?","archived:"+id,-id,id); + if(changed==1 && recreate) return create(r.spec(),request.key()); + return get(id); + }); + } + static RealtimeCollectionService.Result retainConfirmedTerminal(String action,Row prior,RealtimeCollectionService.Result observed) { + if("REFRESH".equals(action) && terminal(prior.status()) && "UNKNOWN".equals(observed.status())) + return new RealtimeCollectionService.Result(prior.status(),observed.externalId(), + "保留上次已确认的终态;本次引擎状态未能核实。检查点及计数为历史记录,恢复前仍须验证:"+ + (observed.summary()==null?"外部记录不可查询":observed.summary()), + prior.checkpoint(),prior.readRows(),prior.writeRows()); + return observed; + } + static void allowed(Row r,String action) { + if("ARCHIVED".equals(r.status()))throw new ServiceException("任务已删除或归档"); + boolean ok=switch(action) { + case "CHECK","ARCHIVE" -> r.attempt()==0 && Set.of("DRAFT","READY").contains(r.status()); + case "DELETE" -> r.attempt()==0 && Set.of("DRAFT","READY").contains(r.status()) || terminal(r.status()); + case "START" -> r.attempt()==0 && "READY".equals(r.status()) && r.fingerprint()!=null; + case "RESUME" -> r.attempt()>0 && Set.of("FAILED","CANCELED").contains(r.status()) && r.checkpoint()!=null; + case "STOP","REFRESH" -> r.attempt()>0; + case "RECREATE" -> r.attempt()>0 && "UNKNOWN".equals(r.status()) && r.checkpoint()==null; + default -> false; + }; + if(!ok)throw new ServiceException("当前状态不允许此操作;恢复需要原作业终止且有已完成checkpoint"); + } + static boolean terminal(String state) {return Set.of("FAILED","CANCELED","SUCCEEDED").contains(state);} + private StorageExecutionProfile target(long a,long o,Spec p) { + var t=targets.resolveForIngestion(a,o,p.targetResourceId(),p.targetSpaceId()); + if(t.status()!=StorageTableFileReferenceDirectory.Status.AUTHORIZED||!"DORIS".equals(t.resourceType())) + throw new ServiceException("目标Doris资源或数据库未授权或未启用"); + return new StorageExecutionProfile(p.targetResourceId(),p.targetSpaceId(),t.resourceType(),t.catalogName(),t.externalSpaceId(),t.locationUri(),t.endpointHost(),t.endpointPort(),t.serviceAccount(),t.secretRef(),t.tlsEnabled()); + } + private View view(Row r,boolean history) { + return new View(Long.toString(r.id()),r.spec(),r.status(),r.version(),r.attempt(),r.external(),r.checkpoint(),r.summary(),r.readRows(),r.writeRows(),r.observedAt(), + history?db.queryForList("SELECT action,status,summary,created_at FROM ing_realtime_event WHERE task_id=? ORDER BY created_at DESC,id DESC LIMIT 50",r.id()):List.of()); + } + private Row map(java.sql.ResultSet rs)throws java.sql.SQLException { + var observed=rs.getTimestamp("observed_at");var busy=rs.getTimestamp("busy_until"); + return new Row(rs.getLong("id"),rs.getLong("owner_id"),rs.getLong("org_id"),JsonUtils.parseObject(rs.getString("config_json"),Spec.class), + rs.getString("status"),rs.getLong("version"),rs.getLong("attempt"),rs.getString("external_id"),rs.getString("fingerprint"),rs.getString("checkpoint_id"),rs.getString("summary"), + rs.getObject("read_rows")==null?null:rs.getLong("read_rows"),rs.getObject("write_rows")==null?null:rs.getLong("write_rows"), + observed==null?null:observed.toLocalDateTime(),busy==null?null:busy.toLocalDateTime()); + } +} diff --git a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceRepository.java b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceRepository.java index 1ba3f39..9f3d89f 100644 --- a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceRepository.java +++ b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceRepository.java @@ -123,6 +123,8 @@ public class StorageResourceRepository { } private void assertUnused(long resourceId, Long spaceId) { + rejectUsed(count("SELECT COUNT(*) FROM ing_realtime_task WHERE target_key LIKE ?", + resourceId + ":" + (spaceId == null ? "" : spaceId + ":") + "%")); if (spaceId == null && count("SELECT COUNT(*) FROM store_space WHERE resource_id=? AND del_flag='0'", resourceId) != 0) throw new StorageConflictException("请先删除未使用的空间登记"); String[][] references = { diff --git a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceService.java b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceService.java index 9ddd7f8..697894b 100644 --- a/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceService.java +++ b/aixun-modules/aixun-dataops/src/main/java/cn/aixunkeji/datagov/dataops/storage/StorageResourceService.java @@ -83,6 +83,14 @@ public class StorageResourceService { return detail(currentActor(), resourceId); } + /** Selection lists need registered references, not capacity history and its per-snapshot dimensions. */ + public StorageResourceDetailView selectionDetail(long resourceId) { + StorageActor actor = currentActor(); + StorageResourceView resource = repository.requireResource(actor, positiveId(resourceId, "资源ID")); + return new StorageResourceDetailView(resource, List.copyOf(repository.spaces(resourceId)), + repository.accessProfile(resourceId), List.of()); + } + /** Server-derived identity only; ingestion never inherits the administrator scope bypass. */ public StorageResourceDetailView detailForIngestion(long actorId, long orgId, long resourceId) { if (actorId <= 0 || orgId <= 0) throw new StorageScopeException(); diff --git a/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionRecoveryTest.java b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionRecoveryTest.java index 03d2ca7..acdbfb1 100644 --- a/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionRecoveryTest.java +++ b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/batchingestion/UnifiedIngestionRecoveryTest.java @@ -34,6 +34,16 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; class UnifiedIngestionRecoveryTest { + @Test void realtimeDirectoryDoesNotReuseBatchPilotGateOrLoseCredentialGate() { + var f=new CommentFixture(""); + when(f.sources.sources(1,2,List.of(),null,200)).thenReturn(new DataSourceDirectoryService.Result("AVAILABLE",List.of( + new DataSourceDirectoryService.Entry(7L,"dm","DAMENG","SUCCEEDED",true,false,null,"APP",1), + new DataSourceDirectoryService.Entry(8L,"kb","KINGBASE","SUCCEEDED",false,false,null,"app",1), + new DataSourceDirectoryService.Entry(9L,"bad","KINGBASE","FAILED",true,false,null,"app",1)))); + assertThat(f.service.sources(null).rows()).allMatch(x->!x.available()); + assertThat(f.service.realtimeSources(null).rows()).extracting(x->x.available()).containsExactly(true,false,false); + verify(f.sources,org.mockito.Mockito.times(2)).sources(1,2,List.of(),null,200); + } @Test void absentOrFalseConsumerSettingRejectsNewRequestsWithoutReservationOrRpc() { var fixture = new CommentFixture("原注释"); diff --git a/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeJdbcTest.java b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeJdbcTest.java new file mode 100644 index 0000000..c808831 --- /dev/null +++ b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimeJdbcTest.java @@ -0,0 +1,106 @@ +package cn.aixunkeji.datagov.dataops.realtime; + +import cn.aixunkeji.common.satoken.utils.LoginHelper; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.*; +import cn.aixunkeji.datagov.dataops.storage.StorageTableFileReferenceDirectory; +import org.junit.jupiter.api.*; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import tools.jackson.databind.json.JsonMapper; +import java.util.*; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** Executes production DM repository SQL; every test rolls its synthetic records back. */ +@EnabledIfEnvironmentVariable(named="DATAGOV_DM_SCHEMA",matches="AIXUN_DATAGOV_DM_TEST") +class RealtimeJdbcTest { + @BeforeAll static void beans(){ + var b=new DefaultListableBeanFactory(); + b.registerSingleton("identifierGenerator",com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator.getInstance()); + b.registerSingleton("jsonMapper",JsonMapper.builder().findAndAddModules().build()); + new cn.hutool.extra.spring.SpringUtil().postProcessBeanFactory(b); + } + @Test void durableLifecycleReplayVersionAndScope() throws Exception { + var ds=new DriverManagerDataSource();ds.setDriverClassName("dm.jdbc.driver.DmDriver"); + ds.setUrl("jdbc:dm://"+System.getenv("DATAGOV_DM_HOST")+":"+System.getenv("DATAGOV_DM_PORT")); + ds.setUsername(System.getenv("DATAGOV_DM_USERNAME"));ds.setPassword(System.getenv("DATAGOV_DM_PASSWORD")); + var props=new Properties();props.setProperty("schema",System.getenv("DATAGOV_DM_SCHEMA"));ds.setConnectionProperties(props); + var db=new JdbcTemplate(ds);var tx=new TransactionTemplate(new DataSourceTransactionManager(ds)); + var targets=mock(StorageTableFileReferenceDirectory.class);var provider=mock(RealtimeCollectionService.class); + when(targets.resolveForIngestion(anyLong(),anyLong(),anyLong(),anyLong())).thenReturn(new StorageTableFileReferenceDirectory.Resolution( + StorageTableFileReferenceDirectory.Status.AUTHORIZED,"DORIS","test","test",null,"test.local",9030,"test","secret:test",false)); + var service=new RealtimeService(db,tx,targets); + var field=RealtimeService.class.getDeclaredField("integration");field.setAccessible(true);field.set(service,provider); + try(var login=mockStatic(LoginHelper.class)){ + login.when(LoginHelper::getUserId).thenReturn(900001L);login.when(LoginHelper::getDeptId).thenReturn(900002L); + tx.executeWithoutResult(status->{ + status.setRollbackOnly(); + var spec=new Spec("CDC rollback test",900001,1,"source","orders",900003,900004,"target",8030,"initial",30,900005); + String createKey=UUID.randomUUID().toString();var created=service.create(spec,createKey); + assertThat(service.create(spec,createKey).id()).isEqualTo(created.id()); + long id=Long.parseLong(created.id()); + when(provider.check(any())).thenReturn(new Check(true,"ready","a".repeat(64),List.of("id"),List.of("id"))); + var ready=service.action(id,"CHECK",action(created));assertThat(ready.status()).isEqualTo("READY"); + var startKey=UUID.randomUUID().toString(); + when(provider.execute(any(),eq("START"),any(),isNull())).thenAnswer(i->new Result("UNKNOWN",i.getArgument(2),"unknown",null,null,null)); + var unknown=service.action(id,"START",new RealtimeService.Action(ready.version(),startKey)); + assertThat(unknown.status()).isEqualTo("UNKNOWN");assertThat(unknown.attempt()).isEqualTo(1); + assertThat(service.action(id,"START",new RealtimeService.Action(ready.version(),startKey)).attempt()).isEqualTo(1); + verify(provider,times(1)).execute(any(),eq("START"),any(),isNull()); + when(provider.execute(any(),eq("REFRESH"),any(),isNull())).thenAnswer(i->new Result("RUNNING",i.getArgument(2),null,"10",12L,12L)); + var running=service.action(id,"REFRESH",action(unknown));assertThat(running.writeRows()).isEqualTo(12L); + when(provider.execute(any(),eq("STOP"),any(),isNull())).thenAnswer(i->new Result("CANCELED",i.getArgument(2),null,"11",12L,12L)); + var stopped=service.action(id,"STOP",action(running));assertThat(stopped.status()).isEqualTo("CANCELED"); + when(provider.execute(any(),eq("RESUME"),any(),anyString())).thenAnswer(i->new Result("RUNNING",i.getArgument(2),null,null,null,null)); + var resumed=service.action(id,"RESUME",action(stopped));assertThat(resumed.attempt()).isEqualTo(1); + assertThat(resumed.externalId()).isEqualTo(stopped.externalId()); + verify(provider).execute(argThat(c->c.recovery()!=null && c.recovery().checkpointId().equals("11") && + c.recovery().status().equals("CANCELED") && c.recovery().jobId().equals(stopped.externalId())),eq("RESUME"),eq(stopped.externalId()),eq(stopped.externalId())); + assertThatThrownBy(()->service.action(id,"DELETE",action(resumed))).hasMessageContaining("当前状态"); + var ended=service.action(id,"STOP",action(resumed)); + // A stale terminal record cannot hide a still-running external job. + var denied=service.action(id,"DELETE",action(ended)); + assertThat(denied.status()).isEqualTo("RUNNING"); + assertThat(service.list(1,20).total()).isEqualTo(1); + ended=service.action(id,"STOP",action(denied)); + when(provider.execute(any(),eq("REFRESH"),any(),isNull())).thenAnswer(i->new Result("FAILED",i.getArgument(2),"failed",null,12L,12L)); + var deleteRequest=action(ended); + var deleted=service.action(id,"DELETE",deleteRequest); + assertThat(deleted.status()).isEqualTo("ARCHIVED"); + assertThat(service.action(id,"DELETE",deleteRequest).status()).isEqualTo("ARCHIVED"); + assertThat(service.list(1,20).total()).isZero(); + assertThat(deleted.history()).isNotEmpty(); + assertThatThrownBy(()->service.action(id,"REFRESH",action(deleted))).hasMessageContaining("已删除"); + // Source server-id and target reservation must both be reusable. + var replacement=service.create(spec,UUID.randomUUID().toString()); + assertThat(replacement.status()).isEqualTo("DRAFT"); + long replacementId=Long.parseLong(replacement.id()); + var readyAgain=service.action(replacementId,"CHECK",action(replacement)); + var unknownAgain=service.action(replacementId,"START",action(readyAgain)); + when(provider.execute(any(),eq("RECREATE"),any(),isNull())).thenAnswer(i->new Result("UNKNOWN",i.getArgument(2),"engine busy",null,null,null)); + var refused=service.action(replacementId,"RECREATE",action(unknownAgain)); + assertThat(refused.status()).isEqualTo("UNKNOWN"); + assertThat(service.list(1,20).total()).isEqualTo(1); + when(provider.execute(any(),eq("RECREATE"),any(),isNull())).thenAnswer(i->new Result("ABSENT",i.getArgument(2),"verified absent",null,null,null)); + var recreateRequest=action(refused); + var rebuilt=service.action(replacementId,"RECREATE",recreateRequest); + assertThat(rebuilt.id()).isNotEqualTo(replacement.id()); + assertThat(rebuilt.spec()).isEqualTo(spec); + assertThat(rebuilt.status()).isEqualTo("DRAFT"); + assertThat(rebuilt.attempt()).isZero(); + assertThat(service.get(replacementId).status()).isEqualTo("ARCHIVED"); + assertThat(service.action(replacementId,"RECREATE",recreateRequest).id()).isEqualTo(rebuilt.id()); + assertThat(service.list(1,20).total()).isEqualTo(1); + login.when(LoginHelper::getUserId).thenReturn(900009L); + assertThat(service.list(1,20).rows()).isEmpty(); + assertThatThrownBy(()->service.get(id)).hasMessageContaining("无权访问"); + }); + } + } + private static RealtimeService.Action action(RealtimeService.View view){return new RealtimeService.Action(view.version(),UUID.randomUUID().toString());} +} diff --git a/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimePolicyTest.java b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimePolicyTest.java new file mode 100644 index 0000000..beef46c --- /dev/null +++ b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/realtime/RealtimePolicyTest.java @@ -0,0 +1,53 @@ +package cn.aixunkeji.datagov.dataops.realtime; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Spec; +import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.*; +class RealtimePolicyTest { + @Test void recreateOnlyUnknownWithoutCheckpoint() { + assertThatCode(()->RealtimeService.allowed(row("UNKNOWN",1,null),"RECREATE")).doesNotThrowAnyException(); + for(String state:java.util.List.of("RUNNING","SUBMITTING","STOPPING","DRAFT","ARCHIVED")) + assertThatThrownBy(()->RealtimeService.allowed(row(state,1,null),"RECREATE")).isInstanceOf(RuntimeException.class); + assertThatThrownBy(()->RealtimeService.allowed(row("UNKNOWN",1,"458"),"RECREATE")).isInstanceOf(RuntimeException.class); + } + @Test void refreshPreservesConfirmedTerminalEvidenceButNeverMasksLiveOrDeleteResult(){ + var missing=new cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Result("UNKNOWN","10","历史记录不可查询",null,null,null); + var saved=RealtimeService.retainConfirmedTerminal("REFRESH",row("CANCELED",1,"458"),missing); + assertThat(saved.status()).isEqualTo("CANCELED"); + assertThat(saved.checkpointId()).isEqualTo("458"); + assertThat(saved.summary()).contains("历史记录","本次引擎状态未能核实"); + assertThat(RealtimeService.retainConfirmedTerminal("REFRESH",row("RUNNING",1,"458"),missing)).isSameAs(missing); + assertThat(RealtimeService.retainConfirmedTerminal("DELETE",row("CANCELED",1,"458"),missing)).isSameAs(missing); + var live=new cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Result("RUNNING","10",null,null,null,null); + assertThat(RealtimeService.retainConfirmedTerminal("REFRESH",row("CANCELED",1,"458"),live)).isSameAs(live); + } + @Test void deleteOnlyDraftOrConfirmedTerminalAndCannotResurrectDeletedTask(){ + for(String state:java.util.List.of("DRAFT","READY")) + assertThatCode(()->RealtimeService.allowed(row(state,0,null),"DELETE")).doesNotThrowAnyException(); + for(String state:java.util.List.of("FAILED","CANCELED","SUCCEEDED")) { + assertThatCode(()->RealtimeService.allowed(row(state,1,null),"DELETE")).doesNotThrowAnyException(); + assertThat(RealtimeService.terminal(state)).isTrue(); + } + for(String state:java.util.List.of("RUNNING","UNKNOWN","SUBMITTING","STOPPING","PENDING","ARCHIVED")) { + assertThatThrownBy(()->RealtimeService.allowed(row(state,1,null),"DELETE")).isInstanceOf(RuntimeException.class); + assertThat(RealtimeService.terminal(state)).isFalse(); + } + assertThatThrownBy(()->RealtimeService.allowed(row("ARCHIVED",1,null),"REFRESH")).isInstanceOf(RuntimeException.class); + } + static RealtimeService.Row row(String status,long attempt,String checkpoint){return new RealtimeService.Row(1,2,3,null,status,0,attempt,null,"a".repeat(64),checkpoint,null,null,null,null,null);} + @Test void cannotStartAgainOrResumeUnknownJob(){ + assertThatThrownBy(()->RealtimeService.allowed(row("UNKNOWN",1,"1"),"START")).isInstanceOf(RuntimeException.class); + assertThatThrownBy(()->RealtimeService.allowed(row("UNKNOWN",1,"1"),"RESUME")).isInstanceOf(RuntimeException.class); + assertThatThrownBy(()->RealtimeService.allowed(row("RUNNING",1,"1"),"RESUME")).isInstanceOf(RuntimeException.class); + } + @Test void resumeRequiresTerminalAndCheckpoint(){ + assertThatThrownBy(()->RealtimeService.allowed(row("CANCELED",1,null),"RESUME")).isInstanceOf(RuntimeException.class); + assertThatCode(()->RealtimeService.allowed(row("CANCELED",1,"2"),"RESUME")).doesNotThrowAnyException(); + assertThatCode(()->RealtimeService.allowed(row("UNKNOWN",1,null),"REFRESH")).doesNotThrowAnyException(); + } + @Test void rejectsSqlIdentifiersAndMissingHttpPort(){ + assertThatThrownBy(()->RealtimeService.validate(spec("orders;DROP TABLE x",8030))).isInstanceOf(RuntimeException.class); + assertThatThrownBy(()->RealtimeService.validate(spec("orders",0))).isInstanceOf(RuntimeException.class); + assertThatCode(()->RealtimeService.validate(spec("orders",8030))).doesNotThrowAnyException(); + } + static Spec spec(String table,int port){return new Spec("同步",1,0,"sales",table,2,3,"orders",port,"initial",30,1001);} +} diff --git a/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/storage/StorageSelectionDetailTest.java b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/storage/StorageSelectionDetailTest.java new file mode 100644 index 0000000..660e7a1 --- /dev/null +++ b/aixun-modules/aixun-dataops/src/test/java/cn/aixunkeji/datagov/dataops/storage/StorageSelectionDetailTest.java @@ -0,0 +1,39 @@ +package cn.aixunkeji.datagov.dataops.storage; + +import cn.aixunkeji.common.satoken.utils.LoginHelper; +import cn.aixunkeji.datagov.dataops.api.storage.StorageResourceView; +import org.junit.jupiter.api.Test; +import java.util.List; +import static org.mockito.Mockito.*; +import static org.assertj.core.api.Assertions.*; + +class StorageSelectionDetailTest { + @Test void selectionDoesNotLoadTelemetryHistoryAndPreservesScope() { + var repository=mock(StorageResourceRepository.class); + var service=new StorageResourceService(repository,mock(StorageTelemetryGateway.class),mock(StorageManagedCredentialGateway.class)); + var actor=new StorageActor(10,20,false); + var resource=mock(StorageResourceView.class); + when(repository.requireResource(actor,30)).thenReturn(resource); + when(repository.spaces(30)).thenReturn(List.of()); + try(var login=mockStatic(LoginHelper.class)) { + login.when(LoginHelper::getUserId).thenReturn(10L); + login.when(LoginHelper::getDeptId).thenReturn(20L); + assertThat(service.selectionDetail(30).resource()).isSameAs(resource); + verify(repository).requireResource(actor,30); + verify(repository).spaces(30); + verify(repository).accessProfile(30); + verifyNoMoreInteractions(repository); + } + } + @Test void deniedResourceNeverReadsSpacesOrCredentials() { + var repository=mock(StorageResourceRepository.class); + var service=new StorageResourceService(repository,mock(StorageTelemetryGateway.class),mock(StorageManagedCredentialGateway.class)); + when(repository.requireResource(any(),eq(30L))).thenThrow(new StorageScopeException()); + try(var login=mockStatic(LoginHelper.class)) { + login.when(LoginHelper::getUserId).thenReturn(10L); + assertThatThrownBy(()->service.selectionDetail(30)).isInstanceOf(StorageScopeException.class); + verify(repository).requireResource(any(),eq(30L)); + verifyNoMoreInteractions(repository); + } + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/README.md b/aixun-modules/aixun-integration/seatunnel-native-cdc/README.md new file mode 100644 index 0000000..cff5b8f --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/README.md @@ -0,0 +1,62 @@ +# 达梦、金仓原生 CDC 交付记录 + +2026-11-24 更新:达梦归档窗口已改为连续分批推进,取消累计 2000 文件上限;本地插件及页面已发布,原任务从保存点 67 恢复后完成检查点 68–70。详见 `evidence/dameng-window-20261124.md`(项目根目录)。下文原始发布记录保留其当时验收边界。 + +2026-11-23,用户授权“继续补齐达梦和金仓的功能”。自研插件运行在现有 SeaTunnel 2.3.13,不新增常驻服务,不依赖 DMHS、FlySync 或 Kafka。代码、部署和真实业务验收分别记录。 + +## 实现 + +- Dameng-Native-CDC:通过 DBMS_LOGMNR 读取达梦归档日志;Kingbase-Native-CDC:通过金仓 JDBC 复制协议读取 test_decoding 槽。 +- 增删改转为 SeaTunnel RowKind,沿用 Doris Unique Key、删除及两阶段提交。 +- initial:保存日志低水位,按组合主键每页读取 500 行,分页位置与日志起点一起进入检查点;完成快照后重放扫描期间的日志。追平前可能暂时看到旧值,不能将快照中间状态作为一致性验收。 +- latest:达梦从启动时 CUR_LSN 开始;金仓从专用复制槽确认位置继续,页面明确区分语义。 +- 检查点保存位置、数据库身份、结构/主键签名、快照分页位置和归档清单;金仓仅在成功检查点后反馈 WAL。缺日志、换库、结构变化时停止,不自动跳过。 +- 页面、任务生成、只读前置检查、中文错误提示已接入。日志通道改为可选,现有 MySQL/Oracle/SQL Server 路径保留。 +- 新增 realtime-ingestions/source-options,复用组织授权目录,保留凭据和连接成功限制;实时采集不再使用批量采集试点 ID 名单。批量入口规则不变。 + +## 支持边界与剩余工作 + +1. 单表、并行度 1、有主键;目标列名及顺序一致,Doris Unique Key 与源主键一致。首次全量目标必须为空,恢复沿用原检查点。 +2. 普通数字、字符串、日期时间;小数精度不超过 38。LOB、二进制、数组、带时区字段和自动 DDL 不支持,校验拒绝。标识符限字母、数字、下划线、美元符和井号。 +3. 达梦按检查点连续推进归档窗口,每轮最多加入 64 个新文件,另外保留未结束事务需要的旧文件及边界文件;不再限制累计历史文件为 2000。缺失所需日志、事务边界或提交位置无法确认时停止,不跳到最新日志。仅缩小插件读取范围,不删除源库归档;每批约 20000 行和查询超时限制仍保留。归档生成频率决定同步延迟。真实长事务及跨重启仍需验收。 +4. 金仓单事务最多 10000 变更事件。实际版本的系统视图、复制协议和提交位置语义需真实源库验收。 +5. 真实源库断网、跨重启恢复和数据一致性未验收,不以序列化测试推导业务 exactly-once。 + +## 源库准备 + +- 达梦:本地归档,ARCH_INI=1、RLOG_APPEND_LOGIC=2、RLOG_LLOG_COMPRESS=0、LOGMNR_DELAY_ANALYZE=0,源表/日志视图/LogMiner 权限。程序不自动调整全局参数或授权。 +- 金仓:wal_level=logical、源表 REPLICA IDENTITY FULL、复制权限和专用 test_decoding 槽。槽名由源 ID/架构/表的 SHA-256 稳定生成,校验提示具体名称,由 DBA 预建;不能共用或提前推进。 +- 页面已确认“企管_达梦”连接成功,可列出 ENTERPRISE_MANAGEMENT 的 10 张表。当前授权目录无金仓数据源。此前平台测试库的日志参数检查不能代替此业务源检查。 + +依据:[达梦 LogMiner 官方说明](https://eco.dameng.com/document/dm/zh-cn/pm/dbms_logmnr-package)、[达梦日志视图](https://eco.dameng.com/document/dm/zh-cn/pm/dm8-admin-manual-appendix2.html)。金仓使用现有官方驱动的 KBConnection/KBReplicationStream API,兼容性以实际版本测试为准。 + +## 验证 + +- PASS:独立 Java 8 插件构建,14 项测试,含完整事务、失败检查点不反馈、组合主键分页续读、结束快照保持日志低水位。 +- PASS:后端定向测试及新增目录测试。原批次有 8 项数据库/进程测试跳过,未计作通过。 +- PASS:前端定向 lint 和生产构建。前端制品首次比对仅发现 Finder 的 .DS_Store 差异,清理该文件后比对通过。 +- PASS:实际 SeaTunnel 2.3.13 离线发现两个插件及驱动;镜像包含插件映射。 +- NOT_RUN:真实金仓;达梦/金仓增删改落库、事务回滚、快照期间写入、长事务、跨重启及完整人工 UAT。未执行业务源 DML、DDL 或全局参数调整。 + +构建入口:script/quality/check.sh --native-cdc。插件 JAR 位于本模块 target/;Docker 构建使用 --build-context native_cdc=aixun-modules/aixun-integration/seatunnel-native-cdc/target,避免重复复制 JAR。 + +## 发布与恢复 + +应用服务使用 script/datagov/deploy.sh;SeaTunnel 使用现有 deploy-seatunnel-cdc.py,在无运行/待提交任务时更换镜像,保留网络、IP、端口、挂载和秘密。无需迁移。 + +本地发布 PASS(制品读回、配置保持通过): + +| 服务 | 最终镜像标签 | image ID 前缀 | +| --- | --- | --- | +| SeaTunnel | 2.3.13-native-vendor-20261123-r3 | d6104ac41277 | +| integration | native-vendor-cdc-20261123-r3 | 36520937a13b | +| dataops | native-vendor-cdc-20261123 | 8d4c7594844d | +| frontend | native-vendor-cdc-20261123-r3 | 81059f83dfdc | + +17:54 Browser 实测:达梦选项可选、默认架构带入、全量选项可用;创建“达梦CDC前置校验(未启动)”并执行只读 CHECK,实际业务源返回 **ARCH_INI 应为 1,当前为 0**。外部作业为空,未启动写入。草稿目标 cdc_dm_probe 仅是校验占位,未创建该表;正式测试前须编辑为真实兼容目标表。截图:evidence/native-cdc-20261123.png。 + +真实 CDC 验收 BLOCKED:业务达梦未启用归档,当前无金仓数据源;未调整业务库全局配置。源码/本地发布 PASS_WITH_LIMITATION,仍有上文归档窗口长期运行缺口,不报告“全部完成”。 + +应用恢复引用各服务发布结果中的 recoveryImageId(integration c3e40cd9f6d7、dataops a85f41c94e47、frontend fed48622ed22);SeaTunnel 可恢复本次工作前的 2.3.13-cdc-complete-20261123(f9a236287c22)。不删除源表、目标表、数据卷和检查点。 + +2026-11-24 Oracle 更新:已补齐官方 Oracle-CDC 2.3.13 的 CDB/PDB 配置、前置检查及元数据/快照会话适配;真实 Oracle 端到端仍为 NOT_RUN。详见项目根目录 evidence/oracle-pdb-20261124.md。 diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/pom.xml b/aixun-modules/aixun-integration/seatunnel-native-cdc/pom.xml new file mode 100644 index 0000000..baca8d7 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + cn.aixunkeji.datagov.integration + connector-aixun-native-cdc + 2.3.13-1 + 8UTF-8 + + com.kingbase8kingbase89.0.1.jre7system${project.basedir}/../../../script/datagov/m2/seatunnel/local/artifacts/kingbase8-9.0.1.jre7.jar + org.apache.seatunnelseatunnel-api2.3.13provided + org.junit.jupiterjunit-jupiter5.12.2test + + + org.apache.maven.pluginsmaven-compiler-plugin3.15.0 + org.apache.maven.pluginsmaven-surefire-plugin3.5.3 + + diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/CommittedBatch.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/CommittedBatch.java new file mode 100644 index 0000000..1ef11c7 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/CommittedBatch.java @@ -0,0 +1,32 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import java.util.*; + +/** Transaction framing independent of driver or engine, with a hard memory limit. */ +public final class CommittedBatch { + public static final class Transaction { + public final String lsn; + public final List changes; + Transaction(String lsn,List changes){this.lsn=lsn;this.changes=Collections.unmodifiableList(changes);} + } + private final KingbaseChangeDecoder decoder=new KingbaseChangeDecoder(); + private final int maxChanges; + private List pending; + private String xid; + public CommittedBatch(int maxChanges){if(maxChanges<1)throw new IllegalArgumentException();this.maxChanges=maxChanges;} + public Transaction accept(String lsn,String message){ + LogPosition.lsn(lsn); + if(message.matches("BEGIN [0-9]+")){ + if(pending!=null)throw new IllegalArgumentException("Overlapping transactions"); + xid=message.substring(6);pending=new ArrayList<>();return null; + } + if(message.startsWith("COMMIT ")){ + if(pending==null||!message.equals("COMMIT "+xid))throw new IllegalArgumentException("Mismatched commit"); + Transaction result=new Transaction(lsn,pending);pending=null;xid=null;return result; + } + if(pending==null)throw new IllegalArgumentException("Change outside transaction"); + if(pending.size()>=maxChanges)throw new IllegalArgumentException("Transaction exceeds configured change limit"); + pending.add(decoder.decode(message));return null; + } + public void requireComplete(){if(pending!=null)throw new IllegalArgumentException("Incomplete transaction; no position acknowledged");} +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindow.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindow.java new file mode 100644 index 0000000..ab1f10e --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindow.java @@ -0,0 +1,91 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import java.util.*; + +/** Inclusive DM LSN ranges; sequence continuity, not an assumed LSN increment, detects gaps. */ +final class DamengArchiveWindow { + static final int NEW_FILES_PER_POLL=64; + static final class File { + final String name; + final long sequence,first,last; + File(String name,long sequence,long first,long last) { + if(name==null||name.isEmpty()||first<0||last select(List catalog,NativeLogSource.Split state) { + if(catalog.isEmpty())throw new IllegalArgumentException("达梦没有可挖掘的归档日志"); + catalog=new ArrayList<>(catalog);catalog.sort(Comparator.comparingLong(f->f.sequence)); + int start=0; + if(state.anchor!=null) { + start=-1; + for(int i=0;i names=new HashSet<>();for(File f:catalog)names.add(f.name); + if(!names.containsAll(state.archives))throw new IllegalArgumentException("检查点所需归档存在缺口,停止采集"); + List result=new ArrayList<>();int fresh=0;File previous=null; + for(int i=start;istate.archiveSequence) { + if(fresh==NEW_FILES_PER_POLL)break; + fresh++; + } + if(previous!=null&&(f.sequence!=previous.sequence+1||f.first retain(List scanned,Long earliestOpen) { + int index=scanned.size()-1; // Keep the boundary file to validate continuity on the next poll. + if(earliestOpen!=null) { + index=-1; + for(int i=0;i=earliestOpen){index=i;break;} + } + if(index<0)throw new IllegalArgumentException("未结束事务的起始归档不完整,禁止推进日志范围"); + } + return new ArrayList<>(scanned.subList(index,scanned.size())); + } + static List names(List files){List names=new ArrayList<>();for(File f:files)names.add(f.name);return names;} + + /** Rebuilt from the pinned prefix on every poll, so in-flight transactions need no row buffer. */ + static final class Transactions { + final Map open=new HashMap<>(); + final Set missingStart=new HashSet<>(); + final Set missingCommit=new HashSet<>(); + final Set committed=new HashSet<>(); + final long first,cutoff,end; + Transactions(long first,long cutoff){this(first,cutoff,Long.MAX_VALUE);} + Transactions(long first,long cutoff,long end){this.first=first;this.cutoff=cutoff;this.end=end;} + void accept(String xid,String operation,long scn,Long start,Long commit,boolean target) { + if("INTERNAL".equals(operation))return; + if(xid==null||xid.isEmpty())throw new IllegalArgumentException("日志缺少事务标识,不能安全推进归档范围"); + if(start!=null && start>0 && start<=scn && start>=first)open.merge(xid,start,Math::min); + if("START".equals(operation)) {open.put(xid,scn);missingStart.remove(xid);committed.remove(xid);missingCommit.remove(xid);return;} + if(!open.containsKey(xid)) {open.put(xid,scn);missingStart.add(xid);} + if(target && (commit==null||commit<=0))missingCommit.add(xid); + if(target && commit!=null && commit>cutoff && (missingStart.contains(xid)||(start!=null&&start>0&&start0&&commit<=end)committed.add(xid); + if("COMMIT".equals(operation)||"ROLLBACK".equals(operation)||"XA_COMMIT".equals(operation)) { + if(!"ROLLBACK".equals(operation)&&scn>cutoff&&missingCommit.contains(xid)) + throw new IllegalArgumentException("达梦未返回完整提交位置,禁止跳过已提交变更"); + open.remove(xid);missingStart.remove(xid);missingCommit.remove(xid); + } + } + Long earliestOpen() { + for(String xid:committed){ + if(missingCommit.contains(xid))throw new IllegalArgumentException("达梦提交位置不完整,禁止推进归档范围"); + open.remove(xid);missingStart.remove(xid); + } + if(!missingStart.isEmpty())throw new IllegalArgumentException("未结束事务缺少起始日志,不能安全推进归档范围"); + return open.isEmpty()?null:Collections.min(open.values()); + } + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengFactory.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengFactory.java new file mode 100644 index 0000000..6660cde --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengFactory.java @@ -0,0 +1,9 @@ +package cn.aixunkeji.datagov.integration.cdc; +import org.apache.seatunnel.api.source.SeaTunnelSource; +import org.apache.seatunnel.api.table.factory.TableSourceFactory; +import org.apache.seatunnel.api.configuration.util.OptionRule; +public final class DamengFactory implements TableSourceFactory { + public String factoryIdentifier(){return "Dameng-Native-CDC";} + public Class getSourceClass(){return DamengSource.class;} + public OptionRule optionRule(){return OptionRule.builder().build();} +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengSource.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengSource.java new file mode 100644 index 0000000..00425a6 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/DamengSource.java @@ -0,0 +1,4 @@ +package cn.aixunkeji.datagov.integration.cdc; +public final class DamengSource extends NativeLogSource { + public String getPluginName(){return "Dameng-Native-CDC";} +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseChangeDecoder.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseChangeDecoder.java new file mode 100644 index 0000000..027fcf1 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseChangeDecoder.java @@ -0,0 +1,64 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import java.util.*; + +/** Strict decoder for the test_decoding text contract; unknown messages fail closed. */ +public final class KingbaseChangeDecoder { + public static final class Change { + public final String schema,table,operation; + public final Map before,after; + Change(String schema,String table,String operation,Map before,Map after){ + this.schema=schema;this.table=table;this.operation=operation;this.before=before;this.after=after; + } + } + public Change decode(String text) { + Cursor c=new Cursor(text);c.expect("table ");String schema=c.identifier();c.expect("."); + String table=c.identifier();c.expect(": ");String op=c.until(':');c.expect(":");c.space(); + Map old=Collections.emptyMap(), next=Collections.emptyMap(); + switch(op){ + case "INSERT": next=c.fields(false);break; + case "DELETE": old=c.fields(false);break; + case "UPDATE": + c.expect("old-key: ");old=c.fields(true);c.expect("new-tuple: ");next=c.fields(false);break; + default: throw new IllegalArgumentException("Unsupported logical operation (including TRUNCATE)"); + } + c.space();if(!c.end())throw new IllegalArgumentException("Unparsed logical message"); + return new Change(schema,table,op,old,next); + } + private static final class Cursor { + final String text;int pos; + Cursor(String text){this.text=Objects.requireNonNull(text);} + boolean end(){return pos==text.length();} + void space(){while(!end()&&text.charAt(pos)==' ')pos++;} + void expect(String s){if(!text.startsWith(s,pos))throw new IllegalArgumentException("Unsupported logical decoding syntax");pos+=s.length();} + String until(char ch){int start=pos;while(!end()&&text.charAt(pos)!=ch)pos++;if(end())throw new IllegalArgumentException("Truncated logical message");return text.substring(start,pos);} + String quoted(char quote){ + pos++;StringBuilder result=new StringBuilder(); + while(!end()){ + char ch=text.charAt(pos++); + if(ch==quote){if(!end()&&text.charAt(pos)==quote){pos++;result.append(ch);}else return result.toString();} + else result.append(ch); + } + throw new IllegalArgumentException("Unterminated logical value"); + } + String identifier(){ + if(!end()&&text.charAt(pos)=='"')return quoted('"'); + int start=pos;while(!end()&&(Character.isLetterOrDigit(text.charAt(pos))||"_$".indexOf(text.charAt(pos))>=0))pos++; + if(start==pos)throw new IllegalArgumentException("Invalid logical identifier");return text.substring(start,pos); + } + Map fields(boolean stopAtNew){ + Map values=new LinkedHashMap<>(); + while(true){ + space();if(end()||stopAtNew&&text.startsWith("new-tuple: ",pos))return values; + String name=identifier();expect("[");until(']');expect("]:"); + String value; + if(!end()&&text.charAt(pos)=='\'')value=quoted('\''); + else {int start=pos;while(!end()&&text.charAt(pos)!=' ')pos++;value=text.substring(start,pos); + if("null".equals(value))value=null; + else if(!value.matches("[-+0-9.eE]+|true|false|t|f"))throw new IllegalArgumentException("Unsupported logical value or unchanged TOAST");} + if(values.containsKey(name))throw new IllegalArgumentException("Duplicate logical column"); + values.put(name,value); + } + } + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseFactory.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseFactory.java new file mode 100644 index 0000000..b769a0d --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseFactory.java @@ -0,0 +1,9 @@ +package cn.aixunkeji.datagov.integration.cdc; +import org.apache.seatunnel.api.source.SeaTunnelSource; +import org.apache.seatunnel.api.table.factory.TableSourceFactory; +import org.apache.seatunnel.api.configuration.util.OptionRule; +public final class KingbaseFactory implements TableSourceFactory { + public String factoryIdentifier(){return "Kingbase-Native-CDC";} + public Class getSourceClass(){return KingbaseSource.class;} + public OptionRule optionRule(){return OptionRule.builder().build();} +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseSource.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseSource.java new file mode 100644 index 0000000..47bb91f --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/KingbaseSource.java @@ -0,0 +1,4 @@ +package cn.aixunkeji.datagov.integration.cdc; +public final class KingbaseSource extends NativeLogSource { + public String getPluginName(){return "Kingbase-Native-CDC";} +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/LogPosition.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/LogPosition.java new file mode 100644 index 0000000..4c890dd --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/LogPosition.java @@ -0,0 +1,21 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import java.io.Serializable; +import java.math.BigInteger; + +/** Committed position only. Never checkpoint a half-decoded transaction. */ +public final class LogPosition implements Serializable { + private static final long serialVersionUID = 1L; + public final String position; + public final String identity; + public LogPosition(String position, String identity) { + if (position == null || identity == null) throw new IllegalArgumentException("Missing log identity"); + this.position = position; this.identity = identity; + } + public static BigInteger lsn(String value) { + if (value == null || !value.matches("[0-9A-Fa-f]{1,8}/[0-9A-Fa-f]{1,8}")) + throw new IllegalArgumentException("Invalid WAL position"); + String[] parts=value.split("/"); + return new BigInteger(parts[0],16).shiftLeft(32).add(new BigInteger(parts[1],16)); + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/NativeLogReader.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/NativeLogReader.java new file mode 100644 index 0000000..4077f62 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/java/cn/aixunkeji/datagov/integration/cdc/NativeLogReader.java @@ -0,0 +1,252 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import org.apache.seatunnel.api.source.*; +import org.apache.seatunnel.api.table.type.*; +import java.io.IOException; +import java.sql.*; +import java.util.*; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import com.kingbase8.KBConnection; +import com.kingbase8.replication.KBReplicationStream; +import com.kingbase8.replication.LogSequenceNumber; + +/** The durable engine checkpoint owns progress; source acknowledgement always follows completion. */ +final class NativeLogReader implements SourceReader { + private final NativeLogSource source; + private Connection db; + private Connection replicationConnection; + private KBReplicationStream stream; + private final CommittedBatch frames=new CommittedBatch(10000); + private volatile NativeLogSource.Split state; + private volatile boolean closed; + private final NavigableMap snapshots=new TreeMap<>(); + NativeLogReader(NativeLogSource source){this.source=source;} + public void open()throws Exception{db=source.connect();} + public void addSplits(List splits){if(splits.size()!=1||state!=null)throw new IllegalArgumentException("Duplicate source split");state=splits.get(0).copy();} + public void handleNoMoreSplits(){} + public void close()throws IOException{ + closed=true; + try{if(stream!=null)stream.close();}catch(SQLException ignored){} + try{if(replicationConnection!=null)replicationConnection.close();}catch(SQLException ignored){} + if(db!=null)try{db.close();}catch(SQLException e){throw new IOException("Native CDC close failed");} + } + public synchronized List snapshotState(long id){ + if(state==null)return Collections.emptyList();NativeLogSource.Split copy=state.copy(); + if(copy.cursor==null)throw new IllegalStateException("日志起始位置尚未建立,不能完成检查点"); + snapshots.put(id,copy);return Collections.singletonList(copy); + } + public synchronized void notifyCheckpointAborted(long id){snapshots.remove(id);} + public synchronized void notifyCheckpointComplete(long id)throws Exception{ + NativeLogSource.Split saved=snapshots.get(id); + if(saved!=null&&saved.cursor!=null&&stream!=null){ + synchronized(stream){ + LogSequenceNumber lsn=LogSequenceNumber.valueOf(saved.cursor); + stream.setAppliedLSN(lsn);stream.setFlushedLSN(lsn);stream.forceUpdateStatus(); + } + } + snapshots.headMap(id,true).clear(); + } + public void pollNext(Collector output)throws Exception{ + if(closed)return;if(state==null){Thread.sleep(100);return;} + try{ + NativeLogSource.Split next=state.copy(); + if(next.schemaSignature!=null&&!next.schemaSignature.equals(source.schemaSignature))throw new IllegalArgumentException("恢复时源表结构发生变化"); + next.schemaSignature=source.schemaSignature;source.checkSchema(db); + boolean initializing=next.cursor==null; + if(initializing)next.snapshotting=source.initial; + // Establish and checkpoint the log low watermark before publishing snapshot pages. + List rows="KINGBASE".equals(source.kind)?kingbase(next,initializing||next.snapshotting):dameng(next,initializing||next.snapshotting); + if(!initializing&&next.snapshotting)rows=snapshot(next); + // Same lock as the engine barrier: events and the matching offset cannot be separated. + synchronized(output.getCheckpointLock()){ + for(SeaTunnelRow row:rows)output.collect(row); + state=next; + } + if(rows.isEmpty())Thread.sleep(1000); + }catch(SQLException e){throw new IllegalStateException("原生CDC日志接口失败,SQLState="+e.getSQLState()+",错误码="+e.getErrorCode());} + } + private List kingbase(NativeLogSource.Split next,boolean positionOnly)throws SQLException{ + if(stream==null){ + try(Statement st=db.createStatement()){ + st.setQueryTimeout(30); + try(ResultSet rs=st.executeQuery("SHOW wal_level")){if(!rs.next()||!"logical".equals(rs.getString(1)))throw new IllegalArgumentException("金仓需启用logical WAL");} + } + try(PreparedStatement ps=db.prepareStatement("SELECT plugin, database, active, restart_lsn, confirmed_flush_lsn FROM sys_replication_slots WHERE slot_name=?")){ + ps.setQueryTimeout(30);ps.setString(1,source.slot); + try(ResultSet rs=ps.executeQuery()){ + if(!rs.next()||!"test_decoding".equals(rs.getString(1))||rs.getBoolean(3))throw new IllegalArgumentException("金仓需要预建专用且未被占用的test_decoding逻辑复制槽"); + if(!Objects.equals(rs.getString(2),db.getCatalog()))throw new IllegalArgumentException("复制槽不属于当前源数据库"); + if(next.cursor==null){ + // First start is from the slot's current confirmed position, never a guessed WAL location. + next.cursor=rs.getString(5);next.anchor=next.cursor; + if(next.cursor==null)throw new IllegalArgumentException("复制槽缺少已确认位置"); + }else if(LogPosition.lsn(rs.getString(5)).compareTo(LogPosition.lsn(next.cursor))>0) + throw new IllegalArgumentException("复制槽已被其他消费者推进,无法从原检查点恢复"); + if(rs.getString(4)==null||LogPosition.lsn(rs.getString(4)).compareTo(LogPosition.lsn(next.cursor))>0) + throw new IllegalArgumentException("所需WAL已不可用,禁止跳过数据"); + } + } + Properties props=new Properties();props.setProperty("user",source.user);props.setProperty("password",source.password); + props.setProperty("replication","database");props.setProperty("preferQueryMode","simple"); + replicationConnection=DriverManager.getConnection(source.url,props); + try(Statement st=replicationConnection.createStatement();ResultSet rs=st.executeQuery("IDENTIFY_SYSTEM")){ + if(!rs.next())throw new IllegalArgumentException("金仓复制协议不能提供实例身份"); + String identity=rs.getString(1)+":"+rs.getString(2)+":"+source.slot+":"+source.schema+":"+source.table; + if(next.identity!=null&&!next.identity.equals(identity))throw new IllegalArgumentException("金仓实例或时间线变化,禁止直接恢复"); + if(next.identity==null&&next.snapshotting)next.cursor=rs.getString(3); + next.identity=identity; + } + stream=replicationConnection.unwrap(KBConnection.class).getReplicationAPI().replicationStream().logical() + .withSlotName(source.slot).withStartPosition(LogSequenceNumber.valueOf(next.cursor)) + .withSlotOption("include-xids",true).withSlotOption("include-timestamp",false).start(); + } + if(positionOnly)return Collections.emptyList(); + // The replication stream holds the slot exclusively. Only completed checkpoints acknowledge WAL. + List rows=new ArrayList<>(); + for(int messageCount=0;messageCount<10000;messageCount++){ + ByteBuffer bytes;String lsn; + synchronized(stream){bytes=stream.readPending();lsn=stream.getLastReceiveLSN().asString();} + if(bytes==null)break; + CommittedBatch.Transaction tx=frames.accept(lsn,StandardCharsets.UTF_8.decode(bytes).toString()); + if(tx==null||LogPosition.lsn(tx.lsn).compareTo(LogPosition.lsn(next.cursor))<=0)continue; + for(KingbaseChangeDecoder.Change c:tx.changes){ + if(!source.schema.equals(c.schema)||!source.table.equals(c.table))continue; + if(rows.size()>20000)throw new IllegalArgumentException("CDC batch exceeds supported memory limit"); + if("INSERT".equals(c.operation))rows.add(source.row(c.after,RowKind.INSERT)); + else if("DELETE".equals(c.operation))rows.add(source.row(c.before,RowKind.DELETE)); + else {rows.add(source.row(c.before,RowKind.UPDATE_BEFORE));rows.add(source.row(c.after,RowKind.UPDATE_AFTER));} + } + next.cursor=tx.lsn; + } + return rows; + } + private List dameng(NativeLogSource.Split next,boolean positionOnly)throws SQLException{ + List catalog=new ArrayList<>(); + try(Statement st=db.createStatement()){ + st.setQueryTimeout(30); + try(ResultSet rs=st.executeQuery("SELECT DB_MAGIC, CUR_LSN FROM V$RLOG")){ + if(!rs.next())throw new IllegalArgumentException("无法核实达梦实例身份"); + String identity=rs.getString(1)+":"+source.schema+":"+source.table; + if(next.identity!=null&&!next.identity.equals(identity))throw new IllegalArgumentException("达梦数据库身份变化,禁止恢复"); + next.identity=identity; + if(next.cursor==null)next.cursor=rs.getString(2); + } + try(ResultSet rs=st.executeQuery("SELECT PARA_NAME, PARA_VALUE FROM V$DM_INI WHERE PARA_NAME IN ('RLOG_APPEND_LOGIC','RLOG_LLOG_COMPRESS','LOGMNR_DELAY_ANALYZE')")){ + Map p=new HashMap<>();while(rs.next())p.put(rs.getString(1),rs.getString(2)); + if(!"2".equals(p.get("RLOG_APPEND_LOGIC"))||!"0".equals(p.get("RLOG_LLOG_COMPRESS"))||!"0".equals(p.get("LOGMNR_DELAY_ANALYZE"))) + throw new IllegalArgumentException("达梦需要RLOG_APPEND_LOGIC=2、RLOG_LLOG_COMPRESS=0、LOGMNR_DELAY_ANALYZE=0"); + } + try(ResultSet rs=st.executeQuery("SELECT NAME, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#, NAME")){ + while(rs.next()){ + String name=rs.getString(1);long sequence=rs.getLong(2); + if(rs.wasNull())throw new IllegalArgumentException("达梦归档缺少文件序号"); + long first=rs.getLong(3);if(rs.wasNull())throw new IllegalArgumentException("达梦归档缺少起始LSN"); + long last=rs.getLong(4);if(rs.wasNull())throw new IllegalArgumentException("达梦归档缺少结束LSN"); + catalog.add(new DamengArchiveWindow.File(name,sequence,first,last)); + } + } + } + List selected=DamengArchiveWindow.select(catalog,next); + List files=DamengArchiveWindow.names(selected); + if(next.anchor==null){next.anchor=files.get(0);next.archives=new ArrayList<>(Collections.singletonList(next.anchor));} + if(positionOnly)return Collections.emptyList(); + long cutoff=Long.parseLong(next.cursor),end=selected.get(selected.size()-1).last; + try{ + for(int i=0;i2128, ENDSCN=>?)")){ps.setQueryTimeout(60);ps.setLong(1,end);ps.execute();} + DamengArchiveWindow.Transactions transactions=new DamengArchiveWindow.Transactions(selected.get(0).first,cutoff,end); + try(Statement st=db.createStatement()){ + st.setQueryTimeout(60); + try(ResultSet rs=st.executeQuery("SELECT XID, OPERATION, SCN, START_SCN, COMMIT_SCN, SEG_OWNER, TABLE_NAME, STATUS, ROLL_BACK FROM V$LOGMNR_CONTENTS ORDER BY SCN, SSN")){ + while(rs.next()){ + if(rs.getInt(8)!=0)throw new IllegalArgumentException("达梦事务边界不可解析,禁止推进日志范围"); + byte[] xid=rs.getBytes(1);String key=xid==null?null:Base64.getEncoder().encodeToString(xid); + long scn=rs.getLong(3);if(rs.wasNull()||scn>end)throw new IllegalArgumentException("达梦日志位置超出已确认归档范围"); + long start=rs.getLong(4);Long startScn=rs.wasNull()?null:start; + long commit=rs.getLong(5);Long commitScn=rs.wasNull()?null:commit; + transactions.accept(key,rs.getString(2),scn,startScn,commitScn, + source.schema.equals(rs.getString(6))&&source.table.equals(rs.getString(7))&&rs.getInt(9)==0); + } + } + } + List retained=DamengArchiveWindow.retain(selected,transactions.earliestOpen()); + StringBuilder sql=new StringBuilder("SELECT OPERATION, COMMIT_SCN, STATUS"); + for(String name:source.names){ + String column=source.schema+"."+source.table+"."+name; + sql.append(", DBMS_LOGMNR.COLUMN_PRESENT(UNDO_VALUE,'").append(column).append("'), DBMS_LOGMNR.MINE_VALUE(UNDO_VALUE,'").append(column) + .append("'), DBMS_LOGMNR.COLUMN_PRESENT(REDO_VALUE,'").append(column).append("'), DBMS_LOGMNR.MINE_VALUE(REDO_VALUE,'").append(column).append("')"); + } + // A committed transaction can contain statements rolled back to a savepoint. + sql.append(" FROM V$LOGMNR_CONTENTS WHERE SEG_OWNER=? AND TABLE_NAME=? AND COMMIT_SCN>? AND COMMIT_SCN<=? AND ROLL_BACK=0 ORDER BY COMMIT_SCN, SCN, SSN"); + List rows=new ArrayList<>(); + try(PreparedStatement ps=db.prepareStatement(sql.toString())){ + ps.setQueryTimeout(60);ps.setString(1,source.schema);ps.setString(2,source.table);ps.setLong(3,cutoff);ps.setLong(4,end); + try(ResultSet rs=ps.executeQuery()){ + while(rs.next()){ + if(rows.size()>20000)throw new IllegalArgumentException("达梦CDC批次超过首版内存限制"); + if(rs.getInt(3)!=0)throw new IllegalArgumentException("达梦日志结构不可解析,禁止跳过"); + String op=rs.getString(1);Map before=new LinkedHashMap<>(),after=new LinkedHashMap<>(); + for(int i=0;i snapshot(NativeLogSource.Split next)throws SQLException { + StringBuilder sql=new StringBuilder("SELECT * FROM ").append(source.qualified()); + List params=new ArrayList<>(); + if(next.snapshotKey!=null){ + sql.append(" WHERE "); + for(int i=0;i0)sql.append(" OR ");sql.append('('); + for(int j=0;j<=i;j++){ + if(j>0)sql.append(" AND "); + sql.append('"').append(source.primaryKeys.get(j)).append('"').append(j==i?">?":"=?"); + params.add(next.snapshotKey[j]); + } + sql.append(')'); + } + } + sql.append(" ORDER BY "); + for(int i=0;i0)sql.append(',');sql.append('"').append(source.primaryKeys.get(i)).append('"'); + } + sql.append("DAMENG".equals(source.kind)?" FETCH FIRST 500 ROWS ONLY":" LIMIT 500"); + List rows=new ArrayList<>(); + try(PreparedStatement ps=db.prepareStatement(sql.toString())){ + ps.setQueryTimeout(60); + for(int i=0;i values=new LinkedHashMap<>(); + for(String name:source.names)values.put(name,rs.getString(name)); + rows.add(source.row(values,RowKind.INSERT)); + next.snapshotKey=new Object[source.primaryKeys.size()]; + for(int i=0;i { + private static final long serialVersionUID=1L; + String url,user,password,schema,table,slot,kind; + List names=new ArrayList<>();List types=new ArrayList<>(); + CatalogTable catalog; + String schemaSignature; + boolean initial; + List primaryKeys=new ArrayList<>(); + public static class Split implements SourceSplit { + private static final long serialVersionUID=1L; + public String cursor,anchor,identity; + public String schemaSignature; + public List archives=new ArrayList<>(); + public Long archiveSequence; + public boolean snapshotting; + public Object[] snapshotKey; + public String splitId(){return "single-native-log";} + Split copy(){Split s=new Split();s.cursor=cursor;s.anchor=anchor;s.identity=identity;s.schemaSignature=schemaSignature;s.archives=new ArrayList<>(archives);s.archiveSequence=archiveSequence;s.snapshotting=snapshotting;s.snapshotKey=snapshotKey==null?null:snapshotKey.clone();return s;} + } + public Boundedness getBoundedness(){return Boundedness.UNBOUNDED;} + public List getProducedCatalogTables(){return Collections.singletonList(catalog);} + public void prepare(Config c){ + url=c.getString("url");user=c.getString("username");password=c.getString("password"); + schema=identifier(c.getString("source_schema"));table=identifier(c.getString("source_table")); + kind=getPluginName().startsWith("Dameng")?"DAMENG":"KINGBASE"; + String startup=c.getString("startup.mode"); + if(!Arrays.asList("initial","latest").contains(startup))throw new IllegalArgumentException("Unsupported startup mode"); + initial="initial".equals(startup); + if("KINGBASE".equals(kind))slot=identifier(c.getString("slot_name")); + names.clear();types.clear(); + try(Connection db=connect();Statement st=db.createStatement()){ + SortedMap keys=new TreeMap<>(); + try(ResultSet pk=db.getMetaData().getPrimaryKeys("DAMENG".equals(kind)?null:db.getCatalog(),schema,table)){ + while(pk.next())keys.put(pk.getShort("KEY_SEQ"),pk.getString("COLUMN_NAME")); + } + if(keys.isEmpty())throw new IllegalArgumentException("原生CDC要求源表有主键,以正确同步更新和删除"); + primaryKeys=new ArrayList<>(keys.values()); + st.setQueryTimeout(30); + try(ResultSet rs=st.executeQuery("SELECT * FROM "+qualified()+" WHERE 1=0")){ + ResultSetMetaData m=rs.getMetaData();schemaSignature=signature(m)+"|PK="+primaryKeys;TableSchema.Builder b=TableSchema.builder(); + for(int i=1;i<=m.getColumnCount();i++){ + String n=identifier(m.getColumnName(i));int t=m.getColumnType(i); + names.add(n);types.add(t); + b.column(PhysicalColumn.of(n,dataType(t,m.getPrecision(i),m.getScale(i)),(Long)null,true,null,null)); + } + b.primaryKey(PrimaryKey.of("source_pk",new ArrayList<>(keys.values()))); + catalog=CatalogTable.of(TableIdentifier.of("aixun",db.getCatalog(),schema,table),b.build(),Collections.emptyMap(),Collections.emptyList(),""); + } + }catch(SQLException ex){throw new IllegalStateException("原生CDC源表结构读取失败,SQLState="+ex.getSQLState());} + } + static String signature(ResultSetMetaData m)throws SQLException{ + StringBuilder s=new StringBuilder(); + for(int i=1;i<=m.getColumnCount();i++)s.append(m.getColumnName(i)).append(':').append(m.getColumnType(i)).append(':').append(m.getPrecision(i)).append(':').append(m.getScale(i)).append(';'); + return s.toString(); + } + void checkSchema(Connection db)throws SQLException{ + SortedMap keys=new TreeMap<>(); + try(ResultSet pk=db.getMetaData().getPrimaryKeys("DAMENG".equals(kind)?null:db.getCatalog(),schema,table)){ + while(pk.next())keys.put(pk.getShort("KEY_SEQ"),pk.getString("COLUMN_NAME")); + } + try(Statement st=db.createStatement()){ + st.setQueryTimeout(30); + try(ResultSet rs=st.executeQuery("SELECT * FROM "+qualified()+" WHERE 1=0")){ + if(!schemaSignature.equals(signature(rs.getMetaData())+"|PK="+new ArrayList<>(keys.values())))throw new IllegalArgumentException("源表结构或主键已变化,直连CDC停止,禁止按旧结构写入"); + } + } + } + Connection connect()throws SQLException{ + try{Class.forName("DAMENG".equals(kind)?"dm.jdbc.driver.DmDriver":"com.kingbase8.Driver");} + catch(ClassNotFoundException e){throw new SQLException("缺少原生CDC JDBC驱动");} + return DriverManager.getConnection(url,user,password); + } + String qualified(){return "\""+schema+"\".\""+table+"\"";} + static String identifier(String v){if(v==null||!v.matches("[A-Za-z_][A-Za-z0-9_$#]{0,127}"))throw new IllegalArgumentException("Unsupported identifier");return v;} + static SeaTunnelDataType dataType(int t,int p,int s){ + switch(t){ + case Types.SMALLINT:return BasicType.SHORT_TYPE;case Types.TINYINT:return BasicType.BYTE_TYPE; + case Types.INTEGER:return BasicType.INT_TYPE;case Types.BIGINT:return BasicType.LONG_TYPE; + case Types.FLOAT:case Types.REAL:return BasicType.FLOAT_TYPE;case Types.DOUBLE:return BasicType.DOUBLE_TYPE; + case Types.NUMERIC:case Types.DECIMAL:if(p<1||p>38||s<0||s>p)throw new IllegalArgumentException("Unsupported decimal precision");return new DecimalType(p,s); + case Types.CHAR:case Types.VARCHAR:case Types.NCHAR:case Types.NVARCHAR:return BasicType.STRING_TYPE; + case Types.BOOLEAN:case Types.BIT:return BasicType.BOOLEAN_TYPE; + case Types.DATE:return LocalTimeType.LOCAL_DATE_TYPE;case Types.TIME:return LocalTimeType.LOCAL_TIME_TYPE;case Types.TIMESTAMP:return LocalTimeType.LOCAL_DATE_TIME_TYPE; + default:throw new IllegalArgumentException("原生CDC暂不支持LOB、二进制、数组或带时区字段"); + } + } + SeaTunnelRow row(Map values,RowKind rowKind){ + if(values.size()!=names.size()||!values.keySet().containsAll(names))throw new IllegalArgumentException("日志缺少完整行镜像或表结构已变化,拒绝丢字段写入"); + Object[] fields=new Object[names.size()]; + for(int i=0;i createReader(SourceReader.Context ctx){ + if(ctx.getIndexOfSubtask()!=0)throw new IllegalArgumentException("原生CDC仅支持并行度1"); + return new NativeLogReader(this); + } + public SourceSplitEnumerator createEnumerator(SourceSplitEnumerator.Context ctx){return new Enumerator(ctx,false);} + public SourceSplitEnumerator restoreEnumerator(SourceSplitEnumerator.Context ctx,Boolean state){return new Enumerator(ctx,state);} + static final class Enumerator implements SourceSplitEnumerator{ + final Context context;boolean assigned;List returned=new ArrayList<>(); + Enumerator(Context context,boolean assigned){this.context=context;this.assigned=assigned;if(context.currentParallelism()!=1)throw new IllegalArgumentException("Parallelism must be 1");} + public void open(){}public void close(){}public void notifyCheckpointComplete(long id){} + public synchronized void run(){for(int id:context.registeredReaders())registerReader(id);} + public synchronized void registerReader(int id){ + if(!returned.isEmpty()){context.assignSplit(id,new ArrayList<>(returned));returned.clear();} + else if(!assigned){context.assignSplit(id,Collections.singletonList(new Split()));assigned=true;} + context.signalNoMoreSplits(id); + } + public synchronized void addSplitsBack(List splits,int id){returned.addAll(splits);assigned=true;} + public synchronized int currentUnassignedSplitSize(){return returned.size()+(assigned?0:1);} + public void handleSplitRequest(int id){registerReader(id);} + public synchronized Boolean snapshotState(long id){if(!returned.isEmpty())throw new IllegalStateException("Unassigned recovery state");return assigned;} + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.source.SeaTunnelSource b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.source.SeaTunnelSource new file mode 100644 index 0000000..37c0d69 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.source.SeaTunnelSource @@ -0,0 +1,2 @@ +cn.aixunkeji.datagov.integration.cdc.DamengSource +cn.aixunkeji.datagov.integration.cdc.KingbaseSource diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory new file mode 100644 index 0000000..a275025 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory @@ -0,0 +1,2 @@ +cn.aixunkeji.datagov.integration.cdc.DamengFactory +cn.aixunkeji.datagov.integration.cdc.KingbaseFactory diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindowTest.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindowTest.java new file mode 100644 index 0000000..2e8c149 --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/DamengArchiveWindowTest.java @@ -0,0 +1,91 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import org.junit.jupiter.api.Test; +import java.util.*; +import java.io.*; +import static org.junit.jupiter.api.Assertions.*; + +class DamengArchiveWindowTest { + List files(int n){ + List list=new ArrayList<>(); + for(int i=1;i<=n;i++)list.add(new DamengArchiveWindow.File("f"+i,i,i*100L,i*100L+99)); + return list; + } + @Test void moreThan2000ArchivesAreProcessedInOrderWithoutSkipping() { + List catalog=files(3000);NativeLogSource.Split state=new NativeLogSource.Split(); + long previous=0; + while(previous<3000){ + List batch=DamengArchiveWindow.select(catalog,state); + long end=batch.get(batch.size()-1).sequence; + assertTrue(end>previous);assertTrue(end-previous<=64); + assertEquals(previous==0?1:previous,batch.get(0).sequence); + List retained=DamengArchiveWindow.retain(batch,null); + state.anchor=retained.get(0).name;state.archives=DamengArchiveWindow.names(retained);state.archiveSequence=end; + previous=end; + } + } + @Test void longTransactionPinsPrefixBeyond2000Files() { + List catalog=files(3000);NativeLogSource.Split state=new NativeLogSource.Split();state.anchor="f1";state.archiveSequence=2500L; + List batch=DamengArchiveWindow.select(catalog,state); + assertEquals(2564,batch.size()); + assertEquals("f1",DamengArchiveWindow.retain(batch,110L).get(0).name); + assertEquals("f2564",DamengArchiveWindow.retain(batch,null).get(0).name); + } + @Test void checkpointsPinRequiredFilesButAllowRetiredFilesToDisappear() { + NativeLogSource.Split state=new NativeLogSource.Split();state.anchor="f100";state.archiveSequence=100L;state.archives=Arrays.asList("f100"); + List catalog=files(200);catalog.subList(0,99).clear(); + assertEquals("f100",DamengArchiveWindow.select(catalog,state).get(0).name); + catalog.remove(0);assertThrows(IllegalArgumentException.class,()->DamengArchiveWindow.select(catalog,state)); + } + @Test void refusesMiddleGapDuplicateAndMissingPinnedFile() { + List catalog=files(10);catalog.remove(3); + assertThrows(IllegalArgumentException.class,()->DamengArchiveWindow.select(catalog,new NativeLogSource.Split())); + List duplicate=files(10);duplicate.add(duplicate.get(1)); + assertThrows(IllegalArgumentException.class,()->DamengArchiveWindow.select(duplicate,new NativeLogSource.Split())); + NativeLogSource.Split state=new NativeLogSource.Split();state.archives=Arrays.asList("lost"); + assertThrows(IllegalArgumentException.class,()->DamengArchiveWindow.select(files(10),state)); + } + @Test void tracksInterleavedCommitRollbackAndXaWithoutDroppingOpenTransaction() { + DamengArchiveWindow.Transactions tx=new DamengArchiveWindow.Transactions(100,100); + tx.accept("a","START",110,null,null,false);tx.accept("b","START",120,null,null,false); + tx.accept("b","COMMIT",130,120L,130L,false); + assertEquals(Long.valueOf(110),tx.earliestOpen()); + tx.accept("a","ROLLBACK",140,110L,null,false);assertNull(tx.earliestOpen()); + tx.accept("c","START",150,null,null,false);tx.accept("c","PRE_COMMIT",160,150L,null,false); + assertEquals(Long.valueOf(150),tx.earliestOpen()); + tx.accept("c","XA_COMMIT",170,150L,170L,false);assertNull(tx.earliestOpen()); + } + @Test void missingTransactionStartAndUnknownCommitFailClosed() { + DamengArchiveWindow.Transactions tx=new DamengArchiveWindow.Transactions(100,100); + assertThrows(IllegalArgumentException.class,()->tx.accept("a","UPDATE",150,90L,160L,true)); + DamengArchiveWindow.Transactions unresolved=new DamengArchiveWindow.Transactions(100,100); + unresolved.accept("b","UPDATE",150,null,null,true); + assertThrows(IllegalArgumentException.class,unresolved::earliestOpen); + DamengArchiveWindow.Transactions missingCommit=new DamengArchiveWindow.Transactions(100,100); + missingCommit.accept("c","START",110,null,null,false); + missingCommit.accept("c","UPDATE",120,110L,null,true); + assertThrows(IllegalArgumentException.class,()->missingCommit.accept("c","COMMIT",130,110L,130L,false)); + } + @Test void checkpointRoundTripAndCopyPreserveIndependentWindow()throws Exception { + NativeLogSource.Split state=new NativeLogSource.Split();state.cursor="150";state.archiveSequence=7L;state.anchor="f3";state.archives.add("f3"); + ByteArrayOutputStream bytes=new ByteArrayOutputStream();new ObjectOutputStream(bytes).writeObject(state); + NativeLogSource.Split restored=(NativeLogSource.Split)new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray())).readObject(); + assertEquals(state.archiveSequence,restored.archiveSequence);assertEquals(state.cursor,restored.cursor); + NativeLogSource.Split copy=restored.copy();copy.archives.clear();assertEquals(1,restored.archives.size()); + } + @Test void legacyCheckpointStartsFromItsAnchorAndDoesNotJumpToLatest() { + NativeLogSource.Split state=new NativeLogSource.Split();state.anchor="f20";state.cursor="290000"; + assertEquals("f20",DamengArchiveWindow.select(files(3000),state).get(0).name); + assertEquals("f83",DamengArchiveWindow.select(files(3000),state).get(63).name); + } + @Test void transactionCrossingWindowStaysPinnedUntilCommitIsCovered() { + DamengArchiveWindow.Transactions first=new DamengArchiveWindow.Transactions(100,100,199); + first.accept("a","START",110,null,null,false); + first.accept("a","UPDATE",120,110L,250L,true); + assertEquals(Long.valueOf(110),first.earliestOpen()); + DamengArchiveWindow.Transactions second=new DamengArchiveWindow.Transactions(100,199,299); + second.accept("a","START",110,null,null,false); + second.accept("a","UPDATE",120,110L,250L,true); + assertNull(second.earliestOpen()); + } +} diff --git a/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/NativeLogContractTest.java b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/NativeLogContractTest.java new file mode 100644 index 0000000..547037a --- /dev/null +++ b/aixun-modules/aixun-integration/seatunnel-native-cdc/src/test/java/cn/aixunkeji/datagov/integration/cdc/NativeLogContractTest.java @@ -0,0 +1,126 @@ +package cn.aixunkeji.datagov.integration.cdc; + +import org.junit.jupiter.api.Test; +import org.apache.seatunnel.api.table.factory.*; +import java.io.*; +import java.sql.Types; +import java.sql.*; +import org.apache.seatunnel.api.table.catalog.*; +import java.lang.reflect.Proxy; +import java.util.*; +import com.kingbase8.replication.*; +import static org.junit.jupiter.api.Assertions.*; + +class NativeLogContractTest { + @Test void snapshotPagesKeepLogWatermarkAndResumeCompositeKey()throws Exception { + NativeLogSource source=new DamengSource();source.kind="DAMENG";source.schema="APP";source.table="T"; + source.names=Arrays.asList("TENANT","ID");source.types=Arrays.asList(Types.INTEGER,Types.INTEGER);source.primaryKeys=source.names; + source.catalog=CatalogTable.of(TableIdentifier.of("test","db","APP","T"),TableSchema.builder() + .column(PhysicalColumn.of("TENANT",NativeLogSource.dataType(Types.INTEGER,0,0),(Long)null,false,null,null)) + .column(PhysicalColumn.of("ID",NativeLogSource.dataType(Types.INTEGER,0,0),(Long)null,false,null,null)).build(),Collections.emptyMap(),Collections.emptyList(),""); + NativeLogReader reader=new NativeLogReader(source); + List queries=new ArrayList<>();List params=new ArrayList<>();int[] page={0},row={0}; + ResultSet rs=(ResultSet)Proxy.newProxyInstance(getClass().getClassLoader(),new Class[]{ResultSet.class},(proxy,m,args)->{ + if(m.getName().equals("next"))return page[0]==1&&++row[0]<=500; + if(m.getName().equals("getString"))return "TENANT".equals(args[0])?"7":Integer.toString(row[0]); + if(m.getName().equals("getObject"))return "TENANT".equals(args[0])?7:row[0]; + return null; + }); + PreparedStatement ps=(PreparedStatement)Proxy.newProxyInstance(getClass().getClassLoader(),new Class[]{PreparedStatement.class},(proxy,m,args)->{ + if(m.getName().equals("executeQuery"))return rs; + if(m.getName().equals("setObject"))params.add(args[1]);return null; + }); + Connection db=(Connection)Proxy.newProxyInstance(getClass().getClassLoader(),new Class[]{Connection.class},(proxy,m,args)->{ + if(m.getName().equals("prepareStatement")){queries.add((String)args[0]);page[0]++;row[0]=0;return ps;}return null; + }); + java.lang.reflect.Field field=NativeLogReader.class.getDeclaredField("db");field.setAccessible(true);field.set(reader,db); + NativeLogSource.Split state=new NativeLogSource.Split();state.cursor="12345";state.snapshotting=true; + assertEquals(500,reader.snapshot(state).size());assertEquals("12345",state.cursor);assertTrue(state.snapshotting); + NativeLogSource.Split restored=state.copy();state.snapshotKey[1]=-1; + assertArrayEquals(new Object[]{7,500},restored.snapshotKey); + assertEquals(0,reader.snapshot(restored).size());assertFalse(restored.snapshotting);assertEquals("12345",restored.cursor); + assertEquals(Arrays.asList(7,7,500),params); + assertTrue(queries.get(1).contains("(\"TENANT\">?) OR (\"TENANT\"=? AND \"ID\">?)")); + assertTrue(queries.get(1).endsWith("ORDER BY \"TENANT\",\"ID\" FETCH FIRST 500 ROWS ONLY")); + } + @Test void insertNullQuotesAndUnicode(){ + KingbaseChangeDecoder.Change c=new KingbaseChangeDecoder().decode("table public.orders: INSERT: id[integer]:1 title[text]:'采购 ''订单'' : new-tuple: 中文' note[text]:null"); + assertEquals("采购 '订单' : new-tuple: 中文",c.after.get("title")); + assertTrue(c.after.containsKey("note"));assertNull(c.after.get("note")); + } + @Test void updateCarriesOldAndNewPrimaryKey(){ + KingbaseChangeDecoder.Change c=new KingbaseChangeDecoder().decode("table \"APP\".\"ORDERS\": UPDATE: old-key: \"ID\"[integer]:1 \"NAME\"[text]:'旧' new-tuple: \"ID\"[integer]:2 \"NAME\"[text]:'新'"); + assertEquals("1",c.before.get("ID"));assertEquals("2",c.after.get("ID"));assertEquals("APP",c.schema); + } + @Test void deleteIncludesPreviousValues(){ + KingbaseChangeDecoder.Change c=new KingbaseChangeDecoder().decode("table public.orders: DELETE: id[integer]:1 name[text]:'删除'"); + assertEquals("删除",c.before.get("name"));assertTrue(c.after.isEmpty()); + } + @Test void rejectIncompleteOrUnsupportedRows(){ + KingbaseChangeDecoder d=new KingbaseChangeDecoder(); + for(String s:new String[]{"table public.t: TRUNCATE: restart_seqs", "table public.t: UPDATE: id[int]:1", "table public.t: INSERT: name[text]:'unfinished", "table public.t: INSERT: name[text]:unchanged-toast-datum", "table public.t: INSERT: id[int]:1 id[int]:2"}) + assertThrows(IllegalArgumentException.class,()->d.decode(s)); + } + @Test void positionAdvancesOnlyAtMatchingCommit(){ + CommittedBatch b=new CommittedBatch(10); + assertNull(b.accept("0/10","BEGIN 42"));assertNull(b.accept("0/11","table public.t: INSERT: id[int]:1")); + assertThrows(IllegalArgumentException.class,b::requireComplete); + CommittedBatch.Transaction tx=b.accept("0/12","COMMIT 42");assertEquals("0/12",tx.lsn);assertEquals(1,tx.changes.size());b.requireComplete(); + } + @Test void rejectsMismatchedCommitAndOversizedTransaction(){ + CommittedBatch b=new CommittedBatch(1);b.accept("0/1","BEGIN 1");b.accept("0/2","table public.t: INSERT: id[int]:1"); + assertThrows(IllegalArgumentException.class,()->b.accept("0/3","COMMIT 2")); + assertThrows(IllegalArgumentException.class,()->b.accept("0/3","table public.t: INSERT: id[int]:2")); + } + @Test void unsignedLsnAcrossHighBitAndCarry(){ + assertTrue(LogPosition.lsn("80000000/0").compareTo(LogPosition.lsn("7FFFFFFF/FFFFFFFF"))>0); + assertTrue(LogPosition.lsn("1/0").compareTo(LogPosition.lsn("0/FFFFFFFF"))>0); + assertThrows(IllegalArgumentException.class,()->LogPosition.lsn("0/xyz")); + } + @Test void checkpointStateIsIndependentAndSerializable()throws Exception{ + NativeLogSource.Split s=new NativeLogSource.Split();s.cursor="0/FF";s.anchor="0/1";s.identity="db:slot"; + s.archives.add("archive1");s.schemaSignature="id:4"; + NativeLogSource.Split copy=s.copy();s.cursor="1/0";s.archives.add("archive2"); + ByteArrayOutputStream bytes=new ByteArrayOutputStream();new ObjectOutputStream(bytes).writeObject(copy); + NativeLogSource.Split restored=(NativeLogSource.Split)new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray())).readObject(); + assertEquals("0/FF",restored.cursor);assertEquals("db:slot",restored.identity); + assertEquals(Collections.singletonList("archive1"),restored.archives);assertEquals("id:4",restored.schemaSignature); + } + @Test void cannotCheckpointBeforeLogPositionIsEstablished(){ + NativeLogReader reader=new NativeLogReader(new DamengSource()); + reader.addSplits(Collections.singletonList(new NativeLogSource.Split())); + assertThrows(IllegalStateException.class,()->reader.snapshotState(1)); + } + @Test void rejectTypesThatCannotBeDecodedLosslessly(){ + assertThrows(IllegalArgumentException.class,()->NativeLogSource.dataType(Types.BLOB,0,0)); + assertThrows(IllegalArgumentException.class,()->NativeLogSource.dataType(Types.NUMERIC,40,0)); + assertThrows(IllegalArgumentException.class,()->NativeLogSource.convert("yes",Types.BOOLEAN)); + } + @Test void bothFactoriesDiscoverWithoutConnecting(){ + ClassLoader loader=getClass().getClassLoader(); + assertEquals(DamengSource.class,FactoryUtil.discoverFactory(loader,TableSourceFactory.class,"Dameng-Native-CDC").getSourceClass()); + assertEquals(KingbaseSource.class,FactoryUtil.discoverFactory(loader,TableSourceFactory.class,"Kingbase-Native-CDC").getSourceClass()); + } + @Test void walAcknowledgementOnlyAfterSuccessfulCheckpoint()throws Exception{ + NativeLogReader reader=new NativeLogReader(new KingbaseSource()); + NativeLogSource.Split state=new NativeLogSource.Split();state.cursor="0/20";state.anchor="0/10";state.identity="test"; + reader.addSplits(Collections.singletonList(state)); + List acknowledged=new ArrayList<>(); + KBReplicationStream stream=(KBReplicationStream)Proxy.newProxyInstance(getClass().getClassLoader(),new Class[]{KBReplicationStream.class},(proxy,method,args)->{ + if(method.getName().equals("setFlushedLSN"))acknowledged.add(((LogSequenceNumber)args[0]).asString()); + return null; + }); + java.lang.reflect.Field field=NativeLogReader.class.getDeclaredField("stream");field.setAccessible(true);field.set(reader,stream); + reader.snapshotState(1);assertTrue(acknowledged.isEmpty()); + reader.notifyCheckpointAborted(1);reader.notifyCheckpointComplete(1);assertTrue(acknowledged.isEmpty()); + reader.snapshotState(2);reader.notifyCheckpointComplete(2);assertEquals(Collections.singletonList("0/20"),acknowledged); + reader.notifyCheckpointComplete(1);assertEquals(1,acknowledged.size()); + } + @Test void pendingTransactionIsNotPublishedAtPollBoundary(){ + CommittedBatch frames=new CommittedBatch(10); + frames.accept("0/10","BEGIN 9");frames.accept("0/11","table public.t: INSERT: id[int]:7"); + // The next poll resumes the same transaction; the checkpoint still points to the previous commit. + CommittedBatch.Transaction tx=frames.accept("0/12","COMMIT 9"); + assertEquals(1,tx.changes.size());assertEquals("0/12",tx.lsn); + } +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayProperties.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayProperties.java new file mode 100644 index 0000000..22330d0 --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayProperties.java @@ -0,0 +1,28 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; +import java.util.LinkedHashMap; +import java.util.Map; + +/** Operator-managed CDC endpoints. Public task requests cannot supply brokers or credentials. */ +@Data @Component @ConfigurationProperties(prefix="datagov.realtime-relays") +public class CdcRelayProperties { + private Map channels=new LinkedHashMap<>(); + @Data public static class Channel { + private boolean enabled; + private String name; + private long orgId; + private long sourceId; + private String schema; + private String table; + private String bootstrapServers; + private String topic; + private String format="ogg_json"; + private String securityProtocol="PLAINTEXT"; + private String mechanism="SCRAM-SHA-256"; + private String username; + private String secretRef; + } +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistry.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistry.java new file mode 100644 index 0000000..0833f5a --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistry.java @@ -0,0 +1,75 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.*; +import cn.aixunkeji.datagov.integration.m2.M2SecretReader; +import org.springframework.stereotype.Component; +import tools.jackson.databind.node.ObjectNode; +import java.sql.*; +import java.util.*; + +@Component +public class CdcRelayRegistry { + private final CdcRelayProperties properties; + private final M2SecretReader secrets; + public CdcRelayRegistry(CdcRelayProperties properties,M2SecretReader secrets){this.properties=properties;this.secrets=secrets;} + public List options(long org,long source){ + return properties.getChannels().entrySet().stream().filter(e->e.getValue().isEnabled() && + e.getValue().getOrgId()==org && e.getValue().getSourceId()==source).map(e->new RelayOption(e.getKey(), + e.getValue().getName(),e.getValue().getSchema(),e.getValue().getTable(),e.getValue().getFormat())).toList(); + } + CdcRelayProperties.Channel require(Command command){ + var p=command.spec();var c=properties.getChannels().get(p.cdcChannel()); + if(c==null || !c.isEnabled() || c.getOrgId()!=command.orgId() || c.getSourceId()!=p.sourceId() || + !Objects.equals(c.getSchema(),p.sourceSchema()) || !Objects.equals(c.getTable(),p.sourceTable())) + throw new IllegalArgumentException("日志通道未登记、未启用或与当前组织、数据源、源表不匹配"); + validate(c); + return c; + } + static void validate(CdcRelayProperties.Channel c){ + if(c.getBootstrapServers()==null || !c.getBootstrapServers().matches("[A-Za-z0-9._-]+:[0-9]{1,5}(,[A-Za-z0-9._-]+:[0-9]{1,5})*") || + c.getTopic()==null || !c.getTopic().matches("[A-Za-z0-9_-][A-Za-z0-9._-]{0,248}") || + !Set.of("ogg_json","debezium_json").contains(c.getFormat())) + throw new IllegalArgumentException("日志通道服务器、主题或消息格式配置无效"); + if(!Set.of("PLAINTEXT","SASL_PLAINTEXT","SASL_SSL","SSL").contains(c.getSecurityProtocol())) + throw new IllegalArgumentException("日志通道安全协议无效"); + if(c.getSecurityProtocol().startsWith("SASL") && (c.getUsername()==null || c.getUsername().isBlank() || c.getSecretRef()==null || + !Set.of("SCRAM-SHA-256","SCRAM-SHA-512","PLAIN").contains(c.getMechanism()))) + throw new IllegalArgumentException("日志通道缺少受管认证配置"); + } + String fingerprint(Command c){ + var p=require(c); + return List.of(p.getBootstrapServers(),p.getTopic(),p.getFormat(),p.getSecurityProtocol(),p.getMechanism(), + Objects.toString(p.getUsername(),""),Objects.toString(p.getSecretRef(),"")).toString(); + } + ObjectNode job(Command command,MysqlCdcJobFactory.Config common,ResultSetMetaData metadata) throws SQLException { + var c=require(command);var root=MysqlCdcJobFactory.create(common); + var source=(ObjectNode)root.putArray("source").addObject(); + source.put("plugin_name","Kafka");source.put("bootstrap.servers",c.getBootstrapServers()); + source.put("topic",c.getTopic());source.put("consumer.group","aixun_cdc_"+command.orgId()+"_"+command.taskId()); + source.put("format",c.getFormat());source.put("start_mode","initial".equals(command.spec().startupMode())?"earliest":"latest"); + source.put("commit_on_checkpoint",true); + source.put("debezium-json.ignore-parse-errors",false);source.put("ogg_json.ignore-parse-errors",false); + var fields=source.putObject("schema").putObject("fields"); + for(int i=1;i<=metadata.getColumnCount();i++)fields.put(metadata.getColumnName(i),type(metadata.getColumnType(i),metadata.getPrecision(i),metadata.getScale(i))); + var config=source.putObject("kafka.config");config.put("security.protocol",c.getSecurityProtocol()); + config.put("isolation.level","read_committed");config.put("enable.auto.commit","false"); + config.put("auto.offset.reset","none"); + if(c.getSecurityProtocol().startsWith("SASL")){ + config.put("sasl.mechanism",c.getMechanism()); + String module="PLAIN".equals(c.getMechanism())?"org.apache.kafka.common.security.plain.PlainLoginModule":"org.apache.kafka.common.security.scram.ScramLoginModule"; + config.put("sasl.jaas.config",module+" required username=\""+escape(c.getUsername())+"\" password=\""+escape(secrets.resolve(c.getSecretRef()))+"\";"); + } + return root; + } + static String type(int type,int precision,int scale){ + return switch(type){ + case Types.TINYINT -> "TINYINT";case Types.SMALLINT -> "SMALLINT";case Types.INTEGER -> "INT";case Types.BIGINT -> "BIGINT"; + case Types.FLOAT,Types.REAL -> "FLOAT";case Types.DOUBLE -> "DOUBLE"; + case Types.NUMERIC,Types.DECIMAL -> {if(precision<1||precision>38||scale<0||scale>precision)throw new IllegalArgumentException("日志通道暂不支持此精度的数值字段");yield "DECIMAL("+precision+","+scale+")";} + case Types.BOOLEAN,Types.BIT -> "BOOLEAN";case Types.DATE -> "DATE";case Types.TIME -> "TIME";case Types.TIMESTAMP -> "TIMESTAMP"; + case Types.CHAR,Types.VARCHAR,Types.LONGVARCHAR,Types.NCHAR,Types.NVARCHAR,Types.LONGNVARCHAR,Types.CLOB,Types.NCLOB -> "STRING"; + default -> throw new IllegalArgumentException("日志通道存在暂不支持的字段类型,请先转换为标准JSON可表达字段"); + }; + } + private static String escape(String value){return value.replace("\\","\\\\").replace("\"","\\\"");} +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactory.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactory.java new file mode 100644 index 0000000..b0013a8 --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactory.java @@ -0,0 +1,70 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import tools.jackson.databind.json.JsonMapper; +import tools.jackson.databind.node.ObjectNode; + +import java.util.Set; +import java.util.regex.Pattern; + +/** Generates the fixed single-table MySQL CDC to Doris execution shape. */ +final class MysqlCdcJobFactory { + private static final Pattern IDENTIFIER = Pattern.compile("[A-Za-z_][A-Za-z0-9_]{0,63}"); + private static final Pattern HOST = Pattern.compile("[A-Za-z0-9][A-Za-z0-9.-]{0,252}"); + private static final Pattern LABEL = Pattern.compile("[A-Za-z0-9_]{1,80}"); + + private MysqlCdcJobFactory() { } + + record Config(String mysqlHost, int mysqlPort, String sourceDatabase, String sourceTable, + String mysqlUser, String mysqlPassword, long serverId, String startupMode, + String dorisHost, int dorisHttpPort, int dorisQueryPort, String targetDatabase, + String targetTable, String dorisUser, String dorisPassword, String labelPrefix, + int checkpointSeconds) { + @Override public String toString() { return "MysqlCdcJobFactory.Config[credentials=REDACTED]"; } + } + + static ObjectNode create(Config c) { + if (c == null || !host(c.mysqlHost()) || !host(c.dorisHost()) || !port(c.mysqlPort()) || + !port(c.dorisHttpPort()) || !port(c.dorisQueryPort()) || !identifier(c.sourceDatabase()) || + !identifier(c.sourceTable()) || !identifier(c.targetDatabase()) || !identifier(c.targetTable()) || + blank(c.mysqlUser()) || blank(c.mysqlPassword()) || blank(c.dorisUser()) || blank(c.dorisPassword()) || + c.serverId() < 1 || c.serverId() > 4_294_967_295L || + c.startupMode() == null || !Set.of("initial", "latest").contains(c.startupMode()) || c.labelPrefix() == null || + !LABEL.matcher(c.labelPrefix()).matches() || c.checkpointSeconds() < 10 || c.checkpointSeconds() > 86_400) { + throw new IllegalArgumentException("CDC_EXECUTION_CONTRACT_INVALID"); + } + ObjectNode root = JsonMapper.builder().build().createObjectNode(); + ObjectNode env = root.putObject("env"); + env.put("job.mode", "STREAMING"); + env.put("parallelism", 1); + env.put("checkpoint.interval", c.checkpointSeconds() * 1000L); + ObjectNode source = root.putArray("source").addObject(); + source.put("plugin_name", "MySQL-CDC"); + source.put("url", "jdbc:mysql://" + c.mysqlHost() + ':' + c.mysqlPort() + '/' + c.sourceDatabase()); + source.put("username", c.mysqlUser()); + source.put("password", c.mysqlPassword()); + source.put("server-id", Long.toString(c.serverId())); + source.put("startup.mode", c.startupMode()); + source.put("schema-changes.enabled", false); + source.putArray("table-names").add(c.sourceDatabase() + '.' + c.sourceTable()); + ObjectNode sink = root.putArray("sink").addObject(); + sink.put("plugin_name", "Doris"); + sink.put("fenodes", c.dorisHost() + ':' + c.dorisHttpPort()); + sink.put("query-port", c.dorisQueryPort()); + sink.put("database", c.targetDatabase()); + sink.put("table", c.targetTable()); + sink.put("username", c.dorisUser()); + sink.put("password", c.dorisPassword()); + sink.put("sink.label-prefix", c.labelPrefix()); + sink.put("sink.enable-delete", true); + sink.put("sink.enable-2pc", true); + sink.put("schema_save_mode", "ERROR_WHEN_SCHEMA_NOT_EXIST"); + sink.put("data_save_mode", "APPEND_DATA"); + sink.putObject("doris.config").put("format", "json").put("read_json_by_line", "true"); + return root; + } + + private static boolean identifier(String value) { return value != null && IDENTIFIER.matcher(value).matches(); } + private static boolean host(String value) { return value != null && HOST.matcher(value).matches(); } + private static boolean port(int value) { return value > 0 && value <= 65535; } + private static boolean blank(String value) { return value == null || value.isBlank(); } +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSource.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSource.java new file mode 100644 index 0000000..da44b21 --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSource.java @@ -0,0 +1,190 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import cn.aixunkeji.datagov.integration.api.DataSourceView; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Spec; +import cn.aixunkeji.datagov.integration.datasource.DataSourceOracleProfile; +import tools.jackson.databind.node.ObjectNode; +import java.sql.*; +import java.util.Set; + +/** Fixed native CDC profiles. JDBC connectivity alone is never advertised as CDC support. */ +final class NativeCdcSource { + private NativeCdcSource() { } + static void validate(DataSourceView s, Spec p) { + if(p.oraclePdb()!=null || p.oracleCdbService()!=null) { + if(!"ORACLE".equals(s.type()) || p.cdcChannel()!=null) + throw new IllegalArgumentException("PDB参数只能用于Oracle原生CDC"); + identifier(p.oraclePdb()); + if(Set.of("CDB$ROOT","PDB$SEED").contains(p.oraclePdb()))throw new IllegalArgumentException("请选择业务PDB"); + if(p.oracleCdbService()==null || !p.oracleCdbService().matches("[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}")) + throw new IllegalArgumentException("请填写CDB根容器服务名"); + } + if(p.cdcChannel()!=null){ + if(!Set.of("DAMENG","KINGBASE","ORACLE").contains(s.type()) || !p.cdcChannel().matches("[A-Za-z0-9_-]{1,64}")) + throw new IllegalArgumentException("此来源不支持所选日志通道"); + identifier(p.sourceSchema());return; + } + if (Set.of("DAMENG","KINGBASE").contains(s.type())) { + identifier(p.sourceSchema());identifier(p.sourceDatabase());identifier(p.sourceTable()); + if(p.oracleDatabase()!=null)throw new IllegalArgumentException("此来源不使用Oracle数据库名"); + if(!Set.of("initial","latest").contains(p.startupMode()))throw new IllegalArgumentException("请选择首次全量或仅增量"); + return; + } + if (!Set.of("MYSQL", "ORACLE", "SQLSERVER").contains(s.type())) + throw new IllegalArgumentException("此数据源尚未接入原生CDC"); + if ("MYSQL".equals(s.type())) { + if (p.sourceSchema()!=null || p.oracleDatabase()!=null) + throw new IllegalArgumentException("MySQL配置不能包含Oracle或架构参数"); + } else { + identifier(p.sourceSchema()); + if ("ORACLE".equals(s.type())) { + identifier(p.oracleDatabase()); + } else { + identifier(p.sourceDatabase()); + if (p.oracleDatabase()!=null) + throw new IllegalArgumentException("SQL Server配置不能包含Oracle参数"); + } + } + } + static ObjectNode job(MysqlCdcJobFactory.Config common, DataSourceView s, Spec p) { + validate(s,p); + ObjectNode root=MysqlCdcJobFactory.create(common); + if ("MYSQL".equals(s.type())) return root; + ObjectNode source=(ObjectNode)root.path("source").get(0); + if(Set.of("DAMENG","KINGBASE").contains(s.type())) { + source.removeAll(); + boolean dm="DAMENG".equals(s.type()); + source.put("plugin_name",dm?"Dameng-Native-CDC":"Kingbase-Native-CDC"); + source.put("url",(dm?"jdbc:dm://":"jdbc:kingbase8://")+s.host()+":"+s.port()+"/"+p.sourceDatabase()+ + (dm?"?connectTimeout=30000&socketTimeout=90000":"?sslmode=disable&connectTimeout=30&socketTimeout=90")); + source.put("username",common.mysqlUser());source.put("password",common.mysqlPassword()); + source.put("source_schema",p.sourceSchema());source.put("source_table",p.sourceTable()); + source.put("startup.mode",p.startupMode()); + if(!dm)source.put("slot_name",VendorCdcPrerequisites.slot(p)); + return root; + } + source.remove("server-id"); + String database="ORACLE".equals(s.type()) ? (p.oraclePdb()==null?p.oracleDatabase():p.oraclePdb()) : p.sourceDatabase(); + source.putArray("database-names").add(database); + source.putArray("table-names").add(database+"."+p.sourceSchema()+"."+p.sourceTable()); + if ("ORACLE".equals(s.type())) { + source.put("plugin_name","Oracle-CDC"); + source.put("url",DataSourceOracleProfile.url(s.host(),s.port(),s.databaseName(),s.userName(),s.connectionParameters())); + source.putArray("schema-names").add(p.sourceSchema()); + source.put("skip_analyze",true); + source.put("use_select_count",true); + source.putObject("debezium").put("database.dbname",p.oracleDatabase()); + if(p.oraclePdb()!=null) { + var debezium=(ObjectNode)source.path("debezium"); + debezium.put("database.pdb.name",p.oraclePdb()); + debezium.put("database.url",oracleRootUrl(s,p)); + } + } else { + source.put("plugin_name","SqlServer-CDC"); + boolean ssl=Boolean.parseBoolean(s.connectionParameters().getOrDefault("useSsl","false")); + String trust=s.connectionParameters().getOrDefault("trustServerCertificate","false"); + source.put("url","jdbc:sqlserver://"+s.host()+":"+s.port()+";databaseName="+p.sourceDatabase()+ + ";encrypt="+ssl+";trustServerCertificate="+trust+";integratedSecurity=false"); + // 2.3.13 must receive these explicitly for both snapshot and Debezium connections. + source.putObject("debezium").put("database.encrypt",Boolean.toString(ssl)).put("database.trustServerCertificate",trust); + } + return root; + } + static String oracleRootUrl(DataSourceView s,Spec p) { + return "jdbc:oracle:thin:@//"+s.host()+":"+s.port()+"/"+p.oracleCdbService(); + } + static String table(DataSourceView s,Spec p) { + return switch(s.type()) { + case "MYSQL" -> "`"+p.sourceDatabase()+"`.`"+p.sourceTable()+"`"; + case "SQLSERVER" -> "["+p.sourceDatabase()+"].["+p.sourceSchema()+"].["+p.sourceTable()+"]"; + case "ORACLE","DAMENG","KINGBASE" -> "\""+p.sourceSchema()+"\".\""+p.sourceTable()+"\""; + default -> throw new IllegalArgumentException("不支持此CDC类型"); + }; + } + static void prerequisites(Connection db,DataSourceView s,Spec p) throws SQLException { + try(var st=db.createStatement()) { + st.setQueryTimeout(15); + switch(s.type()) { + case "DAMENG","KINGBASE" -> VendorCdcPrerequisites.check(db,s.type(),p); + case "MYSQL" -> { + try(var rs=st.executeQuery("SELECT @@log_bin, @@binlog_format, @@binlog_row_image")) { + if(!rs.next()||!rs.getBoolean(1)||!"ROW".equalsIgnoreCase(rs.getString(2))||!"FULL".equalsIgnoreCase(rs.getString(3))) + throw new IllegalArgumentException("MySQL源库需要启用Binlog,并设置ROW与FULL"); + } + } + case "SQLSERVER" -> { + try(var rs=st.executeQuery("SELECT is_cdc_enabled FROM sys.databases WHERE name=DB_NAME()")) { + if(!rs.next()||!rs.getBoolean(1))throw new IllegalArgumentException("SQL Server源数据库未启用CDC,请由DBA启用数据库CDC及捕获作业"); + } + try(var ps=db.prepareStatement("SELECT t.is_tracked_by_cdc FROM sys.tables t JOIN sys.schemas s ON s.schema_id=t.schema_id WHERE s.name=? AND t.name=?")) { + ps.setQueryTimeout(15);ps.setString(1,p.sourceSchema());ps.setString(2,p.sourceTable()); + try(var rs=ps.executeQuery()) { + if(!rs.next()||!rs.getBoolean(1))throw new IllegalArgumentException("SQL Server源表不存在、不可见或尚未启用CDC;请检查架构、表权限及表级CDC"); + } + } + // Checks capture-table visibility for this account; does not enable CDC or mutate grants. + try(var rs=st.executeQuery("SELECT capture_instance FROM cdc.change_tables WHERE source_object_id=OBJECT_ID(N'"+p.sourceSchema()+"."+p.sourceTable()+"')")) { + if(!rs.next())throw new IllegalArgumentException("当前账号不可读取SQL Server源表的CDC捕获实例"); + } + } + case "ORACLE" -> { + try(var rs=st.executeQuery("SELECT NAME, LOG_MODE, SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_ALL, CDB FROM V$DATABASE")) { + if(!rs.next())throw new IllegalArgumentException("无法读取Oracle日志配置"); + if(!p.oracleDatabase().equals(rs.getString(1)))throw new IllegalArgumentException("Oracle数据库名与V$DATABASE.NAME不一致,不能填写服务名或PDB名代替"); + if(!"ARCHIVELOG".equals(rs.getString(2))||!Set.of("YES","IMPLICIT").contains(rs.getString(3))) + throw new IllegalArgumentException("Oracle需要开启ARCHIVELOG和最小补充日志,请由DBA配置"); + if("YES".equals(rs.getString(5)) != (p.oraclePdb()!=null)) + throw new IllegalArgumentException("Oracle架构与配置不一致:多租户库请填写目标PDB和CDB根容器服务名;非CDB请留空"); + } + if(p.oraclePdb()!=null)verifyContainer(db,p.oraclePdb()); + try(var ps=db.prepareStatement("SELECT COUNT(*) FROM ALL_LOG_GROUPS WHERE OWNER=? AND TABLE_NAME=? AND LOG_GROUP_TYPE='ALL COLUMN LOGGING'")) { + ps.setQueryTimeout(15);ps.setString(1,p.sourceSchema());ps.setString(2,p.sourceTable()); + try(var rs=ps.executeQuery();var logs=db.createStatement()) { + logs.setQueryTimeout(15); + try(var all=logs.executeQuery("SELECT SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE")) { + if(!rs.next()||!all.next()||rs.getLong(1)==0&&!"YES".equals(all.getString(1))) + throw new IllegalArgumentException("Oracle源表缺少ALL COLUMNS补充日志,无法可靠同步更新和删除"); + } + } + } + } + default -> throw new IllegalArgumentException("不支持此CDC类型"); + } + } + } + static void verifyContainer(Connection db,String expected)throws SQLException { + try(var st=db.createStatement()) { + st.setQueryTimeout(15); + try(var rs=st.executeQuery("SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM DUAL")) { + if(!rs.next() || !expected.equals(rs.getString(1))) + throw new IllegalArgumentException("Oracle连接容器不匹配,要求连接到 "+expected+";请检查数据源服务名和CDB服务名"); + } + } + } + static void oracleRootPrerequisites(Connection db,Spec p)throws SQLException { + verifyContainer(db,"CDB$ROOT"); + try(var st=db.createStatement()) { + st.setQueryTimeout(15); + try(var rs=st.executeQuery("SELECT NAME, LOG_MODE, SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE")) { + if(!rs.next() || !p.oracleDatabase().equals(rs.getString(1)) || !"ARCHIVELOG".equals(rs.getString(2)) || + !Set.of("YES","IMPLICIT").contains(rs.getString(3))) + throw new IllegalArgumentException("CDB数据库名、归档模式或根容器补充日志不满足CDC要求"); + } + try(var rs=st.executeQuery("SELECT COMMON FROM USER_USERS")) { + if(!rs.next() || !"YES".equals(rs.getString(1)))throw new IllegalArgumentException("CDB/PDB采集需要可访问根容器及目标PDB的公共用户"); + } + try(var rs=st.executeQuery("SELECT PRIVILEGE FROM SESSION_PRIVS WHERE PRIVILEGE IN ('LOGMINING','SET CONTAINER')")) { + var privileges=new java.util.HashSet();while(rs.next())privileges.add(rs.getString(1)); + if(!privileges.containsAll(Set.of("LOGMINING","SET CONTAINER"))) + throw new IllegalArgumentException("Oracle公共用户缺少LOGMINING或SET CONTAINER权限,请由DBA配置"); + } + // Verify the same connection can switch containers without changing persistent configuration. + st.execute("ALTER SESSION SET CONTAINER = \""+p.oraclePdb()+"\""); + verifyContainer(db,p.oraclePdb()); + } + } + private static void identifier(String value) { + if(value==null||!value.matches("[A-Za-z_][A-Za-z0-9_$#]{0,127}")) + throw new IllegalArgumentException("请填写正确的源架构、Oracle数据库名或PDB名"); + } +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCollectionDubboService.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCollectionDubboService.java new file mode 100644 index 0000000..aa35a11 --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCollectionDubboService.java @@ -0,0 +1,215 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import cn.aixunkeji.datagov.integration.api.*; +import cn.aixunkeji.datagov.integration.datasource.DataSourceAccessScope; +import cn.aixunkeji.datagov.integration.datasource.DataSourceObjectConnection; +import cn.aixunkeji.datagov.integration.m2.*; +import org.apache.dubbo.config.annotation.DubboService; +import java.sql.*; +import java.util.*; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; + +@DubboService(timeout = 120000, retries = 0) +public class RealtimeCollectionDubboService implements RealtimeCollectionService { + private final DataSourceRegistry sources; + private final M2SecretReader secrets; + private final SeaTunnelAdapter engine; + private final DataSourceObjectConnection connections; + private final CdcRelayRegistry relays; + public RealtimeCollectionDubboService(DataSourceRegistry sources, M2SecretReader secrets, SeaTunnelAdapter engine, + DataSourceObjectConnection connections,CdcRelayRegistry relays) { + this.sources = sources; this.secrets = secrets; this.engine = engine; this.connections = connections;this.relays=relays; + } + @Override public List relays(long actor,long org,long source){ + if(actor<=0||org<=0||sources.find(new DataSourceAccessScope(actor,org),source)==null)return List.of(); + return relays.options(org,source); + } + private DataSourceView source(Command c) { + if(c == null || c.actorId() <= 0 || c.orgId() <= 0 || c.spec() == null || c.target() == null) + throw new IllegalArgumentException("实时采集配置不完整"); + var s = sources.find(new DataSourceAccessScope(c.actorId(), c.orgId()), c.spec().sourceId()); + if(s == null || s.version() != c.spec().sourceVersion() || + !Objects.equals(s.databaseName(), c.spec().sourceDatabase())) + throw new IllegalArgumentException("源数据源已变化或不在授权范围,请重新创建配置"); + var t=c.target(); + if(!"DORIS".equals(t.resourceType()) || t.resourceId()!=c.spec().targetResourceId() || + !Objects.equals(t.spaceId(), c.spec().targetSpaceId()) || t.tlsEnabled() || + c.spec().cdcChannel()==null && !"SQLSERVER".equals(s.type()) && Boolean.parseBoolean(s.connectionParameters().getOrDefault("useSsl", "false"))) + throw new IllegalArgumentException("当前CDC要求Doris及MySQL/Oracle使用非TLS连接;SQL Server沿用登记的SSL设置"); + NativeCdcSource.validate(s,c.spec()); + if(c.spec().cdcChannel()!=null)relays.require(c);else NativeCdcSource.job(config(c,s),s,c.spec()); + return s; + } + private MysqlCdcJobFactory.Config config(Command c, DataSourceView s) { + var p=c.spec(); var t=c.target(); + return new MysqlCdcJobFactory.Config(s.host(),s.port(),"MYSQL".equals(s.type())?p.sourceDatabase():"cdc",p.sourceTable(),s.userName(), + secrets.resolve(s.secretRef()),p.serverId(),p.startupMode(),t.endpointHost(),p.httpPort(),t.endpointPort(), + t.externalSpaceId(),p.targetTable(),t.serviceAccount(),secrets.resolve(t.secretRef()), + "cdc_"+c.taskId()+"_"+c.attempt(),p.checkpointSeconds()); + } + @Override public Check check(Command c) { + String stage="解析连接配置"; + try { + var s=source(c); var p=c.spec(); var t=c.target(); + if(p.oraclePdb()!=null) { + stage="检查Oracle CDB根容器连接和采集权限"; + var props=new Properties();props.setProperty("user",s.userName()); + props.setProperty("password",secrets.resolve(s.secretRef())); + props.setProperty("oracle.net.CONNECT_TIMEOUT","15000");props.setProperty("oracle.jdbc.ReadTimeout","30000"); + try(var root=DriverManager.getConnection(NativeCdcSource.oracleRootUrl(s,p),props)) { + NativeCdcSource.oracleRootPrerequisites(root,p); + } + } + List fields=new ArrayList<>(), keys=new ArrayList<>(), signatures=new ArrayList<>(); + stage="连接"+s.type()+"源库"; + try(var db="MYSQL".equals(s.type()) ? connect(s.host(),s.port(),p.sourceDatabase(),s.userName(),secrets.resolve(s.secretRef())) : + connections.open(s,new DataSourceAccessScope(c.actorId(),c.orgId())); + var st=db.createStatement()) { + st.setQueryTimeout(15); + stage="检查"+s.type()+"日志和CDC配置"; + if(p.cdcChannel()==null)NativeCdcSource.prerequisites(db,s,p); + stage="读取"+s.type()+"源表主键"; + try(var rs=db.getMetaData().getPrimaryKeys(Set.of("ORACLE","DAMENG").contains(s.type())?null:p.sourceDatabase(),p.sourceSchema(),p.sourceTable())) { + Map ordered=new TreeMap<>(); + while(rs.next()) ordered.put(rs.getShort("KEY_SEQ"),rs.getString("COLUMN_NAME")); + keys.addAll(ordered.values()); + } + if(keys.isEmpty()) return rejected("源表必须有主键"); + stage="读取"+s.type()+"源表字段"; + try(var rs=st.executeQuery("SELECT * FROM "+NativeCdcSource.table(s,p)+" WHERE 1=0")) { + var md=rs.getMetaData(); + if(md.getColumnCount()>200) return rejected("首期每表最多支持200个字段"); + for(int i=1;i<=md.getColumnCount();i++) { + fields.add(md.getColumnName(i)); + signatures.add(md.getColumnName(i)+":"+md.getColumnTypeName(i)+":"+md.getPrecision(i)+":"+md.getScale(i)); + if(p.cdcChannel()!=null)CdcRelayRegistry.type(md.getColumnType(i),md.getPrecision(i),md.getScale(i)); + else if(Set.of("DAMENG","KINGBASE").contains(s.type()))VendorCdcPrerequisites.field(md,i); + } + } + } + stage="连接Doris目标库"; + try(var db=connect(t.endpointHost(),t.endpointPort(),t.externalSpaceId(),t.serviceAccount(),secrets.resolve(t.secretRef())); + var st=db.createStatement()) { + st.setQueryTimeout(15); + stage="读取Doris目标表定义"; + try(var rs=st.executeQuery("SHOW CREATE TABLE `"+t.externalSpaceId()+"`.`"+p.targetTable()+"`")) { + if(!rs.next()) return rejected("请先创建目标表"); + String ddl=rs.getString(2); + var matcher=java.util.regex.Pattern.compile("(?is)UNIQUE\\s+KEY\\s*\\(([^)]+)\\)").matcher(ddl); + if(!matcher.find()) return rejected("Doris目标表必须为Unique Key模型"); + var targetKeys=Arrays.stream(matcher.group(1).replace("`", "").split(",")).map(String::trim).toList(); + if(!keys.equals(targetKeys)) return rejected("目标Unique Key须与源主键一致且顺序相同"); + signatures.add(ddl); + } + stage="读取Doris目标表字段"; + try(var rs=st.executeQuery("SELECT * FROM `"+t.externalSpaceId()+"`.`"+p.targetTable()+"` WHERE 1=0")) { + var md=rs.getMetaData(); var targetFields=new ArrayList(); + for(int i=1;i<=md.getColumnCount();i++) targetFields.add(md.getColumnName(i)); + if(!fields.equals(targetFields)) return rejected("首期要求目标表与源表字段名称、顺序完全一致"); + } + if("initial".equals(p.startupMode()) && c.attempt()<=1 && c.recovery()==null) { + stage="检查Doris目标表是否为空"; + try(var rs=st.executeQuery("SELECT 1 FROM `"+t.externalSpaceId()+"`.`"+p.targetTable()+"` LIMIT 1")) { + if(rs.next()) return rejected("首次全量同步要求目标表为空;已有基线请使用仅增量模式"); + } + } + } + if(p.cdcChannel()!=null)signatures.add(relays.fingerprint(c)); + String fingerprint=hash(p.fingerprintText()+"|"+s.version()+"|"+s.host()+"|"+s.port()+"|"+s.secretRef()+"|"+ + s.userName()+"|"+t.endpointHost()+"|"+t.endpointPort()+"|"+t.serviceAccount()+"|"+t.secretRef()+"|"+t.externalSpaceId()+"|"+signatures); + return new Check(true,p.cdcChannel()==null?"源库日志、主键与目标表结构检查通过;启动后核验同步结果": + "日志通道绑定、源表和目标表检查通过;需确认上游已输出全量及完整变更消息,Kafka连接与真实消息在启动后验证",fingerprint,fields,keys); + } catch(IllegalArgumentException e) { return rejected(e.getMessage()); } + catch(Exception e) { return rejected(checkFailure(stage,e)); } + } + static String checkFailure(String stage, Exception failure) { + String reason="检查失败,请核对该步骤的连接配置和服务状态"; + if(failure instanceof SQLException sql) { + String state=Objects.toString(sql.getSQLState(), ""); + int code=sql.getErrorCode(); + String message=Objects.toString(sql.getMessage(), "").toLowerCase(Locale.ROOT); + boolean dorisMissingTable=code==1105 && (message.contains("unknown table") || + message.matches("(?s).*table[^\\n]*(does not exist|doesn't exist|not exist|not found).*")); + if(code==1049 || code==4060 || code==12514 || code==1105 && message.contains("unknown database")) reason="数据库或连接服务不存在、未注册或无权访问,请核对所选数据库及服务名"; + else if(code==1146 || code==942 || code==208 || "42S02".equals(state) || dorisMissingTable) reason="表不存在或无权读取(也可能是系统视图),请核对架构、表名及大小写;Doris目标表需要预先创建"; + else if(code==1105 && (message.contains("access denied") || message.contains("permission denied"))) reason="账号缺少此步骤需要的权限"; + else if(code==1045 || code==1017 || code==18456 || state.startsWith("28")) reason="账号认证失败,请检查此端的账号和托管密码"; + else if(Set.of(1044,1142,1143,1227,1031,229,297).contains(code) || "42501".equals(state)) reason="账号缺少此步骤需要的权限"; + else if(failure instanceof SQLTimeoutException || state.startsWith("HYT")) reason="访问超时,请检查Integration容器到数据库的网络"; + else if(state.startsWith("08")) reason="连接或通信失败,请检查Integration容器网络、数据库服务及连接参数"; + else reason="数据库拒绝此步骤,请核对表结构、权限及数据库兼容性"; + // Only structured codes are exposed; driver messages can contain credentials and SQL. + return stage+"失败:"+reason+"(SQLState="+(state.matches("[A-Za-z0-9]{5}")?state:"UNKNOWN")+", code="+code+")"; + } + return stage+"失败:"+reason; + } + @Override public Result execute(Command c, String action, String externalId, String restoreId) { + String expected=RealtimeCollectionService.jobId(c.orgId(),c.taskId(),c.attempt()); + String name=RealtimeCollectionService.jobName(c.taskId(),c.attempt()); + try { + if(c.actorId()<=0 || c.orgId()<=0 || c.spec()==null || + sources.find(new DataSourceAccessScope(c.actorId(),c.orgId()),c.spec().sourceId())==null) + return unknown(expected,"源数据源不在当前授权范围"); + if(!expected.equals(externalId)) return unknown(expected,"外部作业身份不一致"); + if("RECREATE".equals(action)) { + if(engine.absentFromIdleEngine(expected)) + return new Result("ABSENT",expected,"已核实引擎无运行或排队作业,旧作业记录不存在;历史执行结果不作推断",null,null,null); + return unknown(expected,"未清理:引擎仍有作业、记录仍存在或查询失败,请核实后重试"); + } + if("START".equals(action) || "RESUME".equals(action)) { + DataSourceView s; + try {s=source(c);} catch(RuntimeException ex) { + return new Result("REJECTED",expected,"来源版本、目标配置或受管凭据已变化,请重新校验",null,null,null); + } + var check=check(c); + if(!check.ready() || !Objects.equals(check.fingerprint(),c.fingerprint())) + return new Result("REJECTED",expected,check.ready()?"配置或表结构已变化,禁止沿用原断点":check.summary(),null,null,null); + if("RESUME".equals(action)) { + String prior=expected; + var old=engine.queryJob(prior); + if(!validRecovery(c,restoreId) || !engine.recoverableStreamingIdentity(old,expected,name)) + return new Result("REJECTED",expected,"恢复证据不完整、作业仍在运行或引擎不可查询;未启动新采集",null,null,null); + } + var job=executionJob(c,s); + if("RESUME".equals(action))job.withObject("env").put("aixun.restore.checkpoint",Long.parseLong(c.recovery().checkpointId())); + var result=engine.submitStreaming(RealtimeCollectionService.identity(c.orgId(),c.taskId(),c.attempt()), + c.fingerprint(),name,job,restoreId); + if("CDC_CHECKPOINT_UNAVAILABLE".equals(result.errorCode()))return new Result("REJECTED",expected,result.errorSummary(),null,null,null); + return new Result(result.status().name(),expected,result.errorSummary(),null,null,null); + } + var info="STOP".equals(action)?engine.stopStreaming(expected,name):engine.queryJob(expected); + if(!expected.equals(info.jobId()) || !name.equals(info.jobName())) return unknown(expected,statusQueryFailure(info,expected)); + var cp=engine.checkpoint(expected); + return new Result(info.status().name(),expected,info.errorSummary(),cp.completed()?cp.checkpointId():null, + info.sourceCount(),info.targetCount()); + } catch(Exception e) { return unknown(expected,"外部执行结果待确认,请刷新状态,勿重复启动"); } + } + static String statusQueryFailure(cn.aixunkeji.datagov.integration.m2.SeaTunnelAdapter.JobInfoResult info,String expected) { + if(expected.equals(info.jobId()) && info.jobName()==null && info.errorSummary()!=null) + return info.errorSummary(); + return "返回的作业身份与当前任务不一致,无法确认状态;请检查采集引擎配置,勿重复启动"; + } + private static Connection connect(String host,int port,String database,String user,String password) throws SQLException { + return DriverManager.getConnection("jdbc:mysql://"+host+":"+port+"/"+database+ + "?connectTimeout=5000&socketTimeout=15000&useSSL=false&allowPublicKeyRetrieval=true",user,password); + } + private tools.jackson.databind.node.ObjectNode executionJob(Command c,DataSourceView s) throws SQLException { + if(c.spec().cdcChannel()==null)return NativeCdcSource.job(config(c,s),s,c.spec()); + try(var db=connections.open(s,new DataSourceAccessScope(c.actorId(),c.orgId()));var st=db.createStatement()){ + st.setQueryTimeout(15); + try(var rs=st.executeQuery("SELECT * FROM "+NativeCdcSource.table(s,c.spec())+" WHERE 1=0")){ + return relays.job(c,config(c,s),rs.getMetaData()); + } + } + } + static boolean validRecovery(Command c,String restoreId) { + var p=c.recovery();String id=RealtimeCollectionService.jobId(c.orgId(),c.taskId(),c.attempt()); + return p!=null && id.equals(restoreId) && id.equals(p.jobId()) && + Set.of("CANCELED","FAILED").contains(p.status()) && p.checkpointId()!=null && + p.checkpointId().matches("[0-9]{1,18}") && c.fingerprint()!=null && c.fingerprint().matches("[a-f0-9]{64}"); + } + private static Check rejected(String text) { return new Check(false,text,null,List.of(),List.of()); } + private static Result unknown(String id,String text) { return new Result("UNKNOWN",id,text,null,null,null); } + private static String hash(String text) throws Exception {return HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(text.getBytes(StandardCharsets.UTF_8)));} +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/VendorCdcPrerequisites.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/VendorCdcPrerequisites.java new file mode 100644 index 0000000..d9cb650 --- /dev/null +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/batchingestion/VendorCdcPrerequisites.java @@ -0,0 +1,65 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Spec; +import java.sql.*; +import java.util.*; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; + +/** Read-only checks. Never changes source logging, privileges or replication slots. */ +final class VendorCdcPrerequisites { + private VendorCdcPrerequisites() { } + static void field(ResultSetMetaData md,int i)throws SQLException { + int t=md.getColumnType(i); + if(!Set.of(Types.TINYINT,Types.SMALLINT,Types.INTEGER,Types.BIGINT,Types.FLOAT,Types.REAL,Types.DOUBLE, + Types.NUMERIC,Types.DECIMAL,Types.CHAR,Types.VARCHAR,Types.NCHAR,Types.NVARCHAR,Types.BOOLEAN,Types.BIT, + Types.DATE,Types.TIME,Types.TIMESTAMP).contains(t))throw new IllegalArgumentException("原生CDC暂不支持LOB、二进制、数组或带时区字段,请选择支持的源表"); + if((t==Types.NUMERIC||t==Types.DECIMAL)&&(md.getPrecision(i)<1||md.getPrecision(i)>38||md.getScale(i)<0||md.getScale(i)>md.getPrecision(i))) + throw new IllegalArgumentException("原生CDC仅支持精度不超过38且明确声明精度的小数列"); + if(!md.getColumnName(i).matches("[A-Za-z_][A-Za-z0-9_$#]{0,127}"))throw new IllegalArgumentException("原生CDC字段名当前仅支持字母、数字、下划线及$、#,请选择符合命名要求的源表"); + } + static String slot(Spec p) { + try { + byte[] digest=MessageDigest.getInstance("SHA-256").digest((p.sourceId()+":"+p.sourceSchema()+":"+p.sourceTable()).getBytes(StandardCharsets.UTF_8)); + return "aixun_"+HexFormat.of().formatHex(digest,0,12); + }catch(java.security.NoSuchAlgorithmException e){throw new IllegalStateException(e);} + } + static void check(Connection db,String type,Spec p)throws SQLException { + if("DAMENG".equals(type)) { + try(var st=db.createStatement()) { + st.setQueryTimeout(15); + Map values=new HashMap<>(); + try(var rs=st.executeQuery("SELECT PARA_NAME, PARA_VALUE FROM V$DM_INI WHERE PARA_NAME IN ('ARCH_INI','RLOG_APPEND_LOGIC','RLOG_LLOG_COMPRESS','LOGMNR_DELAY_ANALYZE')")) { + while(rs.next())values.put(rs.getString(1),rs.getString(2)); + } + for(var entry:Map.of("ARCH_INI","1","RLOG_APPEND_LOGIC","2","RLOG_LLOG_COMPRESS","0","LOGMNR_DELAY_ANALYZE","0").entrySet()) + if(!entry.getValue().equals(values.get(entry.getKey())))throw new IllegalArgumentException("达梦日志配置不满足要求:"+entry.getKey()+" 应为 "+entry.getValue()+",当前为 "+values.getOrDefault(entry.getKey(),"不可读取")+";请由数据库管理员调整"); + try(var rs=st.executeQuery("SELECT NAME FROM V$ARCHIVED_LOG WHERE ROWNUM=1")) { + if(!rs.next())throw new IllegalArgumentException("达梦尚无可读取的归档日志,请检查本地归档配置及归档生成情况"); + } + try(var rs=st.executeQuery("SELECT SCN, COMMIT_SCN, STATUS, REDO_VALUE, UNDO_VALUE FROM V$LOGMNR_CONTENTS WHERE 1=0")){rs.getMetaData();} + } + } else { + try(var st=db.createStatement()) { + st.setQueryTimeout(15); + try(var rs=st.executeQuery("SHOW wal_level")) { + if(!rs.next()||!"logical".equalsIgnoreCase(rs.getString(1)))throw new IllegalArgumentException("金仓 wal_level 必须为 logical,请由数据库管理员配置逻辑复制"); + } + } + try(var ps=db.prepareStatement("SELECT plugin, database, active FROM sys_replication_slots WHERE slot_name=?")) { + ps.setQueryTimeout(15);ps.setString(1,slot(p)); + try(var rs=ps.executeQuery()) { + if(!rs.next())throw new IllegalArgumentException("请由数据库管理员预建专用 test_decoding 复制槽:"+slot(p)+";此槽仅供当前源表使用"); + if(!"test_decoding".equals(rs.getString(1))||!p.sourceDatabase().equals(rs.getString(2)))throw new IllegalArgumentException("金仓复制槽的解码插件或所属数据库与任务不一致"); + if(rs.getBoolean(3))throw new IllegalArgumentException("金仓复制槽正在使用,请先确认原采集任务已停止"); + } + } + try(var ps=db.prepareStatement("SELECT c.relreplident FROM sys_class c JOIN sys_namespace n ON n.oid=c.relnamespace WHERE n.nspname=? AND c.relname=?")) { + ps.setQueryTimeout(15);ps.setString(1,p.sourceSchema());ps.setString(2,p.sourceTable()); + try(var rs=ps.executeQuery()) { + if(!rs.next()||!"f".equals(rs.getString(1)))throw new IllegalArgumentException("金仓源表需设置 REPLICA IDENTITY FULL,保证更新和删除包含完整行镜像"); + } + } + } + } +} diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/DataSourceRegistry.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/DataSourceRegistry.java index 17d3bfe..83799b1 100644 --- a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/DataSourceRegistry.java +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/DataSourceRegistry.java @@ -450,6 +450,7 @@ public class DataSourceRegistry { assertReference("批量采集任务", "SELECT COUNT(*) FROM ing_batch_task WHERE source_ref_id=?", dataSourceId); assertReference("统一采集记录", "SELECT COUNT(*) FROM ing_ingestion_collection_item WHERE source_id=?", dataSourceId); assertReference("文件CDC任务", "SELECT COUNT(*) FROM ing_file_intake WHERE cdc_datasource_id=?", dataSourceId); + assertReference("实时采集任务", "SELECT COUNT(*) FROM ing_realtime_task WHERE source_id=?", dataSourceId); assertReference("元数据采集连接器", "SELECT COUNT(*) FROM md_ingestion_connector WHERE source_data_source_id=?", dataSourceId); assertReference("数据画像请求", "SELECT COUNT(*) FROM dq_data_profile_request WHERE data_source_id=?", dataSourceId); assertReference("质量规则", "SELECT COUNT(*) FROM dq_quality_rule WHERE target_data_source_id=?", dataSourceId); diff --git a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelAdapter.java b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelAdapter.java index 8eea591..afa8249 100644 --- a/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelAdapter.java +++ b/aixun-modules/aixun-integration/src/main/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelAdapter.java @@ -82,6 +82,57 @@ public class SeaTunnelAdapter { } } + /** CDC uses a bounded observation instead of waiting for a never-ending job to finish. */ + public JobResult submitStreaming(String actionKey, String fingerprint, String jobName, ObjectNode job, + String restoreId) { + if (!"STREAMING".equals(job.path("env").path("job.mode").asText())) + throw new IllegalArgumentException("CDC_STREAMING_REQUIRED"); + return submitTracked(actionKey, fingerprint, jobName, job, + restoreId == null ? null : "SAME_ID_SAVEPOINT", restoreId); + } + + public boolean recoverableStreamingIdentity(JobInfoResult observed,String expectedId,String expectedName) { + if(!expectedId.equals(observed.jobId()))return false; + if("SEATUNNEL_JOB_NOT_FOUND".equals(observed.errorCode()) || "SEATUNNEL_JOB_RECORD_EXPIRED".equals(observed.errorCode()))return true; + return expectedName.equals(observed.jobName()) && + (observed.status()==NormalizedExternalStatus.CANCELED || observed.status()==NormalizedExternalStatus.FAILED); + } + + public JobInfoResult stopStreaming(String jobId, String expectedName) { + JobInfoResult before = queryJob(jobId); + if (!jobId.equals(before.jobId()) || !expectedName.equals(before.jobName())) return before; + if (before.status() == NormalizedExternalStatus.CANCELED || before.status() == NormalizedExternalStatus.FAILED || + before.status() == NormalizedExternalStatus.SUCCEEDED) return before; + try { + ObjectNode body = JsonUtils.getObjectMapper().createObjectNode(); + body.put("jobId", Long.parseLong(requireJobId(jobId))); + body.put("isStopWithSavePoint", true); + client().post().uri("/stop-job").header(HttpHeaders.CONTENT_TYPE, "application/json") + .body(body).retrieve().toBodilessEntity(); + return queryJob(jobId); + } catch (RuntimeException ex) { + return jobInfoUnavailable(jobId, "UNKNOWN", "CDC_STOP_UNCONFIRMED", "停止结果待确认,请刷新状态"); + } + } + + /** Explicit user cleanup only. Fail closed unless the engine has no live/pending work. */ + public boolean absentFromIdleEngine(String jobId) { + try { + var client=client(); + JsonNode before=client.get().uri("/job-info/{jobId}",requireJobId(jobId)).retrieve().body(JsonNode.class); + JsonNode running=client.get().uri("/running-jobs").retrieve().body(JsonNode.class); + JsonNode pending=client.get().uri("/pending-jobs").retrieve().body(JsonNode.class); + JsonNode after=client.get().uri("/job-info/{jobId}",jobId).retrieve().body(JsonNode.class); + return before!=null && after!=null && documentedMissingJob(before,jobId) && documentedMissingJob(after,jobId) + && idleQueues(running,pending); + } catch(RuntimeException e) { return false; } + } + static boolean idleQueues(JsonNode running,JsonNode pending) { + return running!=null && running.isArray() && running.isEmpty() && pending!=null + && pending.path("pendingJobs").isArray() && pending.path("pendingJobs").isEmpty() + && pending.path("queueSummary").path("size").isIntegralNumber() + && pending.path("queueSummary").path("size").asLong()==0; + } private static JobInfoResult jobInfoUnavailable(String jobId, String source, String code, String summary) { return new JobInfoResult(jobId, null, source, NormalizedExternalStatus.UNKNOWN, null, null, LocalDateTime.now(), code, summary); @@ -261,6 +312,11 @@ public class SeaTunnelAdapter { "SEATUNNEL_JOB_REQUEST_INVALID", "SeaTunnel作业请求不完整或格式无效"); } String requestedJobId = Long.toString(stableJobId(externalActionKey)); + boolean sameIdRestore="SAME_ID_SAVEPOINT".equals(restoreMode); + if(sameIdRestore && (!requestedJobId.equals(restoreSourceJobId) || + !job.path("env").path("aixun.restore.checkpoint").isIntegralNumber())) + return new JobResult(requestedJobId,jobName,"REQUEST_REJECTED",NormalizedExternalStatus.FAILED, + "CDC_RECOVERY_EVIDENCE_INVALID","恢复必须使用原作业身份和已确认检查点"); String phase = "LOOKUP"; try { RestClient client = client(); @@ -280,7 +336,8 @@ public class SeaTunnelAdapter { NormalizedExternalStatus.FAILED, "SEATUNNEL_JOB_IDENTITY_CONFLICT", "相同外部动作键已绑定不同快照,拒绝重复提交"); } - return poll(client, requestedJobId, jobName); + if(!sameIdRestore || !Set.of("SAVEPOINT_DONE","CANCELED","FAILED").contains(existing.path("jobStatus").asText())) + return poll(client, requestedJobId, jobName, "STREAMING".equals(job.path("env").path("job.mode").asText())); } } catch (RestClientResponseException exception) { if (exception.getStatusCode().value() != 404) { @@ -293,7 +350,9 @@ public class SeaTunnelAdapter { JsonNode response = client.post().uri(builder -> { var uri = builder.path("/submit-job").queryParam("jobId", requestedJobId) .queryParam("jobName", jobName).queryParam("format", "json"); - if (restoreMode != null) { + if(sameIdRestore) { + uri.queryParam("isStartWithSavePoint",true); + } else if (restoreMode != null) { uri.queryParam("restoreMode", restoreMode) .queryParam("restoreSourceJobId", requireJobId(restoreSourceJobId)); } @@ -317,9 +376,10 @@ public class SeaTunnelAdapter { NormalizedExternalStatus.UNKNOWN, "SEATUNNEL_SUBMIT_RESPONSE_MISMATCH", "SeaTunnel提交响应与请求身份不一致,需对账"); } - return poll(client, returnedJobId, jobName); + return poll(client, returnedJobId, jobName, "STREAMING".equals(job.path("env").path("job.mode").asText())); } catch (RestClientResponseException exception) { JobResult failure = requestFailure(requestedJobId, jobName, phase, exception); + if ("CDC_CHECKPOINT_UNAVAILABLE".equals(failure.errorCode())) return failure; return "SUBMIT".equals(phase) && exception.getStatusCode().is5xxServerError() ? recoverUnconfirmedSubmit(requestedJobId, jobName, failure) : failure; } catch (ResourceAccessException exception) { @@ -356,7 +416,7 @@ public class SeaTunnelAdapter { } } - private JobResult poll(RestClient client, String jobId, String jobName) { + private JobResult poll(RestClient client, String jobId, String jobName, boolean streaming) { for (int attempt = 0; attempt < 180; attempt++) { JsonNode info; try { @@ -382,6 +442,8 @@ public class SeaTunnelAdapter { return new JobResult(jobId, jobName, "JOB_INFO_MISMATCH", NormalizedExternalStatus.UNKNOWN, "SEATUNNEL_JOB_INFO_MISMATCH", "SeaTunnel状态响应与提交身份不一致,需对账"); } + if (streaming) return new JobResult(jobId, jobName, observed.sourceStatus(), observed.status(), + observed.errorCode(), observed.errorSummary()); if (observed.status() == NormalizedExternalStatus.SUCCEEDED) { return new JobResult(jobId, jobName, observed.sourceStatus(), observed.status(), null, null); } @@ -437,7 +499,74 @@ public class SeaTunnelAdapter { return new JobInfoResult(info.path("jobId").asText(null), info.path("jobName").asText(null), sourceStatus, normalized, sourceCount, sinkCommitted == null ? sinkWrite : sinkCommitted, sinkCommittedBytes == null ? sinkWriteBytes : sinkCommittedBytes, LocalDateTime.now(), - error == null ? null : "SEATUNNEL_" + sourceStatus, safe(error)); + error == null ? null : "SEATUNNEL_" + sourceStatus, explainJobFailure(error)); + } + + /** Inspect the complete cause chain before reducing it to a public, credential-free message. */ + static String explainJobFailure(String error) { + if (error == null || error.isBlank()) return null; + String lower = error.toLowerCase(Locale.ROOT); + if(error.contains("归档窗口超过")||error.contains("CDC批次超过")||lower.contains("cdc batch exceeds")||lower.contains("transaction exceeds")) + return "源库日志量超过当前连接器处理上限,采集已停止且未跳过数据。请保留日志与检查点,评估归档窗口或大事务后再处理,不要反复恢复。"; + if(error.contains("归档区间存在缺口")||error.contains("起始归档已清理")||error.contains("所需WAL已不可用")) + return "恢复所需的源库日志缺失,无法安全继续采集。请由数据库管理员核对归档或WAL保留情况,确认恢复方案后再操作。"; + if(error.contains("复制槽已被其他消费者推进")||error.contains("专用且未被占用")) + return "金仓复制槽被占用或已被其他消费者推进。请核对专用复制槽及原任务状态,不能让多个任务共用同一槽。"; + if(error.contains("结构已变化")||error.contains("结构发生变化")||error.contains("结构或主键已变化")||error.contains("日志缺少完整行镜像")) + return "源表结构、主键或日志行镜像不符合任务配置,采集已停止。请核对源表与目标表结构及完整行日志设置。"; + if(error.contains("数据库身份变化")||error.contains("实例或时间线变化")) + return "源数据库身份或复制时间线已变化,原检查点不能直接恢复。请核对是否切换或重建了源数据库。"; + if(error.contains("原生CDC日志接口失败")) + return "数据库日志读取失败。请检查采集节点到源库的连接、日志挖掘或复制权限,以及当前数据库版本的日志接口;详细SQL错误码见采集节点日志。"; + if ((lower.contains("oracle-cdc") || lower.contains("sqlserver-cdc")) && + (lower.contains("not found") || lower.contains("cannot find") || lower.contains("could not find"))) { + return "采集节点缺少对应CDC插件或插件依赖。请安装与SeaTunnel版本一致的Oracle/SQL Server CDC插件及JDBC驱动后重试。"; + } + if(lower.contains("ora-01031") || lower.contains("ora-00942")) + return "Oracle CDC账号权限不足或系统视图不可见。请核对源表读取、LogMiner、日志视图权限;CDB模式还需公共账号及容器访问权限。"; + if(lower.contains("ora-01291") || lower.contains("ora-00308")) + return "Oracle增量日志不完整或归档日志不可读取,无法继续当前检查点。请由DBA核对归档日志保留和可访问性后决定恢复方案。"; + if(lower.contains("cdc") && (lower.contains("not enabled") || lower.contains("is not enabled"))) + return "源数据库或源表未启用CDC。SQL Server需要同时启用库级、表级CDC,并确保捕获作业持续运行。"; + if(lower.contains("login failed for user") || lower.contains("ora-01017")) + return "源库账号认证失败,请检查数据源管理中的托管账号和密码。"; + boolean doris = lower.contains("doris") || lower.contains("stream load"); + boolean network = lower.contains("connection refused") || lower.contains("connect timed out") + || lower.contains("connecttimeoutexception") || lower.contains("no route to host") + || lower.contains("unknownhostexception"); + if (doris && network && (lower.contains("127.0.0.1") || lower.contains("localhost") + || lower.contains("[::1]"))) { + return "Doris 写入失败:连接被指向本机回环地址,采集节点无法访问该服务。" + + "请检查 Doris FE 返回的 BE 地址及 HTTP 端口,改为采集节点可访问的地址并放通网络后再恢复任务。"; + } + if (doris && network) { + return "Doris 写入失败:采集节点无法连接 Doris 服务。请检查 FE HTTP 地址、重定向后的 BE 地址及端口是否可达。"; + } + if (lower.contains("binlog") && (lower.contains("purged") || lower.contains("could not find first log") + || lower.contains("no longer available"))) { + return "MySQL 增量日志已被清理,原检查点无法继续读取。请核对 Binlog 保留时间,并制定重新全量同步方案。"; + } + if (lower.contains("access denied") || lower.contains("authentication failed")) { + return (doris ? "Doris 写入认证失败" : "采集连接认证失败") + + ":请检查对应连接的账号、密码及访问授权。"; + } + if (lower.contains("permission denied") || lower.contains("command denied") + || lower.contains("insufficient privilege")) { + return "采集账号权限不足:请检查源表读取、源库日志采集及目标库写入权限。"; + } + if (doris && (lower.contains("too many filtered rows") || lower.contains("data_quality_error"))) { + return "Doris 拒绝写入部分数据:字段类型或数据内容不符合目标表要求。请检查字段映射、长度、空值约束及 Doris 导入错误记录。"; + } + if (network) { + return "采集连接失败:服务拒绝连接或网络不可达。请从采集节点检查源库及目标库的地址、端口和服务状态。"; + } + if (doris && lower.contains("stream load")) { + return "Doris 数据写入失败,导致同步中断。当前错误未能明确具体原因,请按外部作业编号检查 Doris 导入记录和 SeaTunnel 日志。"; + } + if (lower.contains("checkpoint")) { + return "采集检查点失败,任务未能保存本轮同步进度。当前错误未包含可识别的底层原因,请按外部作业编号查看 SeaTunnel 日志中的源端读取或目标端写入异常。"; + } + return "采集任务执行异常,当前错误未能明确具体原因。请按外部作业编号检查 SeaTunnel 日志后处理;不要直接重复启动任务。"; } private static JobResult requestFailure(String requestedJobId, String jobName, String phase, @@ -451,6 +580,13 @@ public class SeaTunnelAdapter { // Classify only known submission-stage catalog failures; never expose the body or SQL. String body = exception.getResponseBodyAsString(); String normalizedBody = body.toLowerCase(Locale.ROOT); + if ("SUBMIT".equals(phase) && normalizedBody.contains("cannot find") && + normalizedBody.contains("plugin jar for pluginidentifier")) + return new JobResult(requestedJobId, jobName, "PLUGIN_LOAD_REJECTED", NormalizedExternalStatus.FAILED, + "SEATUNNEL_PLUGIN_LOAD_FAILED", "采集插件加载失败,任务未启动。请检查插件 JAR 与名称映射,修复采集引擎后重新创建任务"); + if("SUBMIT".equals(phase) && body.contains("AIXUN_RESTORE_CHECKPOINT_")) + return new JobResult(requestedJobId,jobName,"RECOVERY_REJECTED",NormalizedExternalStatus.FAILED, + "CDC_CHECKPOINT_UNAVAILABLE","原作业检查点缺失、损坏或早于已确认进度;已拒绝恢复,不会重新全量采集"); if ("SUBMIT".equals(phase) && (body.contains("Failed creating table") || body.contains("Table not exists") || body.contains("Table does not exist") || (normalizedBody.contains("database ") && normalizedBody.contains(" does not exist")) || @@ -564,7 +700,7 @@ public class SeaTunnelAdapter { case "RUNNING" -> NormalizedExternalStatus.RUNNING; case "FINISHED" -> NormalizedExternalStatus.SUCCEEDED; case "FAILED" -> NormalizedExternalStatus.FAILED; - case "CANCELED" -> NormalizedExternalStatus.CANCELED; + case "CANCELED", "SAVEPOINT_DONE" -> NormalizedExternalStatus.CANCELED; default -> NormalizedExternalStatus.UNKNOWN; }; } diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistryTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistryTest.java new file mode 100644 index 0000000..48be4ce --- /dev/null +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/CdcRelayRegistryTest.java @@ -0,0 +1,42 @@ +package cn.aixunkeji.datagov.integration.batchingestion; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.*; +import org.junit.jupiter.api.Test; +import java.sql.*; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; + +class CdcRelayRegistryTest { + private Command command(long org,String table){ + return new Command(1,org,10,1,new Spec("relay",1,0,"db",table,2,3,"ods",8030,"initial",30,12,"APP",null,"dm"),null,"a".repeat(64)); + } + private CdcRelayRegistry registry(){ + var p=new CdcRelayProperties();var c=new CdcRelayProperties.Channel();c.setEnabled(true);c.setName("DMHS"); + c.setSourceId(1);c.setOrgId(2);c.setSchema("APP");c.setTable("ORDERS");c.setBootstrapServers("kafka.local:9092");c.setTopic("dm.orders"); + p.getChannels().put("dm",c);return new CdcRelayRegistry(p,null); + } + @Test void relayIsBoundToOrganizationSourceAndExactTable(){ + var r=registry();assertThat(r.options(2,1)).hasSize(1);assertThat(r.options(3,1)).isEmpty();assertThat(r.options(2,99)).isEmpty(); + assertThatThrownBy(()->r.require(command(3,"ORDERS"))).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(()->r.require(command(2,"OTHER"))).isInstanceOf(IllegalArgumentException.class); + } + @Test void producesChangeLogSourceWithStableGroupAndDeleteSink() throws Exception { + var md=mock(ResultSetMetaData.class);when(md.getColumnCount()).thenReturn(1);when(md.getColumnName(1)).thenReturn("ID");when(md.getColumnType(1)).thenReturn(Types.INTEGER); + var common=new MysqlCdcJobFactory.Config("dm.local",5236,"cdc","ORDERS","user","secret",12,"initial","doris.local",8030,9030,"ods","ods","writer","secret","cdc_10_1",30); + var job=registry().job(command(2,"ORDERS"),common,md);var source=job.path("source").get(0); + assertThat(source.path("plugin_name").asText()).isEqualTo("Kafka"); + assertThat(source.path("format").asText()).isEqualTo("ogg_json"); + assertThat(source.path("schema").path("fields").path("ID").asText()).isEqualTo("INT"); + assertThat(source.path("consumer.group").asText()).isEqualTo("aixun_cdc_2_10"); + assertThat(source.path("start_mode").asText()).isEqualTo("earliest"); + assertThat(source.path("kafka.config").path("enable.auto.commit").asText()).isEqualTo("false"); + assertThat(job.path("sink").get(0).path("sink.enable-delete").asBoolean()).isTrue(); + assertThatThrownBy(()->CdcRelayRegistry.type(Types.OTHER,0,0)).isInstanceOf(IllegalArgumentException.class); + } + @Test void recoveryEvidenceCannotTargetAnotherJobOrUnconfirmedState(){ + var c=command(2,"ORDERS");String id=cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.jobId(2,10,1); + var valid=new Command(c.actorId(),c.orgId(),c.taskId(),c.attempt(),c.spec(),null,c.fingerprint(),new RecoveryEvidence(id,"CANCELED","458")); + assertThat(RealtimeCollectionDubboService.validRecovery(valid,id)).isTrue(); + assertThat(RealtimeCollectionDubboService.validRecovery(valid,"other")).isFalse(); + assertThat(RealtimeCollectionDubboService.validRecovery(c,id)).isFalse(); + } +} diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactoryTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactoryTest.java new file mode 100644 index 0000000..9ae512e --- /dev/null +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/MysqlCdcJobFactoryTest.java @@ -0,0 +1,38 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class MysqlCdcJobFactoryTest { + private static MysqlCdcJobFactory.Config config(String mode, int httpPort) { + return new MysqlCdcJobFactory.Config("mysql.local", 3306, "sales", "orders", "reader", "source-secret", + 501, mode, "doris.local", httpPort, 9030, "warehouse", "orders", "writer", "sink-secret", + "aixun_cdc_42", 30); + } + + @Test void generatesStreamingJobWithExplicitHttpEndpointAndCheckpoint() { + var job = MysqlCdcJobFactory.create(config("initial", 8030)); + assertThat(job.path("env").path("job.mode").asText()).isEqualTo("STREAMING"); + assertThat(job.path("env").path("checkpoint.interval").asLong()).isEqualTo(30_000); + assertThat(job.path("source").get(0).path("table-names").get(0).asText()).isEqualTo("sales.orders"); + assertThat(job.path("source").get(0).path("startup.mode").asText()).isEqualTo("initial"); + assertThat(job.path("sink").get(0).path("fenodes").asText()).isEqualTo("doris.local:8030"); + assertThat(job.path("sink").get(0).path("query-port").asInt()).isEqualTo(9030); + } + + @Test void rejectsMissingHttpEndpointAndUnsupportedStartupMode() { + assertThatThrownBy(() -> MysqlCdcJobFactory.create(config("latest", 0))) + .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> MysqlCdcJobFactory.create(config(null, 8030))) + .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> MysqlCdcJobFactory.create(config("earliest", 8030))) + .isInstanceOf(IllegalArgumentException.class); + } + + @Test void configDoesNotExposeCredentialsInDiagnosticText() { + assertThat(config("initial", 8030).toString()) + .doesNotContain("source-secret", "sink-secret"); + } +} diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSourceTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSourceTest.java new file mode 100644 index 0000000..c423593 --- /dev/null +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/NativeCdcSourceTest.java @@ -0,0 +1,141 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import cn.aixunkeji.datagov.integration.api.*; +import cn.aixunkeji.datagov.integration.api.RealtimeCollectionService.Spec; +import org.junit.jupiter.api.Test; +import java.sql.*; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; + +class NativeCdcSourceTest { + private Spec pdbSpec() { + return new Spec("task",1,0,"service","ORDERS",2,3,"orders",8030,"initial",30,123,"SALES","ORCLCDB",null,"SALESPDB","root.service"); + } + @Test void pdbSeparatesSnapshotCatalogAndRootMiningConnection() { + var s=NativeCdcSource.job(common(),source("ORACLE"),pdbSpec()).path("source").get(0); + assertThat(s.path("url").asText()).endsWith("/service"); + assertThat(s.path("database-names").get(0).asText()).isEqualTo("SALESPDB"); + assertThat(s.path("table-names").get(0).asText()).isEqualTo("SALESPDB.SALES.ORDERS"); + assertThat(s.path("debezium").path("database.dbname").asText()).isEqualTo("ORCLCDB"); + assertThat(s.path("debezium").path("database.pdb.name").asText()).isEqualTo("SALESPDB"); + assertThat(s.path("debezium").path("database.url").asText()).isEqualTo("jdbc:oracle:thin:@//source.local:1521/root.service"); + } + @Test void pdbConfigCannotLeakToOtherEnginesOrChangeLegacyFingerprints() { + assertThatThrownBy(()->NativeCdcSource.validate(source("MYSQL"),pdbSpec())).hasMessageContaining("只能用于Oracle"); + var p=spec("SALES","ORCL"); + assertThat(p.fingerprintText()).doesNotContain("oraclePdb", "oracleCdbService", "cdcChannel"); + assertThat(pdbSpec().fingerprintText()).contains("oraclePdb=SALESPDB", "oracleCdbService=root.service"); + } + @Test void wrongContainerFailsBeforeSourceTableRead()throws Exception { + var db=mock(Connection.class);var st=mock(Statement.class);var rs=mock(ResultSet.class); + when(db.createStatement()).thenReturn(st);when(st.executeQuery(anyString())).thenReturn(rs); + when(rs.next()).thenReturn(true);when(rs.getString(1)).thenReturn("CDB$ROOT"); + assertThatThrownBy(()->NativeCdcSource.verifyContainer(db,"SALESPDB")).hasMessageContaining("容器不匹配"); + verify(st,never()).execute(anyString()); + } + @Test void rootPrecheckRequiresCommonAccountAndBothPrivilegesBeforeSwitching()throws Exception { + var db=mock(Connection.class);var st=mock(Statement.class);when(db.createStatement()).thenReturn(st); + var container=mock(ResultSet.class);when(container.next()).thenReturn(true); + when(container.getString(1)).thenReturn("CDB$ROOT","SALESPDB"); + when(st.executeQuery("SELECT SYS_CONTEXT('USERENV','CON_NAME') FROM DUAL")).thenReturn(container); + var database=mock(ResultSet.class);when(database.next()).thenReturn(true); + when(database.getString(1)).thenReturn("ORCLCDB");when(database.getString(2)).thenReturn("ARCHIVELOG");when(database.getString(3)).thenReturn("YES"); + when(st.executeQuery("SELECT NAME, LOG_MODE, SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE")).thenReturn(database); + var account=mock(ResultSet.class);when(account.next()).thenReturn(true);when(account.getString(1)).thenReturn("YES"); + when(st.executeQuery("SELECT COMMON FROM USER_USERS")).thenReturn(account); + var grants=mock(ResultSet.class);when(grants.next()).thenReturn(true,true,false); + when(grants.getString(1)).thenReturn("LOGMINING","SET CONTAINER"); + when(st.executeQuery("SELECT PRIVILEGE FROM SESSION_PRIVS WHERE PRIVILEGE IN ('LOGMINING','SET CONTAINER')")).thenReturn(grants); + NativeCdcSource.oracleRootPrerequisites(db,pdbSpec()); + verify(st).execute("ALTER SESSION SET CONTAINER = \"SALESPDB\""); + verify(st,never()).execute(startsWith("GRANT")); + } + @Test void wrongRootServiceNeverSwitchesContainer()throws Exception { + var db=mock(Connection.class);var st=mock(Statement.class);var rs=mock(ResultSet.class); + when(db.createStatement()).thenReturn(st);when(st.executeQuery(anyString())).thenReturn(rs); + when(rs.next()).thenReturn(true);when(rs.getString(1)).thenReturn("SALESPDB"); + assertThatThrownBy(()->NativeCdcSource.oracleRootPrerequisites(db,pdbSpec())).hasMessageContaining("CDB$ROOT"); + verify(st,never()).execute(anyString()); + } + @Test void invalidPdbAndServiceAreRejectedBeforeSqlGeneration() { + var p=new Spec("task",1,0,"service","ORDERS",2,3,"orders",8030,"initial",30,123,"SALES","ORCLCDB",null,"PDB\";DROP","svc"); + assertThatThrownBy(()->NativeCdcSource.validate(source("ORACLE"),p)).isInstanceOf(IllegalArgumentException.class); + final Spec missing=new Spec("task",1,0,"service","ORDERS",2,3,"orders",8030,"initial",30,123,"SALES","ORCLCDB",null,"SALESPDB",null); + assertThatThrownBy(()->NativeCdcSource.validate(source("ORACLE"),missing)).hasMessageContaining("根容器服务名"); + } + private DataSourceView source(String type) { + return new DataSourceView(1L,"source",type,"source.local",1521,"service","cdc_user","file:///managed", + NormalizedExternalStatus.SUCCEEDED,"owner"); + } + private Spec spec(String schema,String database) { + return new Spec("task",1,0,"service","ORDERS",2,3,"orders",8030,"initial",30,123,schema,database); + } + private MysqlCdcJobFactory.Config common() { + return new MysqlCdcJobFactory.Config("source.local",1521,"service","ORDERS","cdc_user","source-secret", + 123,"initial","doris.local",8030,9030,"ods","orders","writer","target-secret","cdc_1_1",30); + } + @Test void mysqlJobAndLegacyFingerprintRemainUnchanged() { + var p=spec(null,null); + assertThat(NativeCdcSource.job(common(),source("MYSQL"),p)).isEqualTo(MysqlCdcJobFactory.create(common())); + assertThat(p.fingerprintText()).isEqualTo("Spec[name=task, sourceId=1, sourceVersion=0, sourceDatabase=service, sourceTable=ORDERS, targetResourceId=2, targetSpaceId=3, targetTable=orders, httpPort=8030, startupMode=initial, checkpointSeconds=30, serverId=123]"); + } + @Test void oracleSeparatesServiceNameFromDatabaseAndKeepsDeleteSink() { + var job=NativeCdcSource.job(common(),source("ORACLE"),spec("SALES","ORCL")); + var s=job.path("source").get(0); + assertThat(s.path("plugin_name").asText()).isEqualTo("Oracle-CDC"); + assertThat(s.path("table-names").get(0).asText()).isEqualTo("ORCL.SALES.ORDERS"); + assertThat(s.path("url").asText()).endsWith("/service"); + assertThat(s.path("debezium").path("database.dbname").asText()).isEqualTo("ORCL"); + assertThat(s.has("server-id")).isFalse(); + assertThat(job.path("sink").get(0).path("sink.enable-delete").asBoolean()).isTrue(); + } + @Test void sqlServerUsesSchemaAndExplicitTransportForBothReaders() { + var s=NativeCdcSource.job(common(),source("SQLSERVER"),spec("dbo",null)).path("source").get(0); + assertThat(s.path("plugin_name").asText()).isEqualTo("SqlServer-CDC"); + assertThat(s.path("table-names").get(0).asText()).isEqualTo("service.dbo.ORDERS"); + assertThat(s.path("url").asText()).contains("encrypt=false","trustServerCertificate=false"); + assertThat(s.path("debezium").path("database.encrypt").asText()).isEqualTo("false"); + } + @Test void vendorDriversCannotMasqueradeAsNativeCdcAndIdentifiersCannotInjectSql() { + for(String type:new String[]{"DAMENG","KINGBASE"}) + assertThatThrownBy(()->NativeCdcSource.validate(source(type),spec("PUBLIC';DROP",null))) + .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(()->NativeCdcSource.validate(source("SQLSERVER"),spec("dbo'];DROP",null))) + .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(()->NativeCdcSource.validate(source("ORACLE"),spec("SALES",null))) + .isInstanceOf(RuntimeException.class); + } + @Test void nativeVendorJobsUseOwnPluginsAndStableIsolatedSlots() { + assertThat(NativeCdcSource.job(common(),source("DAMENG"),spec("PUBLIC",null)).path("source").get(0).path("startup.mode").asText()).isEqualTo("initial"); + var p=new Spec("task",1,0,"service","ORDERS",2,3,"orders",8030,"latest",30,123,"PUBLIC",null); + for(String type:new String[]{"DAMENG","KINGBASE"}) { + var job=NativeCdcSource.job(common(),source(type),p); + var s=job.path("source").get(0); + assertThat(s.path("plugin_name").asText()).isEqualTo(type.equals("DAMENG")?"Dameng-Native-CDC":"Kingbase-Native-CDC"); + assertThat(s.path("source_schema").asText()).isEqualTo("PUBLIC"); + assertThat(s.path("startup.mode").asText()).isEqualTo("latest"); + assertThat(s.has("server-id")).isFalse(); + assertThat(job.path("sink").get(0).path("sink.enable-delete").asBoolean()).isTrue(); + } + assertThat(VendorCdcPrerequisites.slot(p)).matches("aixun_[0-9a-f]{24}"); + var other=new Spec("task",1,0,"service","OTHER",2,3,"orders",8030,"latest",30,123,"PUBLIC",null); + assertThat(VendorCdcPrerequisites.slot(p)).isNotEqualTo(VendorCdcPrerequisites.slot(other)); + } + @Test void missingDamengLoggingHasSpecificReadOnlyFailure()throws Exception { + var db=mock(Connection.class);var st=mock(Statement.class);var rs=mock(ResultSet.class); + when(db.createStatement()).thenReturn(st);when(st.executeQuery(anyString())).thenReturn(rs); + when(rs.next()).thenReturn(false); + assertThatThrownBy(()->VendorCdcPrerequisites.check(db,"DAMENG",spec("PUBLIC",null))) + .hasMessageContaining("达梦日志配置不满足要求"); + verify(st,never()).execute(anyString()); + } + @Test void missingSqlServerDatabaseCdcIsRejectedBeforeReadingTables() throws Exception { + var db=mock(Connection.class);var st=mock(Statement.class);var rs=mock(ResultSet.class); + when(db.createStatement()).thenReturn(st);when(st.executeQuery(anyString())).thenReturn(rs); + when(rs.next()).thenReturn(true);when(rs.getBoolean(1)).thenReturn(false); + assertThatThrownBy(()->NativeCdcSource.prerequisites(db,source("SQLSERVER"),spec("dbo",null))) + .hasMessageContaining("源数据库未启用CDC"); + verify(db,never()).prepareStatement(anyString()); + verify(st,never()).execute(anyString()); + } +} diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCheckFailureTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCheckFailureTest.java new file mode 100644 index 0000000..186267f --- /dev/null +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/batchingestion/RealtimeCheckFailureTest.java @@ -0,0 +1,42 @@ +package cn.aixunkeji.datagov.integration.batchingestion; + +import org.junit.jupiter.api.Test; +import java.sql.SQLException; +import java.sql.SQLTimeoutException; +import static org.assertj.core.api.Assertions.assertThat; + +class RealtimeCheckFailureTest { + @Test void unavailableJobRetainsReasonInsteadOfSuggestingStartupDelay() { + var info = new cn.aixunkeji.datagov.integration.m2.SeaTunnelAdapter.JobInfoResult("123", null, "NOT_FOUND", + cn.aixunkeji.datagov.integration.api.NormalizedExternalStatus.UNKNOWN, null, null, null, + "SEATUNNEL_JOB_NOT_FOUND", "外部作业记录不可查询,无法确认是否已执行"); + assertThat(RealtimeCollectionDubboService.statusQueryFailure(info,"123")).contains("记录不可查询"); + assertThat(RealtimeCollectionDubboService.statusQueryFailure(info,"456")).contains("身份与当前任务不一致"); + } + @Test void missingTargetTableIsNotReportedAsSourcePermissionFailure() { + assertThat(RealtimeCollectionDubboService.checkFailure("读取Doris目标表定义",new SQLException("private SQL", "42S02",1146))) + .contains("读取Doris目标表定义失败", "表不存在", "code=1146").doesNotContain("private SQL"); + } + @Test void distinguishesAuthenticationPermissionAndNetworkWithoutLeakingDriverMessage() { + assertThat(RealtimeCollectionDubboService.checkFailure("连接MySQL源库",new SQLException("password=secret", "28000",1045))) + .contains("账号认证失败").doesNotContain("secret"); + assertThat(RealtimeCollectionDubboService.checkFailure("读取MySQL Binlog配置",new SQLException("private", "42000",1227))) + .contains("账号缺少此步骤需要的权限"); + assertThat(RealtimeCollectionDubboService.checkFailure("连接Doris目标库",new SQLException("private", "08S01",0))) + .contains("连接或通信失败"); + assertThat(RealtimeCollectionDubboService.checkFailure("连接MySQL源库",new SQLTimeoutException("private"))) + .contains("访问超时"); + } + @Test void unknownFailureDoesNotLeakSecrets() { + assertThat(RealtimeCollectionDubboService.checkFailure("解析连接配置",new RuntimeException("secret"))) + .contains("解析连接配置失败").doesNotContain("secret"); + } + @Test void recognizesDorisGenericCodeWithoutExposingMessage() { + assertThat(RealtimeCollectionDubboService.checkFailure("读取Doris目标表定义",new SQLException("errCode = 2, detailMessage = Unknown table 'private_table'", "HY000",1105))) + .contains("表不存在").doesNotContain("private_table"); + assertThat(RealtimeCollectionDubboService.checkFailure("读取Doris目标表定义",new SQLException("Table private_table does not exist", "HY000",1105))) + .contains("表不存在").doesNotContain("private_table"); + assertThat(RealtimeCollectionDubboService.checkFailure("读取Doris目标表定义",new SQLException("Access denied private_user", "HY000",1105))) + .contains("账号缺少").doesNotContain("private_user"); + } +} diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/ExternalStatusContractTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/ExternalStatusContractTest.java index 67f648b..1816316 100644 --- a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/ExternalStatusContractTest.java +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/ExternalStatusContractTest.java @@ -41,6 +41,8 @@ class ExternalStatusContractTest { assertThat(SeaTunnelAdapter.normalize("FINISHED")).isEqualTo(NormalizedExternalStatus.SUCCEEDED); assertThat(SeaTunnelAdapter.normalize("FAILED")).isEqualTo(NormalizedExternalStatus.FAILED); assertThat(SeaTunnelAdapter.normalize("CANCELED")).isEqualTo(NormalizedExternalStatus.CANCELED); + assertThat(SeaTunnelAdapter.normalize("SAVEPOINT_DONE")).isEqualTo(NormalizedExternalStatus.CANCELED); + assertThat(SeaTunnelAdapter.normalize("DOING_SAVEPOINT")).isEqualTo(NormalizedExternalStatus.UNKNOWN); assertThat(SeaTunnelAdapter.normalize("NEW_UPSTREAM_STATE")).isEqualTo(NormalizedExternalStatus.UNKNOWN); } diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelFailureExplanationTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelFailureExplanationTest.java new file mode 100644 index 0000000..0080e2c --- /dev/null +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelFailureExplanationTest.java @@ -0,0 +1,49 @@ +package cn.aixunkeji.datagov.integration.m2; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class SeaTunnelFailureExplanationTest { + @org.junit.jupiter.api.Test void vendorRootCauseIsNotHiddenByCheckpointWrapper() { + assertTrue(SeaTunnelAdapter.explainJobFailure("CheckpointCoordinator error: 起始归档已清理 password=secret").contains("源库日志缺失")); + assertTrue(SeaTunnelAdapter.explainJobFailure("CheckpointCoordinator error: 复制槽已被其他消费者推进").contains("复制槽")); + assertFalse(SeaTunnelAdapter.explainJobFailure("CheckpointCoordinator error: 原生CDC日志接口失败 password=secret").contains("secret")); + } + @Test + void readsRootCauseBeyondThePreviouslyTruncatedStack() { + String error = "CheckpointException: CheckpointCoordinator inside have error. " + + "at checkpoint coordinator\n".repeat(100) + + "Caused by: DorisConnectorException: stream load error\n" + + "Caused by: Connect to 127.0.0.1:8040 failed: Connection refused"; + String summary = SeaTunnelAdapter.explainJobFailure(error); + assertTrue(summary.contains("本机回环地址")); + assertTrue(summary.contains("BE 地址")); + assertFalse(summary.contains("CheckpointException")); + } + + @Test + void wrapperAloneDoesNotInventRootCause() { + String summary = SeaTunnelAdapter.explainJobFailure("CheckpointCoordinator inside have error"); + assertTrue(summary.contains("未包含可识别的底层原因")); + assertFalse(summary.contains("Doris")); + } + + @Test + void neverExposesUntrustedErrorOrCredentials() { + String summary = SeaTunnelAdapter.explainJobFailure("Unexpected SQL password=secret-value jdbc:mysql://private"); + assertFalse(summary.contains("secret-value")); + assertFalse(summary.contains("jdbc:")); + assertTrue(summary.contains("未能明确具体原因")); + assertNull(SeaTunnelAdapter.explainJobFailure(null)); + assertNull(SeaTunnelAdapter.explainJobFailure(" ")); + } + + @Test + void distinguishesKnownFailures() { + assertTrue(SeaTunnelAdapter.explainJobFailure("Doris stream load Connect timed out").contains("BE 地址")); + assertTrue(SeaTunnelAdapter.explainJobFailure("binlog files have been purged").contains("日志已被清理")); + assertTrue(SeaTunnelAdapter.explainJobFailure("Doris access denied").contains("认证失败")); + assertTrue(SeaTunnelAdapter.explainJobFailure("Doris too many filtered rows").contains("字段类型")); + } +} diff --git a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelM3ContractTest.java b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelM3ContractTest.java index 1aa8f08..ae9d94b 100644 --- a/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelM3ContractTest.java +++ b/aixun-modules/aixun-integration/src/test/java/cn/aixunkeji/datagov/integration/m2/SeaTunnelM3ContractTest.java @@ -27,6 +27,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; class SeaTunnelM3ContractTest { + @Test void cleanupRequiresExplicitEmptyQueues() { + var mapper=JsonMapper.builder().build(); + var running=mapper.createArrayNode(); + var pending=mapper.createObjectNode(); + assertThat(SeaTunnelAdapter.idleQueues(running,pending)).isFalse(); + pending.putArray("pendingJobs");pending.putObject("queueSummary").put("size",0); + assertThat(SeaTunnelAdapter.idleQueues(running,pending)).isTrue(); + running.addObject().put("jobId","123"); + assertThat(SeaTunnelAdapter.idleQueues(running,pending)).isFalse(); + assertThat(SeaTunnelAdapter.idleQueues(null,pending)).isFalse(); + running.removeAll();pending.withObject("queueSummary").put("size",1); + assertThat(SeaTunnelAdapter.idleQueues(running,pending)).isFalse(); + } private static AnnotationConfigApplicationContext jsonContext; @@ -671,6 +684,53 @@ class SeaTunnelM3ContractTest { return new SeaTunnelAdapter(properties, secrets); } + @Test void streamingRestoreAfterRestartUsesSameIdAndReal213FlagWithoutDuplicatePost() throws Exception { + var server=HttpServer.create(new InetSocketAddress("127.0.0.1",0),0); + var posts=new AtomicInteger();var request=new AtomicReference>(); + String key="realtime:restart:1",name="aixun_cdc_restart_1"; + String id=Long.toString(cn.aixunkeji.datagov.integration.api.DataCollectionIntegrationService.stableJobId(key)); + server.createContext("/",ex->{ + if("POST".equals(ex.getRequestMethod())){request.set(query(ex.getRequestURI().getRawQuery()));posts.incrementAndGet();ex.getRequestBody().readAllBytes();} + json(ex,200,posts.get()==0?"{\"jobId\":\""+id+"\"}":"{\"jobId\":\""+id+"\",\"jobName\":\""+name+"\",\"jobStatus\":\"RUNNING\"}"); + });server.start(); + try{ + var adapter=localAdapter(server);var missing=adapter.queryJob(id); + assertThat(adapter.recoverableStreamingIdentity(missing,id,name)).isTrue(); + var job=JsonUtils.getObjectMapper().createObjectNode();job.putObject("env").put("job.mode","STREAMING").put("aixun.restore.checkpoint",458); + assertThat(adapter.submitStreaming(key,"a".repeat(64),name,job,id).status()).isEqualTo(NormalizedExternalStatus.RUNNING); + adapter.submitStreaming(key,"a".repeat(64),name,job,id); + assertThat(posts.get()).isEqualTo(1); + assertThat(request.get()).containsEntry("jobId",id).containsEntry("isStartWithSavePoint","true") + .doesNotContainKeys("restoreMode","restoreSourceJobId"); + assertThat(adapter.recoverableStreamingIdentity(adapter.queryJob(id),id,name)).isFalse(); + assertThat(adapter.submitStreaming(key,"a".repeat(64),name,job,"99").errorCode()).isEqualTo("CDC_RECOVERY_EVIDENCE_INVALID"); + assertThat(posts.get()).isEqualTo(1); + }finally{server.stop(0);} + } + + @Test void streamingReturnsRunningWithoutWaitingForTerminalAndDoesNotStopWrongOwner() throws Exception { + var server=HttpServer.create(new InetSocketAddress("127.0.0.1",0),0); + var posts=new AtomicInteger(); + String key="cdc:test:1"; + String id=Long.toString(cn.aixunkeji.datagov.integration.api.DataCollectionIntegrationService.stableJobId(key)); + server.createContext("/", exchange->{ + if(exchange.getRequestMethod().equals("POST")) posts.incrementAndGet(); + byte[] body=("{\"jobId\":\""+id+"\",\"jobName\":\"aixun_cdc_test\",\"jobStatus\":\"RUNNING\"}").getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().set("Content-Type","application/json"); + exchange.sendResponseHeaders(200,body.length);exchange.getResponseBody().write(body);exchange.close(); + });server.start(); + try { + var adapter=localAdapter(server); + var job=JsonUtils.getObjectMapper().createObjectNode();job.putObject("env").put("job.mode","STREAMING"); + long start=System.nanoTime(); + var result=adapter.submitStreaming(key,"a".repeat(64),"aixun_cdc_test",job,null); + assertThat(result.status()).isEqualTo(NormalizedExternalStatus.RUNNING); + assertThat(java.time.Duration.ofNanos(System.nanoTime()-start).toSeconds()).isLessThan(5); + adapter.stopStreaming(id,"another_owner"); + assertThat(posts.get()).isZero(); + } finally {server.stop(0);} + } + private static void handle(HttpExchange exchange, AtomicInteger posts, AtomicReference jobId, AtomicReference jobName, AtomicReference submittedBody) throws IOException { diff --git a/aixun-ui/src/api/datagov/realtime-ingestion/index.ts b/aixun-ui/src/api/datagov/realtime-ingestion/index.ts new file mode 100644 index 0000000..e457cc3 --- /dev/null +++ b/aixun-ui/src/api/datagov/realtime-ingestion/index.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request'; +import type { SourcePage } from '@/api/datagov/unified-ingestion/types'; +export const listRealtimeSources = (): AxiosPromise => request({url:'/api/dataops/v1/realtime-ingestions/source-options',method:'get'}); +import type { AxiosPromise } from '@/utils/api-types'; +export interface RealtimeSpec { + name: string; sourceId: string | number; sourceVersion: number; sourceDatabase: string; sourceTable: string; + targetResourceId: string | number; targetSpaceId: string | number; targetTable: string; httpPort: number; + startupMode: 'initial' | 'latest'; checkpointSeconds: number; serverId: number; + sourceSchema?: string; oracleDatabase?: string; cdcChannel?: string; oraclePdb?: string; oracleCdbService?: string; +} +export interface CdcRelayOption { id: string; name: string; schema: string; table: string; format: string; } +export interface RealtimeTask { + id: string; spec: RealtimeSpec; status: string; version: number; attempt: number; externalId?: string; + checkpointId?: string; summary?: string; readRows?: number; writeRows?: number; observedAt?: string; + history: Record[]; +} +const base = '/api/dataops/v1/realtime-ingestions'; +export const listCdcRelays = (sourceId: string | number): AxiosPromise => request({url:`${base}/relay-options`,params:{sourceId}}); +export const listRealtime = (pageNum: number, pageSize: number): AxiosPromise<{rows: RealtimeTask[]; total: number}> => + request({ url: base, params: { pageNum, pageSize } }); +export const getRealtime = (id: string): AxiosPromise => request({ url: `${base}/${id}` }); +export const createRealtime = (data: RealtimeSpec, key: string): AxiosPromise => + request({ url: base, method: 'post', data, headers: { 'Idempotency-Key': key, repeatSubmit: false } }); +export const updateRealtime = (id: string, spec: RealtimeSpec, version: number): AxiosPromise => + request({ url: `${base}/${id}`, method: 'put', data: {spec, version}, headers: {repeatSubmit:false} }); +export const actRealtime = (id: string, action: string, version: number, key: string): AxiosPromise => + request({ url: `${base}/${id}/${action}`, method: 'post', data: { version, key }, timeout: 150000, + headers: { repeatSubmit: false }, suppressErrorToast: true }); diff --git a/aixun-ui/src/layout/components/Sidebar/menuIcons.ts b/aixun-ui/src/layout/components/Sidebar/menuIcons.ts index b92694d..941ada1 100644 --- a/aixun-ui/src/layout/components/Sidebar/menuIcons.ts +++ b/aixun-ui/src/layout/components/Sidebar/menuIcons.ts @@ -7,7 +7,7 @@ const primaryIcons: Record = { const routeIcons: Record = { '/index': 'home', '/visual-workspace': 'dashboard', '/work-overview': 'chart', '/my-work': 'briefcase', - '/data-sources': 'database', '/unified-ingestion': 'download', '/file-ingestion': 'upload', + '/data-sources': 'database', '/unified-ingestion': 'download', '/realtime-ingestion': 'link', '/file-ingestion': 'upload', '/storage-resources': 'database', '/lakehouse-layers': 'layers', '/table-files': 'grid', '/enterprise-architecture': 'network', '/subject-layer': 'layers', '/model-repository': 'folder', '/model-design': 'edit', '/model-engineering': 'tools', '/architecture-governance': 'check', '/model-algorithm': 'book', diff --git a/aixun-ui/src/views/datagov/dataops/realtime-ingestion/index.vue b/aixun-ui/src/views/datagov/dataops/realtime-ingestion/index.vue new file mode 100644 index 0000000..03a732a --- /dev/null +++ b/aixun-ui/src/views/datagov/dataops/realtime-ingestion/index.vue @@ -0,0 +1,131 @@ + + diff --git a/db/dameng/realtime.sql b/db/dameng/realtime.sql new file mode 100644 index 0000000..a985d15 --- /dev/null +++ b/db/dameng/realtime.sql @@ -0,0 +1,21 @@ +-- @statement realtime_task +CREATE TABLE ing_realtime_task ( + id BIGINT PRIMARY KEY, owner_id BIGINT NOT NULL, org_id BIGINT NOT NULL, + create_key VARCHAR(80) NOT NULL, config_json CLOB NOT NULL, + source_id BIGINT NOT NULL, server_id BIGINT NOT NULL, target_key VARCHAR(180) NOT NULL, + status VARCHAR(24) NOT NULL, version BIGINT NOT NULL, attempt BIGINT NOT NULL, + external_id VARCHAR(64), fingerprint VARCHAR(64), checkpoint_id VARCHAR(64), summary VARCHAR(1000 CHAR), + read_rows BIGINT, write_rows BIGINT, observed_at TIMESTAMP, busy_until TIMESTAMP, + created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, + CONSTRAINT uq_rt_create UNIQUE(org_id,owner_id,create_key), + CONSTRAINT uq_rt_server UNIQUE(source_id,server_id), + CONSTRAINT uq_rt_target UNIQUE(target_key) +); +-- @statement realtime_event +CREATE TABLE ing_realtime_event ( + id BIGINT PRIMARY KEY, task_id BIGINT NOT NULL, request_key VARCHAR(80) NOT NULL, + action VARCHAR(16) NOT NULL, status VARCHAR(24) NOT NULL, summary VARCHAR(1000 CHAR), + created_at TIMESTAMP NOT NULL, + CONSTRAINT uq_rt_action UNIQUE(task_id,request_key), + CONSTRAINT fk_rt_event FOREIGN KEY(task_id) REFERENCES ing_realtime_task(id) +); diff --git a/docs/runbook/CDC日志通道接入.md b/docs/runbook/CDC日志通道接入.md new file mode 100644 index 0000000..8022009 --- /dev/null +++ b/docs/runbook/CDC日志通道接入.md @@ -0,0 +1,65 @@ +# CDC 日志通道接入 + +本功能使用数据库日志产生的增删改消息,不使用时间字段轮询。MySQL、Oracle 非 CDB、SQL Server 保留原生 CDC;达梦、人大金仓和 Oracle CDB/PDB 可通过厂商日志工具 → Kafka → SeaTunnel → Doris 接入。系统不自动安装、授权或启动源端厂商软件。 + +## 源端准备 + +| 来源 | 日志出口 | DataGov 消息格式 | +|---|---|---| +| 达梦 | 已授权且匹配数据库版本的 DMHS,启用归档/逻辑日志和完整行镜像 | `ogg_json`,参考仓库 DMHS 模板 | +| 人大金仓 | 已授权且匹配 KES 版本的 FlySync/KDTS 日志出口 | 转为下述 `ogg_json` 或 `debezium_json`;不能直接使用未经转换的厂商默认 JSON | +| Oracle CDB/PDB | Debezium Oracle LogMiner 连接器,或已授权 GoldenGate | Debezium JSON 或 OGG JSON | + +Oracle CDB/PDB 的源端采集器需分别设置容器数据库名、PDB 名、连接服务及公共采集账号,并准备归档、补充日志、LogMiner 与目标 PDB 表读取权限。DataGov 的数据源则连接实际表所在的 PDB,用于校验表结构。原生非 CDB 模式仍填写 V$DATABASE.NAME;使用日志通道时不再填写此项。 + +Kafka 为持久的日志传输层,不负责从数据库生成日志。需要实际部署源端采集组件;只有 JDBC 驱动或一个空 Kafka 主题不能完成 CDC。厂商安装包、许可证及数据库权限不随本项目提供。 + +## 通道登记和页面使用 + +1. 在数据源管理登记真实来源,确保源表 JDBC 连接可用;在存储资源管理登记 Doris,预建字段同名、同序、主键一致的 Unique Key 表。 +2. 管理员将 `script/datagov/cdc/relay-channels.example.yml` 合并到 Integration 实际加载的受管配置(如该服务 Nacos YAML),替换组织 ID、来源 ID、schema、表、broker、主题和已有 secretRef,然后启用对应条目并按现行服务发布流程使配置生效。示例默认禁用,域名不可用,不含真实密码。 +3. 一个通道绑定一个组织、数据源和源表;页面只列出当前账号已授权来源的通道。公网请求不能任意指定 broker、主题或凭据。认证可选 SASL_SSL/SCRAM、SASL_PLAINTEXT、SSL 或受控内网 PLAINTEXT;SSL 使用节点已有信任配置,不能通过关闭证书校验绕过连接错误。 +4. 实时采集新增 → 选择达梦/金仓/Oracle → 选择日志通道,自动带出 schema/表 → 选择 Doris → 保存 → 校验 → 启动。Oracle 留空通道时使用原生非 CDB 路径。 +5. “从主题最早保留消息开始”只回放 Kafka 尚保留的数据,不自动补扫数据库。完整初始化必须由上游先输出一致性快照并衔接增量;“仅同步启动后的变更”要求已准备一致基线。Kafka 保留期限必须覆盖停止时间,恢复位置过期时失败,不自动跳到最新消息。 + +## 消息契约 + +一个主题仅含绑定表的消息;同一主键有序。上游必须提供完整字段,字段名及大小写与源表一致,更新同时包含完整旧行和新行,删除包含完整旧行。不能以只有主键的删除消息或局部更新消息冒充完整行。主键变更必须能得到旧主键和新主键;不支持 DDL 自动演进、TRUNCATE 或跨表消息。 + +OGG JSON 的最小样例(业务字段仅举例): + +```json +{"op_type":"I","before":null,"after":{"ID":1,"NAME":"新增"}} +{"op_type":"U","before":{"ID":1,"NAME":"新增"},"after":{"ID":2,"NAME":null}} +{"op_type":"D","before":{"ID":2,"NAME":null},"after":null} +``` + +Debezium JSON 使用 `op` 字段,新增 `c`(快照 `r`)、更新 `u`、删除 `d`,同样携带 before/after;与该格式兼容的 payload 包装须先用实际插件验证。日期时间、Decimal 必须符合 SeaTunnel JSON 格式,Oracle 特殊时间/Decimal、二进制、复杂对象等不能直接假定兼容;当前字段校验对不支持类型直接拒绝。 + +DMHS 示例 `script/datagov/cdc/dmhs-ogg-json.example.ini` 适用于支持分操作模板的版本。旧版本模板语法不同,需按厂商版本调整并核对输出;完整旧行还取决于源库日志和 DMHS 配置。FlySync 不同版本的 JSON 模板语法不同,需将其输出映射到上述契约;本项目没有假定其默认消息就是 OGG 格式。对未适配的厂商原始消息不要启动任务。 + +## 验证与恢复 + +依次验证快照、INSERT、非主键 UPDATE、主键变化、DELETE、NULL、Decimal/日期,以及停止后恢复和 Kafka 保留期不足。只有实际数据库到 Doris 核对一致才算端到端通过。提供的 `CdcFormatProbe.java` 仅验证真实 SeaTunnel 解码器的增删改/主键变化/NULL/坏消息拒绝,不代替源端采集和 Kafka 传输验收。 + +SeaTunnel 2.3.13 恢复使用相同 jobId 和 `isStartWithSavePoint=true`。DataOps 持久化的终态、检查点与配置指纹参与恢复校验;引擎从持久卷加载检查点,不依赖内存历史列表。随附引擎补丁在检查点缺失或落后于已确认进度时拒绝启动,禁止悄悄重新全量。任务配置、表结构、来源版本、目标绑定改变仍禁止沿用旧检查点。 + +## 本次交付记录(2026-11-23) + +用户要求补齐跨重启恢复和达梦、金仓、Oracle CDC。恢复改为同一 jobId + `isStartWithSavePoint=true`;DataOps 传递持久化终态/检查点证据,Integration 校验配置指纹,SeaTunnel 补丁拒绝缺失或落后的检查点,避免重新全量。新增受管日志通道配置、组织/来源授权过滤、前端通道选择及 Kafka 插件;无数据库迁移。此前记录中的多类型 CDC 未完成边界由本记录更新,历史测试结论不改写。 + +验证:42 项后端定向测试 PASS;另在达梦运行 RealtimeJdbcTest 1 项 PASS,覆盖恢复沿用原作业身份;实际 SeaTunnel 解码器的 OGG/Debezium 增删改、主键变化、NULL、坏消息拒绝 PASS;真实引擎缺失检查点恢复拒绝 PASS;前端 lint/生产构建和受影响文件检查 PASS。真实达梦/金仓/Oracle 源端到 Doris 的端到端测试 NOT_RUN,当前没有登记对应源端日志通道。 + +发布:引擎 `2.3.13-cdc-complete-20261123` 镜像 `f9a236287c22f23039d2e63394c922a43fa01a507e748ecd65cfd294feeac345` 已部署,原配置/网络/挂载保留;恢复镜像 `f40a1b70d8fcb5efb13d63796d08d31ddb0325e689bad68cecaa34f4f22ee259`。DataOps/Frontend 使用 `cdc-complete-20261123`,Integration 使用 `cdc-complete-r2-20261123`;制品读回与恢复引用保存在 `script/datagov/deployment/releases/` 对应记录。恢复按相同 deploy.sh plan/apply;Integration 初版 plan 未 apply,最终使用 r2,未覆盖旧计划。 + +在线恢复实测:原 MySQL 任务 `2124683330629324801` 在引擎重启、历史 HTTP 记录丢失后,经页面恢复,仍使用作业 `161448392875559592`。2026-11-23 14:46 引擎协调器明确记录从 checkpoint 458 恢复,Doris 写入器同样恢复 458;页面同步状态为持续运行,checkpoint 推进至 459,读取/写入 2/2(本次运行计数)。未对源表执行测试增删改。随后请求停止,引擎确认 SAVEPOINT_DONE,保存新 checkpoint 461;保持用户原来的停止意图。此项跨重启恢复 PASS,不代表其他数据库端到端验收。 + +最终页面读回:14:48:10 同步状态后显示“已停止”、checkpoint 461、2/2;截图 `runtime/cdc-recovery-complete.png`。Integration/DataOps 启动日志确认完成,三个应用制品读回 PASS。整体交付 PASS_WITH_LIMITATION:平台日志通道与恢复已部署,厂商源端安装/配置及三种新数据库真实业务验收未完成。 + +## 官方参考资料 + +- [SeaTunnel Kafka 2.3.13](https://seatunnel.apache.org/docs/2.3.13/connectors/source/Kafka/) +- [SeaTunnel OGG JSON](https://seatunnel.apache.org/docs/2.3.13/connectors/formats/ogg-json/) +- [达梦 DMHS](https://eco.dameng.com/document/dm/zh-cn/faq/FAQ_DMHS_NEW.html) +- [Kingbase FlySync 部署](https://help.kingbase.com.cn/kfs/install-update/installation-guide/installation-guide_installation_guide_deploy.html) +- [Debezium Oracle](https://debezium.io/documentation/reference/stable/connectors/oracle.html) diff --git a/docs/runbook/实时采集-20261120.md b/docs/runbook/实时采集-20261120.md new file mode 100644 index 0000000..94d54d0 --- /dev/null +++ b/docs/runbook/实时采集-20261120.md @@ -0,0 +1,166 @@ +# 实时采集交付(2026-11-20) + +## 2026-11-23 停止状态识别与插件启用 + +用户手动停止 MySQL 后持续显示待确认。只读核验作业 161448392875559592:running-jobs、pending-jobs 均为空,jobStatus=SAVEPOINT_DONE,最新完成 checkpoint=458。原因是 SeaTunnelAdapter.normalize 漏识别保存点停止终态,实际已停止;现将 SAVEPOINT_DONE 映射为 CANCELED(页面“已停止”),DOING_SAVEPOINT 仍为 UNKNOWN,避免提前报告停止。未重新启动任务。 + +检查:ExternalStatusContractTest 7、SeaTunnelM3ContractTest 21,共28项通过,无失败/跳过;Maven Wrapper 合并 package、2个受影响文件检查 PASS。修改仅涉及适配器映射和状态契约测试。Integration 发布 `cdc-stop-fix-20261123`,镜像 e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404,制品读回 PASS;恢复引用 `script/datagov/deployment/releases/cdc-stop-fix-20261123-integration.json`。首次镜像制品不一致被预检拦截,改用当前JAR的流式构建上下文后验证一致,无绕过制品检查,无迁移。 + +Integration 启动完成;浏览器同步状态读回“已停止”、checkpoint 458、计数84/84。用户本次授权停止后更新,已执行 `deploy-seatunnel-cdc.py --image aixun-datagov/seatunnel:2.3.13-multi-cdc-20261123` plan/apply:目标镜像 f40a1b70d8fcb5efb13d63796d08d31ddb0325e689bad68cecaa34f4f22ee259,恢复镜像 a7590d2b44512aef564880bbee002bbb4634e7d83fcf20683c137565b51b28c3,非镜像配置一致 PASS,运行/排队任务均为0,新连接器文件存在。此结果替代下方“引擎尚未apply”的历史限制。 + +更新后引擎不再返回旧作业历史和检查点HTTP记录,但专属持久卷中458检查点文件仍存在。DataOps 增加终态刷新保护:只在 REFRESH 遇到 UNKNOWN 时保留既有终态、检查点和计数,并明确提示它们是历史记录;实时返回RUNNING不被覆盖,DELETE不放宽核验。恢复仍按现有终态和检查点双重核验拒绝执行,跨引擎重启恢复能力尚未完成验证,不能宣称当前旧任务可直接恢复。本次未启动新作业、未写源/目标业务数据。 + +DataOps RealtimePolicyTest 5项通过,合并package及2文件检查PASS。镜像 e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5;部署/恢复引用 `script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops*.json`。本轮共33项针对性测试通过;Oracle/SQL Server真实CDC及跨重启恢复NOT_RUN,达梦/金仓和Oracle CDB/PDB未完成的边界保持。 + +最终读回:DataOps 制品读回及启动完成 PASS;14:03:57 浏览器再次“同步状态”仍显示已停止、458、84/84,并明确标注历史观测限制。截图 `runtime/cdc-stop-fixed.png`。引擎运行及排队任务再次读回均0。结果 PASS_WITH_LIMITATION;旧任务跨引擎重启恢复仍受核验限制,不代表可恢复或全部CDC功能验收通过。 + +## 2026-11-23 新增/编辑目标选项超时修复 + +浏览器复现编辑任务失败:`GET /api/dataops/v1/unified-ingestions/sources` 成功,`targets?type=DORIS` 返回 HTTP 500;网关日志确认 DataOps 读取超时(约10003毫秒)。目标选项复用了完整存储详情,额外读取100条容量快照及每条快照的维度。新增 StorageResourceService.selectionDetail,仅查询已授权资源、空间与公开访问配置;UnifiedIngestionService.targets 改用此查询,完整存储详情保持原行为。没有增加超时阈值或放宽权限。 + +验证:StorageSelectionDetailTest 2、StorageResourceServiceTest 5、UnifiedIngestionRecoveryTest 13,共20项通过,无跳过;Maven合并打包和3个受影响文件检查 PASS。发布仅涉及 DataOps,计划/结果引用 `script/datagov/deployment/releases/realtime-targets-20261123-dataops*.json`。源代码改动为上述两个服务与新增测试。恢复使用计划中的原镜像和标准 deploy.sh;无需迁移。 + +本地发布和制品读回 PASS,镜像 `aixun-datagov/dataops:realtime-targets-20261123`(sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9),恢复镜像 sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa。启动完成后浏览器实际验证编辑弹窗与新增弹窗均正常打开;目标接口 HTTP 200、首字节约1702毫秒,源接口 HTTP 200。编辑表单读回所选目标数据库 ERP_PROCUREMENT。未保存测试配置、未建表或启动采集;原目标表不存在的问题仍须在该库下处理。 + +## 2026-11-23 校验错误定位修复 + +用户更换源库及账号后仍收到笼统读取错误。已将校验按源库连接、Binlog、主键、字段、Doris连接、目标定义、目标字段和空表检查分别报告,保留安全 SQLState/错误码,禁止回显原始 SQL 异常中的连接串、账号或密码。针对 Doris 通用 1105 码增加不存在表、数据库及访问拒绝的安全分类。 + +本地浏览器对任务“测试”(shop_test.sys_dict_data → sys_dict_data_ods)重新校验,确认源库连接、Binlog、主键和字段读取通过,实际失败阶段为“读取Doris目标表定义”,SQLState=HY000/code=1105。源端更换 root 不会解决目标端错误。没有启动采集、修改账号、关闭 TLS 或改变目标表数据。 + +受影响文件:RealtimeCollectionDubboService.java、RealtimeCheckFailureTest.java。只发布 Integration;恢复引用为本次 `script/datagov/deployment/releases/realtime-diagnosis-20261123*-integration*.json`,保留原镜像 sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e。真实 CDC 同步仍 NOT_RUN。 + +验证:7项针对性测试全部通过(MysqlCdcJobFactoryTest 3,RealtimeCheckFailureTest 4),Maven合并构建 PASS,3个受影响文件检查 PASS。最终镜像 `aixun-datagov/integration:realtime-diagnosis-20261123-r2`,ID `sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa`。 + +最终发布制品读回 PASS,Integration 启动完成。2026-11-23 08:57:40 浏览器再次校验读回:“读取Doris目标表定义失败:表不存在,请核对表名及大小写;Doris目标表需要预先创建(SQLState=HY000, code=1105)”。确定当前绑定的 Doris 目标库未找到 sys_dict_data_ods,须纠正目标库/表选择或预建匹配的 Unique Key 表;此错误与源端是否使用 root 无关。校验失败保持草稿正确,未自动建表或开始写数据。 + +结果:PASS_WITH_LIMITATION。源码、构建、本地应用发布和插件加载完成;真实 MySQL → Doris 数据同步及浏览器人工验收由用户执行,状态 NOT_RUN。不能据此宣称生产可用。 + +## 使用 + +访问本地 http://localhost:28000,重新登录后进入“集成 → 实时采集”。菜单位于数据采集与文件接入之间。已有批量采集提交权限的角色获得实时采集查看和管理权限;后续授权仍走系统角色管理。 + +1. 登记可访问的 MySQL 数据源与 Doris 存储资源、数据库空间。账号密码使用原有托管秘密,不在实时采集页面输入。 +2. MySQL 开启 binlog,格式 ROW,row_image=FULL;账号具备快照读取和复制权限。源表必须有主键。Doris 预建 Unique Key 表,键与源主键一致,全部字段名称、顺序一致且类型兼容。SeaTunnel 能访问 MySQL、Doris FE HTTP/查询端口及 Stream Load 重定向的 BE 地址。 +3. 新增任务,选择来源、目标,输入源表/目标表、FE HTTP 端口(默认 8030),选择“全量后增量”或“仅最新增量”。每任务配置独立 server-id,不能与已有外部复制客户端冲突。checkpoint 默认 30 秒。 +4. 保存后“校验”,通过后“启动”。全量后增量首次启动要求目标表为空;仅最新增量不会补历史数据。 +5. 使用“同步状态”读回引擎状态,详情查看作业 ID、checkpoint、计数及操作历史。停止请求保存点;确认已停止/失败且存在已完成 checkpoint 后可恢复。UNKNOWN 状态先同步状态核对,不能重复启动。 +6. 人工验收:验证初始数据、INSERT、UPDATE、DELETE;等待 checkpoint 后核对目标;停止、刷新确认、恢复后再验证增量;验证无权限用户及重复点击。禁止直接用生产重要表做破坏性测试。 + +本次范围为单表 MySQL → Doris,全部字段同名同步;不包含自动建表、DDL 演进、字段转换、多表、其他 CDC 源或 TLS 源/目标。每个目标表只允许一个任务占用;首次启动后配置不可变。未启动草稿可编辑、归档。不可用指标显示空值,不伪造进度。 + +## 实现与检查 + +- Integration:RealtimeCollectionService 契约、RealtimeCollectionDubboService、MysqlCdcJobFactory、SeaTunnelAdapter 流作业提交/停止/恢复与身份校验;托管凭据解析及源/目标结构前检。 +- DataOps:RealtimeController/RealtimeService,任务及事件持久化、用户组织隔离、版本并发控制、请求幂等和提交前外部作业身份保存;数据源/存储删除引用保护。 +- UI:`aixun-ui/src/views/datagov/dataops/realtime-ingestion/index.vue`,配套 API、菜单图标及生成声明。 +- 数据库:`db/dameng/realtime.sql` 两张表;`script/database/RealtimeMenu.java` 安装菜单与权限。主 schema 初始化工具已包含新表;新环境还须显式运行菜单安装器。 +- 插件:SeaTunnel 2.3.13 的 connector-cdc-mysql、connector-cdc-base、connector-doris;Doris 所需 MySQL JDBC 驱动放入 lib。下载脚本固定校验和,CDC 公共包位于 plugins/connector-cdc-mysql。 + +检查结果: + +- 后端构建 PASS;MysqlCdcJobFactoryTest 3、SeaTunnelM3ContractTest 21、RealtimePolicyTest 3、RealtimeJdbcTest 1,共 28 项通过,无跳过。最后一项连接实际达梦测试 schema,执行生产服务 SQL,模拟引擎响应,合成数据事务回滚;不是实际 CDC 数据链路测试。 +- 前端受影响文件 lint 和生产构建 PASS;脚本/配置/SQL 显式文件检查 PASS。 +- 达梦两张表安装/核验 PASS,菜单路径 `/realtime-ingestion`、排序 5 读回 PASS。 +- Integration、DataOps、Frontend 发布制品读回 PASS;两个后端出现 Started 启动完成日志。前端 `/` 和 `/realtime-ingestion` HTTP 200,仅证明静态入口可达。 +- 最终 SeaTunnel healthy,MySQL-CDC/Doris 工厂和 MySQL 驱动在实际容器内类加载 PASS;未提交真实 CDC 作业。 +- 浏览器交互、实际用户权限验收、真实源/目标增删改和 checkpoint 故障恢复:NOT_RUN。 +- DataOps 日志存在原有 SchedulingReadRetryWorker 的 `Read attempt maintenance unavailable; category=BadSqlGrammarException` 告警,与新增实时采集代码不在同一路径;本次未修复调度维护模块,不将整个服务全部功能标为通过。 + +可复现命令(秘密仅由本地私有配置注入): + +```sh +./script/quality/check.sh --frontend src/views/datagov/dataops/realtime-ingestion/index.vue src/api/datagov/realtime-ingestion/index.ts src/layout/components/Sidebar/menuIcons.ts +./script/quality/check.sh --frontend-build +python3 script/database/with-dameng-env.py --config runtime/dev-private/dameng-test.json -- ./mvnw -B -pl aixun-modules/aixun-integration,aixun-modules/aixun-dataops -am package '-Dtest=RealtimeJdbcTest,RealtimePolicyTest,MysqlCdcJobFactoryTest,SeaTunnelM3ContractTest' -Dsurefire.failIfNoSpecifiedTests=false +python3 script/database/apply-dameng-schema.py --config runtime/dev-private/dameng-test.json --schema-file db/dameng/realtime.sql --verify +python3 script/database/apply-realtime-menu.py --config runtime/dev-private/dameng-test.json +``` + +新环境显式安装时,上述 schema 命令使用 `--apply`,菜单命令增加 `--apply`。读回和验证命令不会应用迁移。 + +## 本地发布与恢复 + +原请求授权:用户要求新增实时采集页面、完成功能并交由用户测试。仅更新本项目局部应用及自有 SeaTunnel,保留网络、IP、端口、挂载、秘密及其他配置,不触及其他项目或删除数据卷。 + +| 服务 | 最终镜像 | 镜像 ID | +|---|---|---| +| integration | aixun-datagov/integration:realtime-20261120-r2 | sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e | +| dataops | aixun-datagov/dataops:realtime-20261120-r2 | sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa | +| frontend | aixun-datagov/frontend:realtime-20261120 | sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476 | +| SeaTunnel | aixun-datagov/seatunnel:2.3.13-cdc-20261120-r2 | sha256:a7590d2b44512aef564880bbee002bbb4634e7d83fcf20683c137565b51b28c3 | + +应用 plan/apply/result 位于 `script/datagov/deployment/releases/realtime-20261120*-{integration,dataops,frontend}*.json`;恢复使用其中 source/recovery image,通过同一 deploy.sh 重新生成绑定旧制品的计划再 apply。最初 Integration 恢复镜像为 sha256:aa53067(完整 ID 见初始 integration 计划);DataOps/Frontend 的 recoveryImageId 见最终 result。 + +SeaTunnel 专用工具 `script/datagov/deploy-seatunnel-cdc.py` 仅在无运行/排队作业时替换镜像,计划位于 `.cache/datagov/seatunnel-cdc-plan.json`。原业务镜像 `aixun-datagov/seatunnel:2.3.13-ingestion-kingbase-20261104`,ID sha256:4acbfceaf2078ae9effdf22156cca57733ffc8e935fce640326c1e86ebd4bebf 保留用于恢复。需恢复时先确认/停止 CDC 任务,再以同样配置校验流程切回原镜像。新增数据库对象前向保留,不删除任务/审计记录。 + +发布期间曾遇到 Docker API 创建失败、Compose 健康检查美元符号转义及挂载列表顺序比较问题;均已恢复后修正,最终配置一致性校验 PASS。替换前确认无运行/排队作业,未删除数据。镜像与构建产物不重复存入 evidence,临时完整日志在本摘要形成后清理。 + +## 2026-11-23 运行异常中文说明 + +- 用户反馈 checkpoint 堆栈不可读。实际作业 `144036429594027412` 状态 FAILED,SeaTunnel 作业接口返回 6035 字符异常;最底层为 Doris Stream Load 连接 `127.0.0.1:8040` 被拒绝。引擎日志显示先访问 FE,再连接回环地址失败。应排查 Doris 服务端提供的 BE 地址及 HTTP 端口;本次未修改远端 Doris 或重新提交采集。 +- 修改 `SeaTunnelAdapter.jobInfo`:完整异常链先分类再转换为中文原因与建议,不再直接截断并返回堆栈;覆盖 Doris 回环地址/网络、数据质量、认证授权、Binlog 清理;只有 checkpoint 包装或未知异常时明确根因未知,不推断成功。 +- 新增 `SeaTunnelFailureExplanationTest`:长堆栈底层识别、包装异常不臆测、秘密不透传及已知分类。Maven package 运行该测试、SeaTunnelM3ContractTest、RealtimeCheckFailureTest,共 29 项 PASS;显式文件检查 2 项 PASS。 +- 本地仅发布 integration:`aixun-datagov/integration:realtime-errors-20261123`,镜像 `sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f`;plan/apply/result 见 `script/datagov/deployment/releases/realtime-errors-20261123-integration*.json`。镜像读回 PASS,恢复镜像 `sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa`,通过同一 deploy.sh 绑定恢复制品发布。没有迁移、前端变更或 SeaTunnel 重启。 +- CDC 实际写入与故障恢复:BLOCKED(Doris 回环地址连接失败,且任务没有已完成 checkpoint);不将错误提示修复作为采集成功验收。 +- 服务启动完成(38.688 秒);浏览器执行现有任务“同步状态”,09:24:20 列表与详情均显示中文 Doris 回环地址原因及处理建议,外部作业编号一致,提示验证 PASS。截图 `runtime/realtime-error-proof.png`。未重新提交任务或改变外部数据。 + +## 2026-11-23 Doris 外部写入地址修复 + +- 用户明确授权本次例外检查修改 `doris408prod` 的 `doris`、`doris-be`,不扩展至其他项目。通过用户建立的 SSH 复用连接操作。 +- 根因:BE 配置 priority_networks=127.0.0.0/24,注册 Host=127.0.0.1,原 Tag 仅 location=default;FE/BE 共用网络,内部可用的回环地址被返回给外部采集节点。BackendId=1790173118125,已有 1716 tablets。 +- 按 Doris 4 多端点能力执行 `ALTER SYSTEM MODIFY BACKEND '127.0.0.1:9050' SET ('tag.location'='default','tag.public_endpoint'='43.249.195.133:8040')`。首次仅传 public_endpoint 被服务端拒绝,读回确认未变更后补充原 location;最终读回两个标签正确、Alive=true。不修改内部 Host,不重启,不删除或迁移任何已有 tablet/数据卷。 +- FE 重定向已指向外部 8040。使用系统现有受管凭据:Integration 和 SeaTunnel 容器分别通过 FE 重定向向本次新建临时表写入 1 行,均 Status=Success、Loaded=1、Filtered=0,SQL 读回合计 2 行;临时表随后删除并核对不存在。业务目标 sys_dict_data_ods 前后均为 0 行。空 JSON 探针因无有效行被拒绝,无业务行写入。 +- 运行配置修复与实际 Stream Load 链路验证 PASS;原 CDC 作业仍 FAILED、无完成 checkpoint,本次未重提交业务任务,完整 CDC/检查点恢复 NOT_RUN。没有源码或制品变更,无需构建发布。 +- 如需恢复原路由,可在核对当前标签无后续变更后执行 `ALTER SYSTEM MODIFY BACKEND '127.0.0.1:9050' SET ('tag.location'='default')`,并 SHOW BACKENDS 核对;这会恢复外部采集不可达状态,不应常规执行。 +- 官方依据:https://doris.apache.org/docs/4.x/data-operate/import/load-best-practices/stream-load-in-complex-network/ 。HTTP 重定向 Location 可能包含认证信息,诊断输出须移除 URL userinfo,禁止保存原始响应头。 + +## 2026-11-23 实时任务删除 + +- 用户要求操作列增加删除。复用现有 ARCHIVED 软删除存储和版本/幂等/组织所有者/管理权限约束,增加 DELETE 操作;草稿及终态可删除,运行中和未知状态拒绝。已提交任务删除前重新查询 SeaTunnel,只有同一作业确认终态才移出列表,释放 target_key/server_id 占用。保留历史及源、目标数据;已删除记录禁止 REFRESH 重新激活。 +- UI 删除确认明确范围,成功后关闭详情并刷新列表,末页最后一条删除后回退页码。涉及 RealtimeService.java、RealtimePolicyTest.java、RealtimeJdbcTest.java、realtime-ingestion/index.vue。 +- 验证 PASS:4 项状态规则测试;1 项真实达梦事务回滚生命周期测试(含终态过期拒绝删除、删除重放、列表移除、历史保留、占用重新创建、草稿删除、所有者隔离);3 文件检查;前端 lint、一次生产构建。测试数据全事务回滚。 +- 本地发布 dataops 镜像 sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36、frontend 镜像 sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517,标签均 realtime-delete-20261123;制品读回 PASS,DataOps 启动 31.805 秒。计划结果见 deployment/releases/realtime-delete-20261123-{dataops,frontend}*.json;恢复分别使用 result 的 recoveryImageId,通过同一 deploy.sh 绑定旧制品计划发布。未改运行配置/迁移。 +- 前端计划曾因 dist/.DS_Store 被 Docker 排除而哈希不一致;逐文件比对确认仅该 OS 临时文件多出,删除该文件后校验通过,未跳过制品核验。 +- 浏览器按钮显示、确认弹窗和取消保留任务 PASS,截图 runtime/realtime-delete-proof.png;用户原有任务未删除,实际用户点击删除验收 NOT_RUN。后端真实 SQL 删除流程已由回滚测试验证。 + +### 按钮排序调整 + +- 按用户要求将操作顺序改为:详情、编辑、启动、校验、同步状态、停止、恢复、删除。仅调整模板顺序,权限、状态条件与公共操作列折叠规则不变。 +- 单文件前端检查及生产构建 PASS;仅发布 frontend:realtime-order-20261123,镜像 sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09,制品读回 PASS。计划和恢复引用见 deployment/releases/realtime-order-20261123-frontend*.json,恢复镜像为上一节 frontend 镜像。 +- 浏览器刷新时用户任务已为持续运行,显示详情、同步状态、停止,符合显示条件。未操作运行任务;就绪及可删除状态的人工页面验收 NOT_RUN,模板顺序已检查。 + +### 操作图标统一 + +- 按用户要求使用图标加文字:View 详情、Edit 编辑、VideoPlay 启动、CircleCheck 校验、Refresh 同步状态、VideoPause 停止、RefreshRight 恢复、Delete 删除;顺序及状态/权限条件保持。复用公共操作列的图标复制能力,更多菜单也保留图标。 +- 单文件前端检查、生产构建、本地 frontend 发布制品读回 PASS。版本 realtime-icons-20261123,镜像 sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3;恢复使用上一节 realtime-order 镜像,经相同 deploy.sh 计划发布。无后端变更或迁移。 +- 浏览器草稿及运行中任务可见图标加文字,截图核验 PASS(runtime/realtime-icons-proof.png);未启动、停止或更改用户任务。 +# 2026-11-23 多类型 CDC 扩展 + +用户要求增加达梦、人大金仓、Oracle、SQL Server,并由用户自行联调。当前实际边界:MySQL 保留;新增 Oracle **非 CDB**、SQL Server 原生 CDC 配置生成及校验;达梦、人大金仓和 Oracle CDB/PDB 尚未完成,不以 JDBC 轮询代替日志 CDC。 + +当前账号的数据源页面只有两个 MySQL 数据源;本项目容器及集成配置未发现 DMHS、KFS/KDTS、Kafka 变更出口。这只能证明当前可访问的项目环境未配置,不能推断用户其他服务器没有这些组件。 + +实现:复用受管数据源、账号秘密、Doris Unique Key 校验、任务状态机、检查点、鉴权和审计。配置新增 `sourceSchema`、`oracleDatabase`,保存在既有 config_json,不需要迁移。旧 MySQL 配置指纹保留,避免影响既有任务恢复。操作按钮顺序及图标保持。数据源列表显示数据库类型;达梦、金仓显示未接通原因并禁止保存;服务端同样禁止执行。 + +测试填写: +- SQL Server:先在数据源管理登记并测试连接;实时采集选择该来源,填写 Schema(通常 dbo)和表名。源库、表均开启 CDC,捕获作业持续运行;采集账号须能读取源表和 CDC 表。SSL 设置沿用受管连接,同时传给快照与增量读取器。官方 2.3.13 文档支持基线为 SQL Server 2019,其他版本须实际联调。 +- Oracle:数据源中填写连接服务名;实时采集中另填 `V$DATABASE.NAME` 和表所属 Schema,名称大小写与源库一致。需 ARCHIVELOG、补充日志、LogMiner 及源表读取权限。当前仅非 CDB;检测到 CDB 明确拒绝。2.3.13 插件的 OracleDialect/OracleSchema 元数据路径没有显式切换 PDB,尚未修补和验证,不能宣称支持 CDB/PDB。 +- 目标:Doris 表预先建立,Unique Key 与源主键一致,字段名及顺序一致;首次全量要求目标为空。测试历史快照、INSERT、UPDATE、DELETE、停止及检查点恢复;未实际运行的数据库不得标为通过。 +- 达梦:需要确认版本和可用 DMHS 等日志组件及变更消息协议。人大金仓:需要确认 KES 版本和 KFS/KDTS 等日志组件。厂商接口/消息协议未确定,尚无可执行适配;不能直接安装 JDBC 驱动或套用 PostgreSQL CDC 冒充完成。 + +插件:新增 connector-cdc-oracle/connector-cdc-sqlserver 2.3.13、orai18n 23.26.2.0.0;复用 ojdbc11 23.26.2.0.0、mssql-jdbc 13.4.0.jre11。`script/datagov/m2/seatunnel/fetch-native-cdc.py` 固定 Maven Central 地址和 SHA-256;Dockerfile 为每种 CDC 隔离提供 cdc-base。新镜像 `aixun-datagov/seatunnel:2.3.13-multi-cdc-20261123` 已构建,三种来源及 Doris 工厂、驱动离线加载通过。插件加载不等于端到端同步验收。 + +发布限制:当前 SeaTunnel 有运行中的 MySQL 作业,镜像替换脚本拒绝带活动任务更新。不得直接重启引擎;须先通过任务停止保存检查点、确认终态,再执行 `deploy-seatunnel-cdc.py --image <新镜像>` 的 plan/apply,随后按已有任务恢复流程处理。旧镜像保留作恢复引用。已生成引擎 PLAN_ONLY,未 apply;询问用户是否允许短暂停止保存检查点后更新并恢复,等待回复。当前观测作业 161448392875559592 为 RUNNING,检查点 240 为 COMPLETED(后续可能更新)。 + +验证/交付结果: +- PASS:20项后端定向测试(NativeCdcSource 5、MySQL工厂3、校验错误4、执行错误4、状态策略4)、受影响文件检查、前端 lint/生产构建、三来源/Doris工厂及驱动离线加载。 +- PASS:integration、dataops、frontend 已通过 `deploy.sh` plan/apply 发布 `multi-cdc-20261123`,制品读回通过,两个应用启动日志已确认。镜像身份分别为 `aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9`、`404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04`、`cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483`;恢复身份和不漂移证明见 `script/datagov/deployment/releases/multi-cdc-20261123-*.json`,旧版本保留。 +- PASS_WITH_LIMITATION:Browser 已验证新版标题、现有MySQL任务列表、新增表单、两个登记来源的类型标签,无新建/停止/删除任务。截图 `runtime/cdc-multisource-form.png`。无其他类型登记来源,未进行原生Oracle/SQL Server表单实源交互。 +- BLOCKED:引擎新镜像尚待无活动任务时切换;达梦/金仓缺日志组件及接口;Oracle CDB/PDB适配未完成。 +- NOT_RUN:Oracle/SQL Server真实快照、增删改、恢复、低权限测试;达梦/金仓端到端CDC。整体不是四种数据库的完成验收。 + +恢复:按相同部署入口使用上述发布记录的旧镜像/制品生成恢复计划再 apply;配置扩展无迁移。未改动现有业务数据或运行中SeaTunnel任务。新依赖及构建属于待启用有效制品,保留;离线探针容器使用 `--rm --network none`,已清理。 + +官方依据:[SeaTunnel Oracle CDC 2.3.13](https://seatunnel.apache.org/docs/2.3.13/connectors/source/Oracle-CDC/)、[SQL Server CDC 2.3.13](https://seatunnel.apache.org/docs/2.3.13/connectors/source/SqlServer-CDC/)、[达梦 DMHS FAQ](https://eco.dameng.com/document/dm/zh-cn/faq/FAQ_DMHS_NEW.html)、[Kingbase FlySync 安装手册](https://help.kingbase.com.cn/kfs/PDF/Kingbase%20FlySync%20%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2%E6%89%8B%E5%86%8C.pdf)。 + diff --git a/script/database/RealtimeMenu.java b/script/database/RealtimeMenu.java new file mode 100644 index 0000000..84b40fe --- /dev/null +++ b/script/database/RealtimeMenu.java @@ -0,0 +1,38 @@ +import java.sql.*; +import java.util.*; + +/** Forward-only, scoped menu installation; existing role grants are preserved. */ +class RealtimeMenu { + public static void main(String[] args) throws Exception { + String schema=System.getenv("DATAGOV_DM_SCHEMA"); + if(schema==null||!schema.matches("AIXUN_DATAGOV_[A-Z0-9_]+"))throw new IllegalArgumentException("Dedicated schema required"); + Properties p=new Properties();p.setProperty("user",System.getenv("DATAGOV_DM_USERNAME"));p.setProperty("password",System.getenv("DATAGOV_DM_PASSWORD")); + p.setProperty("connectTimeout","6000");p.setProperty("socketTimeout","30000"); + try(Connection c=DriverManager.getConnection("jdbc:dm://"+System.getenv("DATAGOV_DM_HOST")+":"+System.getenv("DATAGOV_DM_PORT"),p)) { + c.setSchema(schema);c.setAutoCommit(false); + long root=1761490000000002010L,menu=1761490000000002810L,manage=1761490000000002811L; + if(args.length==1&&"--apply".equals(args[0])) { + insert(c,menu,root,"实时采集","/realtime-ingestion","datagov/dataops/realtime-ingestion/index","C","aixun:dataops:realtime:view",5); + insert(c,manage,menu,"实时采集管理","#","","F","aixun:dataops:realtime:manage",1); + try(var q=c.prepareStatement("UPDATE sys_menu SET order_num=6 WHERE menu_id=? AND path='/file-ingestion'")){q.setLong(1,1761490000000000090L);q.executeUpdate();} + // Grant only to roles already allowed to manage batch ingestion. + try(var q=c.prepareStatement("SELECT DISTINCT r.role_id FROM sys_role_menu r JOIN sys_menu m ON r.menu_id=m.menu_id WHERE m.perms='aixun:dataops:batch-ingestion:submit'");var rs=q.executeQuery()) { + List roles=new ArrayList<>();while(rs.next())roles.add(rs.getLong(1)); + for(long role:roles)for(long id:new long[]{menu,manage})try(var w=c.prepareStatement("INSERT INTO sys_role_menu(role_id,menu_id) SELECT ?,? FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM sys_role_menu WHERE role_id=? AND menu_id=?)")) { + w.setLong(1,role);w.setLong(2,id);w.setLong(3,role);w.setLong(4,id);w.executeUpdate(); + } + } + c.commit(); + } + try(var q=c.prepareStatement("SELECT menu_name,path,order_num FROM sys_menu WHERE menu_id IN (?,?) ORDER BY menu_id")) { + q.setLong(1,menu);q.setLong(2,manage);try(var rs=q.executeQuery()){int n=0;while(rs.next()){n++;System.out.println(rs.getString(1)+" "+rs.getString(2)+" order="+rs.getInt(3));}if(n!=2)throw new IllegalStateException("Menu installation incomplete");} + } + } + } + static void insert(Connection c,long id,long parent,String name,String path,String component,String type,String perm,int order)throws Exception { + try(var q=c.prepareStatement("SELECT path,perms FROM sys_menu WHERE menu_id=?")){q.setLong(1,id);try(var rs=q.executeQuery()){if(rs.next()){if(!path.equals(rs.getString(1))||!perm.equals(rs.getString(2)))throw new IllegalStateException("Menu identity conflict");return;}}} + try(var q=c.prepareStatement("INSERT INTO sys_menu(menu_id,menu_name,parent_id,order_num,path,component,is_frame,is_cache,menu_type,visible,status,perms,icon,create_time) VALUES(?,?,?,?,?,?,'N','N',?,'0','0',?,'link',CURRENT_TIMESTAMP)")) { + q.setLong(1,id);q.setString(2,name);q.setLong(3,parent);q.setInt(4,order);q.setString(5,path);q.setString(6,component);q.setString(7,type);q.setString(8,perm);q.executeUpdate(); + } + } +} diff --git a/script/database/apply-dameng-schema.py b/script/database/apply-dameng-schema.py index 9cd980b..97056eb 100644 --- a/script/database/apply-dameng-schema.py +++ b/script/database/apply-dameng-schema.py @@ -16,6 +16,7 @@ ROOT = Path(__file__).resolve().parents[2] def main(): parser=argparse.ArgumentParser(description=__doc__) parser.add_argument("--config",required=True,type=Path) + parser.add_argument("--schema-file",type=Path,default=ROOT / "db/dameng/schema.sql") mode=parser.add_mutually_exclusive_group() mode.add_argument("--apply",action="store_true") mode.add_argument("--verify",action="store_true") @@ -32,7 +33,12 @@ def main(): environment["DATAGOV_DM_"+key.upper()]=str(values[key]) if not re.fullmatch(r"[A-Za-z0-9.-]+",str(values['host'])) or not 1<=int(values['port'])<=65535: parser.error("invalid private endpoint") - source=(ROOT / "db/dameng/schema.sql").read_text() + schema_file=args.schema_file.resolve() + if not schema_file.is_relative_to(ROOT / "db/dameng"): + parser.error("schema file must be under db/dameng") + source=schema_file.read_text() + if schema_file == ROOT / "db/dameng/schema.sql": + source += "\n" + (ROOT / "db/dameng/realtime.sql").read_text() rows=[] for part in source.split("-- @statement ")[1:]: label,sql=part.split("\n",1) diff --git a/script/database/apply-realtime-menu.py b/script/database/apply-realtime-menu.py new file mode 100644 index 0000000..f6ca712 --- /dev/null +++ b/script/database/apply-realtime-menu.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +"""Install or read back the dedicated real-time ingestion menus.""" +import argparse,json,os,stat,subprocess +from pathlib import Path +ROOT=Path(__file__).resolve().parents[2] +p=argparse.ArgumentParser(description=__doc__) +p.add_argument('--config',required=True,type=Path) +p.add_argument('--apply',action='store_true') +a=p.parse_args();f=a.config.resolve() +if not f.is_relative_to(ROOT/'runtime/dev-private') or stat.S_IMODE(f.stat().st_mode)&0o077:p.error('private configuration required') +values=json.loads(f.read_text());env=os.environ.copy() +for k in ('host','port','username','password','schema'):env['DATAGOV_DM_'+k.upper()]=str(values[k]) +raise SystemExit(subprocess.run(['java','--class-path',str(ROOT/'script/datagov/m2/seatunnel/local/artifacts/DmJdbcDriver18-8.1.3.62.jar'),str(ROOT/'script/database/RealtimeMenu.java'),*(['--apply'] if a.apply else [])],env=env).returncode) diff --git a/script/datagov/cdc/dmhs-ogg-json.example.ini b/script/datagov/cdc/dmhs-ogg-json.example.ini new file mode 100644 index 0000000..e85bfa9 --- /dev/null +++ b/script/datagov/cdc/dmhs-ogg-json.example.ini @@ -0,0 +1,15 @@ +# For DMHS releases supporting per-operation JSON_FORMAT_INS/UPD/DEL templates. +# Check against the installed DMHS release before use. Exactly one source table per topic. +# Enable complete before/after images at the source; do not deploy a partial-update stream. +BATCH_COMMIT = 1 +NEED_CRLF = 0 +SET_NULL = 1 +SET_QUOTA = 0 +NEW_VALUES = ALL +SET_ROWID_COL = 0 +LOB_PIECE = 0 +CLOB_FORMAT = CHAR +CHAR_REPLACE =(",\"),(\,\\) +JSON_FORMAT_INS = {"table":"#SCHEMA.#TABLE","op_type":"I","before":null,"after":{#NEW_VALUES}} +JSON_FORMAT_UPD = {"table":"#SCHEMA.#TABLE","op_type":"U","before":{#OLD_VALUES},"after":{#NEW_VALUES}} +JSON_FORMAT_DEL = {"table":"#SCHEMA.#TABLE","op_type":"D","before":{#OLD_VALUES},"after":null} diff --git a/script/datagov/cdc/relay-channels.example.yml b/script/datagov/cdc/relay-channels.example.yml new file mode 100644 index 0000000..dfe1386 --- /dev/null +++ b/script/datagov/cdc/relay-channels.example.yml @@ -0,0 +1,47 @@ +# Merge into the operator-managed Integration configuration (for example its Nacos YAML). +# Disabled examples only. Do not put passwords here; use the existing managed secretRef. +datagov: + realtime-relays: + channels: + dm-orders: + enabled: false + name: 达梦订单 DMHS + org-id: 0 + source-id: 0 + schema: APP + table: ORDERS + bootstrap-servers: kafka.example.invalid:9092 + topic: dm.app.orders + format: ogg_json + security-protocol: SASL_SSL + mechanism: SCRAM-SHA-256 + username: cdc_consumer + secret-ref: secret:cdc/kafka-consumer + kingbase-orders: + enabled: false + name: 金仓订单 FlySync + org-id: 0 + source-id: 0 + schema: public + table: orders + bootstrap-servers: kafka.example.invalid:9092 + topic: kingbase.public.orders + format: ogg_json + security-protocol: SASL_SSL + mechanism: SCRAM-SHA-256 + username: cdc_consumer + secret-ref: secret:cdc/kafka-consumer + oracle-pdb-orders: + enabled: false + name: Oracle PDB 订单 Debezium + org-id: 0 + source-id: 0 + schema: APP + table: ORDERS + bootstrap-servers: kafka.example.invalid:9092 + topic: oracle.APP.ORDERS + format: debezium_json + security-protocol: SASL_SSL + mechanism: SCRAM-SHA-256 + username: cdc_consumer + secret-ref: secret:cdc/kafka-consumer diff --git a/script/datagov/deploy-seatunnel-cdc.py b/script/datagov/deploy-seatunnel-cdc.py new file mode 100644 index 0000000..a911178 --- /dev/null +++ b/script/datagov/deploy-seatunnel-cdc.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Plan/apply the CDC SeaTunnel image using the existing dedicated Compose service.""" +import argparse,fcntl,hashlib,json,subprocess,time +from pathlib import Path +ROOT=Path(__file__).resolve().parents[2] +NAME='aixun-datagov-m2-seatunnel' +IMAGE='aixun-datagov/seatunnel:2.3.13-cdc-20261120-r2' +def run(args,body=None): + p=subprocess.run(args,cwd=ROOT,input=body,capture_output=True,text=True,timeout=120) + if p.returncode:raise RuntimeError('command failed: '+args[0]+' (output withheld)') + return p.stdout +def inspect(*args):return json.loads(run(['docker',*args]))[0] +def digest(v):return hashlib.sha256(json.dumps(v,sort_keys=True).encode()).hexdigest() +def differences(a,b,path=''): + if isinstance(a,dict) and isinstance(b,dict): + return [p for k in sorted(a.keys()|b.keys()) for p in differences(a.get(k),b.get(k),path+'/'+k)] + return [] if a==b else [path] +def identity(c): + cfg=dict(c['Config']);cfg.pop('Image',None) + cfg['Labels']={k:v for k,v in cfg.get('Labels',{}).items() if not k.startswith('com.docker.compose.')} + host=dict(c['HostConfig']);host.pop('NetworkMode',None) + if host.get('Binds'):host['Binds']=sorted(host['Binds']) + if host.get('Mounts'):host['Mounts']=sorted(host['Mounts'],key=lambda m:m.get('Target','')) + return {'config':cfg,'host':host, + 'networks':{k:(v['NetworkID'],v['IPAddress'],sorted(v.get('Aliases') or [])) for k,v in c['NetworkSettings']['Networks'].items()}, + 'mounts':sorted((m['Type'],m.get('Name',m['Source']),m['Destination'],m['RW']) for m in c['Mounts'])} +def escape(v): + if isinstance(v,str):return v.replace('$','$$') + if isinstance(v,list):return [escape(x) for x in v] + if isinstance(v,dict):return {k:escape(x) for k,x in v.items()} + return v +def main(): + p=argparse.ArgumentParser(description=__doc__);p.add_argument('--apply',action='store_true') + p.add_argument('--image',default=IMAGE);a=p.parse_args() + if not a.image.startswith('aixun-datagov/seatunnel:') or a.image.endswith(':latest'): + raise RuntimeError('explicit project image tag required') + state=ROOT/'.cache/datagov';state.mkdir(parents=True,exist_ok=True) + with open(state/'seatunnel-cdc.lock','w') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + old=inspect('inspect',NAME);new=inspect('image','inspect',a.image) + labels=old['Config']['Labels'] + if labels.get('com.docker.compose.project')!='aixun-datagov-local' or labels.get('com.aixun.project')!='aixun-datagov':raise RuntimeError('foreign container') + model=json.loads(run(['docker','compose','--env-file','script/datagov/.env.datagov','--project-directory','script/datagov','-p','aixun-datagov-local','-f','script/datagov/docker-compose.local.yml','-f','script/datagov/m2/docker-compose.yml','config','--format','json'])) + service=model['services']['m2-seatunnel'];service.pop('build',None);service.pop('depends_on',None) + # Compose config preserves shell dollar escaping; normalize before serializing the stdin model. + service['healthcheck']['test']=[v.replace('$$','$') for v in service['healthcheck']['test']] + service['image']=a.image;model['services']={'m2-seatunnel':service} + for k,n in model['networks'].items(): + model['networks'][k]={'name':n['name'],'external':True} + if k in service['networks']: + live=old['NetworkSettings']['Networks'][n['name']] + service['networks'][k]={'ipv4_address':live['IPAddress']} + for k,v in model.get('volumes',{}).items():model['volumes'][k]={'name':v['name'],'external':True} + plan={'sourceContainer':old['Id'],'sourceImage':old['Image'],'targetImage':new['Id'],'identity':digest(identity(old)),'model':digest(model)} + file=state/'seatunnel-cdc-plan.json' + if not a.apply:file.write_text(json.dumps(plan,indent=2));print('PLAN_ONLY');return + if json.loads(file.read_text())!=plan:raise RuntimeError('plan changed; replan required') + for endpoint in ('running-jobs','pending-jobs'): + raw=run(['docker','exec',NAME,'sh','-c','curl -fsS -u "$(cat /run/secrets/seatunnel_username):$(cat /run/secrets/seatunnel_password)" http://127.0.0.1:8080/'+endpoint]) + data=json.loads(raw) + if endpoint=='pending-jobs' and isinstance(data,dict):data=data.get('pendingJobs') + if not isinstance(data,list) or data:raise RuntimeError('active or unknown jobs; replacement refused') + command=['docker','compose','--project-directory','script/datagov','-p','aixun-datagov-local','-f','-','up','-d','--no-deps','--no-build','--pull','never','m2-seatunnel'] + try: + run(command,json.dumps(escape(model))) + for _ in range(45): + current=inspect('inspect',NAME) + if current['State'].get('Health',{}).get('Status')=='healthy':break + time.sleep(2) + else:raise RuntimeError('health timeout') + if identity(old)!=identity(current):raise RuntimeError('non-image configuration drift: '+','.join(differences(identity(old),identity(current)))) + print('DEPLOYED image='+new['Id']+' recovery='+old['Image']+' configuration=PASS') + except Exception: + service['image']=old['Config']['Image'];run(command,json.dumps(escape(model)));raise +if __name__=='__main__': + try:main() + except Exception as e:raise SystemExit(str(e)) diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-dataops-attempt.json b/script/datagov/deployment/releases/cdc-complete-20261123-dataops-attempt.json new file mode 100644 index 0000000..5832bbc --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "14e4d188e83d665490bb3f13e21cbd59a776adc68a7abb8f63e1f4042d5e1293", + "imageId": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8865\u9f50\u8de8\u91cd\u542f\u6062\u590d\u53ca\u8fbe\u68a6\u91d1\u4ed3Oracle CDC", + "startedAt": 1795416057.468302 +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-dataops-result.json b/script/datagov/deployment/releases/cdc-complete-20261123-dataops-result.json new file mode 100644 index 0000000..b0d1f75 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "e2475e5761fc285586a1c546079117e401040ace0dedd6d5ffc872656fe778eb", + "imageId": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5" +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-dataops.json b/script/datagov/deployment/releases/cdc-complete-20261123-dataops.json new file mode 100644 index 0000000..4090493 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "cdc-complete-20261123", + "imageTag": "aixun-datagov/dataops:cdc-complete-20261123", + "imageId": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c", + "artifactSha256": "fc90bce4b614fa0430b9fd29b2c29948a2578af5f3c62198df37a9b616c4237e", + "sourceContainerId": "14e4d188e83d665490bb3f13e21cbd59a776adc68a7abb8f63e1f4042d5e1293", + "sourceImageId": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5", + "sourceImageTag": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5", + "sourceStateSha256": "3c6f54ffc217d29dba7d8ce0a6f7f692a7e92ebabc2578ba6ee0b1fcdc42b4b3", + "modelSha256": "99806f67b956e893612e3a1bfdbb0ec514b67e23a87308092fae49be93d74646", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-frontend-attempt.json b/script/datagov/deployment/releases/cdc-complete-20261123-frontend-attempt.json new file mode 100644 index 0000000..fb18602 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "f35ce2466da8b4036712be6d198a729cbb15c030ce5285b43b52d38a2e9f7afe", + "imageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8865\u9f50\u8de8\u91cd\u542f\u6062\u590d\u53ca\u8fbe\u68a6\u91d1\u4ed3Oracle CDC", + "startedAt": 1795416085.521677 +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-frontend-result.json b/script/datagov/deployment/releases/cdc-complete-20261123-frontend-result.json new file mode 100644 index 0000000..741d962 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "8f4a75395b4accf5248882adaa2fead027fa65121349ed2e0e7a9ff93b9f0f5e", + "imageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483" +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-frontend.json b/script/datagov/deployment/releases/cdc-complete-20261123-frontend.json new file mode 100644 index 0000000..3ebd704 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "cdc-complete-20261123", + "imageTag": "aixun-datagov/frontend:cdc-complete-20261123", + "imageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "artifactSha256": "916e10e53deaadf80312f49c92c156b2dfab39fe9c79f981853c6f05640333b4", + "sourceContainerId": "f35ce2466da8b4036712be6d198a729cbb15c030ce5285b43b52d38a2e9f7afe", + "sourceImageId": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483", + "sourceImageTag": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483", + "sourceStateSha256": "068dec94d2885ab977f821a05c4f61b16c20595e58562f94eb08fbe05c2cc7a4", + "modelSha256": "d5ef1d9b39df0ab2f94b54a6138c4fc52400a0e91c27b49e4e7bffddd6eac9c8", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/cdc-complete-20261123-integration.json b/script/datagov/deployment/releases/cdc-complete-20261123-integration.json new file mode 100644 index 0000000..3d8c9fc --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "cdc-complete-20261123", + "imageTag": "aixun-datagov/integration:cdc-complete-20261123", + "imageId": "sha256:12b9884b30d077e2d40cf65c372c9baa74b836daf668dbb40476937d567cf7b8", + "artifactSha256": "c1fc846bc94cc399dfadd443237d9742d99f7a163f8c11fa4cf7ada5aec68e15", + "sourceContainerId": "f132de9edab56c856dc1be3fb5b26f49d8483b30bcae6d1a980f013957803381", + "sourceImageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "sourceImageTag": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "sourceStateSha256": "128ec6b1c4f9aaad6fd7800c8a9e4f5c7c44b7377bfe6df2dcd2a15f6c30a6fc", + "modelSha256": "a97e2cb7044965cb1d7d70fe47ce8368adf7c151053f6987ecf7d5029b3fc1a4", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-attempt.json b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-attempt.json new file mode 100644 index 0000000..0ce9dad --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "f132de9edab56c856dc1be3fb5b26f49d8483b30bcae6d1a980f013957803381", + "imageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8865\u9f50\u8de8\u91cd\u542f\u6062\u590d\u53ca\u8fbe\u68a6\u91d1\u4ed3Oracle CDC", + "startedAt": 1795416281.535261 +} diff --git a/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-result.json b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-result.json new file mode 100644 index 0000000..3d748e5 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "41d59eb8f208cc23820f71cacb2ffb2c6063725af11fd9f89f7df8d32abbc5e1", + "imageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404" +} diff --git a/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration.json b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration.json new file mode 100644 index 0000000..78c3ac9 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-complete-r2-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "cdc-complete-r2-20261123", + "imageTag": "aixun-datagov/integration:cdc-complete-20261123", + "imageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "artifactSha256": "ee1bc4b8a4f2b4c0c2028db046dadd747ccad32dc27a70882546ff68ebdfbbd7", + "sourceContainerId": "f132de9edab56c856dc1be3fb5b26f49d8483b30bcae6d1a980f013957803381", + "sourceImageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "sourceImageTag": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "sourceStateSha256": "128ec6b1c4f9aaad6fd7800c8a9e4f5c7c44b7377bfe6df2dcd2a15f6c30a6fc", + "modelSha256": "b32f4eb2ddbaaff7e0fa8b0a795e802eb251923613a21c103c5f190ab3b6a566", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-attempt.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-attempt.json new file mode 100644 index 0000000..7c78203 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "7a88380015232b6b0017d78c9bb0cdc3146dd1d5c35201ed027cf7bbab3b95d5", + "imageId": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u786e\u8ba4\u505c\u6b62\u5e76\u66f4\u65b0\uff0c\u4fdd\u7559\u5df2\u786e\u8ba4\u7ec8\u6001\u548c\u68c0\u67e5\u70b9", + "startedAt": 1795413771.699936 +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-result.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-result.json new file mode 100644 index 0000000..ce32cec --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "14e4d188e83d665490bb3f13e21cbd59a776adc68a7abb8f63e1f4042d5e1293", + "imageId": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04" +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops.json new file mode 100644 index 0000000..dbe981c --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "cdc-stop-fix-20261123", + "imageTag": "aixun-datagov/dataops:cdc-stop-fix-20261123", + "imageId": "sha256:e4d22cd906882f1c38035be42903c42ebcbbcb1df6bb2786605e87b1005834c5", + "artifactSha256": "6c112da78a79cb88b75684308da11a41c34bed5ad07aa341596f15d9bc7b9b34", + "sourceContainerId": "7a88380015232b6b0017d78c9bb0cdc3146dd1d5c35201ed027cf7bbab3b95d5", + "sourceImageId": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04", + "sourceImageTag": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04", + "sourceStateSha256": "c25fd42a1ba82564be22014c7f30075749cf45911ce4b637c9eb4f8bbc61d4ab", + "modelSha256": "b2d4ad491872390aed2f6df150d83e6040b3c22ec93dd5e84cf8a3eb51657753", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-attempt.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-attempt.json new file mode 100644 index 0000000..d76dd32 --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "643259d45703b97a429fd57c98823ae1cd6ddf5453aba45a83fa34b3fa7b1b20", + "imageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u786e\u8ba4MySQL\u505c\u6b62\u72b6\u6001\u5e76\u4fee\u590d\uff0c\u505c\u6b62\u540e\u66f4\u65b0CDC\u63d2\u4ef6", + "startedAt": 1795413446.265734 +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-result.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-result.json new file mode 100644 index 0000000..d9f053d --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "f132de9edab56c856dc1be3fb5b26f49d8483b30bcae6d1a980f013957803381", + "imageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9" +} diff --git a/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration.json b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration.json new file mode 100644 index 0000000..f2addef --- /dev/null +++ b/script/datagov/deployment/releases/cdc-stop-fix-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "cdc-stop-fix-20261123", + "imageTag": "aixun-datagov/integration:cdc-stop-fix-20261123", + "imageId": "sha256:e15a5aa2aa1d2e62bb23d7119a7e1ca255566fe928cc6fc6d6c792437d1cb404", + "artifactSha256": "69eb8ad50a20fd9b10875c65d1ef66217ee52b28dd4ba976f0657478b8e45bfe", + "sourceContainerId": "643259d45703b97a429fd57c98823ae1cd6ddf5453aba45a83fa34b3fa7b1b20", + "sourceImageId": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9", + "sourceImageTag": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9", + "sourceStateSha256": "6837e15efffc16b0a4e36466a90961f871b76d020a7b08ea743cca2046fa081a", + "modelSha256": "fb289a0c698efa32a6b9d21d1e7baaad9302cb5bbacdd2b943692e260502d029", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/dameng-window-20261124-frontend-attempt.json b/script/datagov/deployment/releases/dameng-window-20261124-frontend-attempt.json new file mode 100644 index 0000000..6ab643b --- /dev/null +++ b/script/datagov/deployment/releases/dameng-window-20261124-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "e3e1e3602de42c892880ced649402d171e65c26f7d22bea37244a63409793eaa", + "imageId": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053", + "authorizedBy": "\u7528\u6237\uff1a\u6309\u7167\u4f60\u89c9\u5f97\u7684\u6b63\u786e\u505a\u6cd5\u5904\u7406\u4e00\u4e0b\u8be5\u95ee\u9898\uff1b\u66f4\u65b0\u5f52\u6863\u7a97\u53e3\u53ca\u9875\u9762\u63d0\u793a", + "startedAt": 1795486488.70925 +} diff --git a/script/datagov/deployment/releases/dameng-window-20261124-frontend-result.json b/script/datagov/deployment/releases/dameng-window-20261124-frontend-result.json new file mode 100644 index 0000000..c87fa1d --- /dev/null +++ b/script/datagov/deployment/releases/dameng-window-20261124-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "2c02a6bfbb8901557232257a9038f48c712ad0565e06c40acedc47ace6bacd9f", + "imageId": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61" +} diff --git a/script/datagov/deployment/releases/dameng-window-20261124-frontend.json b/script/datagov/deployment/releases/dameng-window-20261124-frontend.json new file mode 100644 index 0000000..b86687b --- /dev/null +++ b/script/datagov/deployment/releases/dameng-window-20261124-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "dameng-window-20261124", + "imageTag": "aixun-datagov/frontend:dameng-window-20261124", + "imageId": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053", + "artifactSha256": "dde266e79ab27ec772ac18d80b18402301f3fdfada70fd1f68b88615b6d9234f", + "sourceContainerId": "e3e1e3602de42c892880ced649402d171e65c26f7d22bea37244a63409793eaa", + "sourceImageId": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61", + "sourceImageTag": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61", + "sourceStateSha256": "7dbc723b79a71b84dbb8987a8478b85e2d7adb5b0f964f52fbcfd8040c6d2982", + "modelSha256": "76fe3cc2476e170b7f2e1e9697aaf7ac1efd3d57bf063b92b5f117f87b49e46d", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-dataops-attempt.json b/script/datagov/deployment/releases/multi-cdc-20261123-dataops-attempt.json new file mode 100644 index 0000000..a86487f --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "a872770648988be4a23608b87e91ed0ea8b0057df5b775fb18eceaa10f374540", + "imageId": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u8fbe\u68a6\u3001\u4eba\u5927\u91d1\u4ed3\u3001Oracle\u3001SQL Server CDC\uff0c\u7531\u7528\u6237\u81ea\u884c\u8054\u8c03", + "startedAt": 1795406249.5222132 +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-dataops-result.json b/script/datagov/deployment/releases/multi-cdc-20261123-dataops-result.json new file mode 100644 index 0000000..41c1d78 --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "7a88380015232b6b0017d78c9bb0cdc3146dd1d5c35201ed027cf7bbab3b95d5", + "imageId": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-dataops.json b/script/datagov/deployment/releases/multi-cdc-20261123-dataops.json new file mode 100644 index 0000000..e22664e --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "multi-cdc-20261123", + "imageTag": "aixun-datagov/dataops:multi-cdc-20261123", + "imageId": "sha256:404e10be1e3e29f867d3244436be5a089eca42e76acea2fb70e3e651aefb2a04", + "artifactSha256": "65537e979174bddb8874399a35837b4a46d9ce30ab1c877a2e29f0257723a5e8", + "sourceContainerId": "a872770648988be4a23608b87e91ed0ea8b0057df5b775fb18eceaa10f374540", + "sourceImageId": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36", + "sourceImageTag": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36", + "sourceStateSha256": "a6811f24664254125aea9a05ff10654a706ea860345efe6337a06f0fed5db78f", + "modelSha256": "9ab6786a173b8fc9dd38afe86879d1fb5d1ece6f0e23987aad3ebbae30cf3d24", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-frontend-attempt.json b/script/datagov/deployment/releases/multi-cdc-20261123-frontend-attempt.json new file mode 100644 index 0000000..1d4a949 --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "f7f1b27e0c50f34766cc0dbfea062bc1385dae342d08e44174dbfccee8fdbf41", + "imageId": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u8fbe\u68a6\u3001\u4eba\u5927\u91d1\u4ed3\u3001Oracle\u3001SQL Server CDC\uff0c\u7531\u7528\u6237\u81ea\u884c\u8054\u8c03", + "startedAt": 1795406283.085571 +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-frontend-result.json b/script/datagov/deployment/releases/multi-cdc-20261123-frontend-result.json new file mode 100644 index 0000000..3ec2d95 --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "f35ce2466da8b4036712be6d198a729cbb15c030ce5285b43b52d38a2e9f7afe", + "imageId": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-frontend.json b/script/datagov/deployment/releases/multi-cdc-20261123-frontend.json new file mode 100644 index 0000000..023756d --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "multi-cdc-20261123", + "imageTag": "aixun-datagov/frontend:multi-cdc-20261123", + "imageId": "sha256:cba94c47cce3d644ece550645913acd6e5858865570c9e85e16c8c5cf940e483", + "artifactSha256": "d7fff5d584a7776849136da44af0482ea89d8323e0752f27765f7164109b98ef", + "sourceContainerId": "f7f1b27e0c50f34766cc0dbfea062bc1385dae342d08e44174dbfccee8fdbf41", + "sourceImageId": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3", + "sourceImageTag": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3", + "sourceStateSha256": "1c3d919bca389877004d31c172de5e9ed4c9b5fe4d174d71e6e2f53639216b23", + "modelSha256": "50d405775222d0fc3740348c201bfe6760af2974eac2d5b70d2b2bb4953429d2", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-integration-attempt.json b/script/datagov/deployment/releases/multi-cdc-20261123-integration-attempt.json new file mode 100644 index 0000000..c1892ac --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "41c6ed046664b0adb6b620b1f6fe992d108fc67fb813373ae45553981e69d299", + "imageId": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u8fbe\u68a6\u3001\u4eba\u5927\u91d1\u4ed3\u3001Oracle\u3001SQL Server CDC\uff0c\u7531\u7528\u6237\u81ea\u884c\u8054\u8c03", + "startedAt": 1795406216.518379 +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-integration-result.json b/script/datagov/deployment/releases/multi-cdc-20261123-integration-result.json new file mode 100644 index 0000000..b975b85 --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "643259d45703b97a429fd57c98823ae1cd6ddf5453aba45a83fa34b3fa7b1b20", + "imageId": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f" +} diff --git a/script/datagov/deployment/releases/multi-cdc-20261123-integration.json b/script/datagov/deployment/releases/multi-cdc-20261123-integration.json new file mode 100644 index 0000000..32c1b12 --- /dev/null +++ b/script/datagov/deployment/releases/multi-cdc-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "multi-cdc-20261123", + "imageTag": "aixun-datagov/integration:multi-cdc-20261123", + "imageId": "sha256:aa8cf799c90e837b7f447fe76d206f533bcf9e68d234b38e2d228b6c4021cbf9", + "artifactSha256": "d08d0a15420ec149d4d50a7bfcb88b1562b9a1fcd4d83c0be8fbe2d8a9f67ebf", + "sourceContainerId": "41c6ed046664b0adb6b620b1f6fe992d108fc67fb813373ae45553981e69d299", + "sourceImageId": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f", + "sourceImageTag": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f", + "sourceStateSha256": "f1495165cf747fc81cd02c863969f0d79d71ece3153a3f0fafa03bd464596e93", + "modelSha256": "99101a9eae0b7679273d23f337bc7709b013d92ee8818b4e9c469fcdfd2e7594", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/native-discovery-20261124-integration-attempt.json b/script/datagov/deployment/releases/native-discovery-20261124-integration-attempt.json new file mode 100644 index 0000000..982a2ff --- /dev/null +++ b/script/datagov/deployment/releases/native-discovery-20261124-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "6eb290fb3bde2e60badf7a08e728242af7db5a9fda581bc0be61feb675e76ed6", + "imageId": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u5b9a\u4f4d\u5e76\u4fee\u590d\u5b9e\u65f6\u91c7\u96c6\u542f\u52a8\u540e\u6301\u7eed\u5f85\u786e\u8ba4\u95ee\u9898", + "startedAt": 1795482938.895882 +} diff --git a/script/datagov/deployment/releases/native-discovery-20261124-integration-result.json b/script/datagov/deployment/releases/native-discovery-20261124-integration-result.json new file mode 100644 index 0000000..c27b338 --- /dev/null +++ b/script/datagov/deployment/releases/native-discovery-20261124-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "24dc294c1e9653f0b7cc884849134def5c0ab0c16901ca236d2ba26be475da72", + "imageId": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482" +} diff --git a/script/datagov/deployment/releases/native-discovery-20261124-integration.json b/script/datagov/deployment/releases/native-discovery-20261124-integration.json new file mode 100644 index 0000000..e7cc6ba --- /dev/null +++ b/script/datagov/deployment/releases/native-discovery-20261124-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "native-discovery-20261124", + "imageTag": "aixun-datagov/integration:native-discovery-20261124", + "imageId": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a", + "artifactSha256": "cc1a1dcac5124d6082eb9c76a36de7a1071a277f9911dd1c890d5433e9b14f97", + "sourceContainerId": "6eb290fb3bde2e60badf7a08e728242af7db5a9fda581bc0be61feb675e76ed6", + "sourceImageId": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482", + "sourceImageTag": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482", + "sourceStateSha256": "c7f8f927e83ae342c8c8d6d557a0513cb7fb1c62300abd9aa96dbd0c5f4bb9b9", + "modelSha256": "4c52099ee8a36bbb6b0b7b5d412316078e694d6c64e572f16468647695471148", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-attempt.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-attempt.json new file mode 100644 index 0000000..18e22e3 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "e2475e5761fc285586a1c546079117e401040ace0dedd6d5ffc872656fe778eb", + "imageId": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u7ee7\u7eed\u8865\u9f50\u8fbe\u68a6\u548c\u91d1\u4ed3\u529f\u80fd\u5e76\u4f7f\u9875\u9762\u53ef\u6d4b\u8bd5", + "startedAt": 1795427001.7653399 +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-result.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-result.json new file mode 100644 index 0000000..8b5145a --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "a9e999427e33fec647fc374e5421793fb1bb1c13690b9c7684aa91e9d2098d99", + "imageId": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops.json new file mode 100644 index 0000000..98bea5a --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "native-vendor-cdc-20261123", + "imageTag": "aixun-datagov/dataops:native-vendor-cdc-20261123", + "imageId": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376", + "artifactSha256": "10c00620c63d0837c602eb5ed422045087904ae479da48cfae188f0544b67e64", + "sourceContainerId": "e2475e5761fc285586a1c546079117e401040ace0dedd6d5ffc872656fe778eb", + "sourceImageId": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c", + "sourceImageTag": "sha256:a85f41c94e4762429dfac257dd10e071f49dd2c6cacafaaaf1f7bd0f0675d01c", + "sourceStateSha256": "778ea8313491a8dce98fbf6b05799d97c71ba713538f7c0eecafa81a43a36f4e", + "modelSha256": "4151a91988d7d0ce38cf45057d232ac00486329c0cb48f519fb7e449f5d2745b", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-integration.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-integration.json new file mode 100644 index 0000000..0253984 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "native-vendor-cdc-20261123", + "imageTag": "aixun-datagov/integration:native-vendor-cdc-20261123", + "imageId": "sha256:abae19a9857c4425b56a95652084e3cee60f16c706c4da394f80a15838ab1ff7", + "artifactSha256": "6c11ad1ddb81dbbcb71faff487aeaf05bb649c382b1558cff76465f5680ecf81", + "sourceContainerId": "41d59eb8f208cc23820f71cacb2ffb2c6063725af11fd9f89f7df8d32abbc5e1", + "sourceImageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "sourceImageTag": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "sourceStateSha256": "299667c709cf1b98308237b0ec9f7aadb04d63425f69f76804ab07dfc34beaa0", + "modelSha256": "bbb607b41db8eec489fc1cc532083ffefe0ffe4928376e5b4f54287639b137c8", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r2-frontend.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r2-frontend.json new file mode 100644 index 0000000..1a8397e --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r2-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "native-vendor-cdc-20261123-r2", + "imageTag": "aixun-datagov/frontend:native-vendor-cdc-20261123-r2", + "imageId": "sha256:c7cf4ef38ac986057f46efa27f94868395f0a36032022a3897272420403923ce", + "artifactSha256": "bb0f0863418ce8c5f488ce66b7f2083deef5e04c4f8be6bd47f322add5e7b653", + "sourceContainerId": "8f4a75395b4accf5248882adaa2fead027fa65121349ed2e0e7a9ff93b9f0f5e", + "sourceImageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "sourceImageTag": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "sourceStateSha256": "f32052265b1bd37cee4e6821d59aeacacda4a7658675e15500468bc7b0c2742f", + "modelSha256": "d0deda7c045f0ab5c511ab34f0c5257cce8663c1ca8bd1ed7b8c6f20ec53c4d8", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-attempt.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-attempt.json new file mode 100644 index 0000000..68d7595 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "8f4a75395b4accf5248882adaa2fead027fa65121349ed2e0e7a9ff93b9f0f5e", + "imageId": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u7ee7\u7eed\u8865\u9f50\u8fbe\u68a6\u548c\u91d1\u4ed3\u529f\u80fd\u5e76\u4f7f\u9875\u9762\u53ef\u6d4b\u8bd5", + "startedAt": 1795427431.3588018 +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-result.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-result.json new file mode 100644 index 0000000..be2eb73 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "2a341ae7c8bd0651f982471a7e8f21b34e7035807862f362d783d51a8b865c16", + "imageId": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend.json new file mode 100644 index 0000000..94ea666 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "native-vendor-cdc-20261123-r3", + "imageTag": "aixun-datagov/frontend:native-vendor-cdc-20261123-r3", + "imageId": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2", + "artifactSha256": "7f5ce3a90e6e4b610f5f04c4a7417bedfadaf1bb427fbb6eb2090cbd848b1584", + "sourceContainerId": "8f4a75395b4accf5248882adaa2fead027fa65121349ed2e0e7a9ff93b9f0f5e", + "sourceImageId": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "sourceImageTag": "sha256:fed48622ed22ad683671ee90f0fac4bdf756b0379da15da2d91ce8108afbb40c", + "sourceStateSha256": "f32052265b1bd37cee4e6821d59aeacacda4a7658675e15500468bc7b0c2742f", + "modelSha256": "0e59a276a47185b8774856f50d20da87bba48dddb768e45e68661b647646fe5b", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-attempt.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-attempt.json new file mode 100644 index 0000000..c72fd68 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "41d59eb8f208cc23820f71cacb2ffb2c6063725af11fd9f89f7df8d32abbc5e1", + "imageId": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u7ee7\u7eed\u8865\u9f50\u8fbe\u68a6\u548c\u91d1\u4ed3\u529f\u80fd\u5e76\u4f7f\u9875\u9762\u53ef\u6d4b\u8bd5", + "startedAt": 1795427405.01483 +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-result.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-result.json new file mode 100644 index 0000000..c69357b --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "6eb290fb3bde2e60badf7a08e728242af7db5a9fda581bc0be61feb675e76ed6", + "imageId": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2" +} diff --git a/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration.json b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration.json new file mode 100644 index 0000000..253aa97 --- /dev/null +++ b/script/datagov/deployment/releases/native-vendor-cdc-20261123-r3-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "native-vendor-cdc-20261123-r3", + "imageTag": "aixun-datagov/integration:native-vendor-cdc-20261123-r3", + "imageId": "sha256:36520937a13b99882ffa961d3c7a4459496be9fca9fd64619d5d5b7fc0687482", + "artifactSha256": "5466426e1abd1054c3a9cf76a18fa4e8b35aa9baf3d0e92bb5380581cbc3b8f9", + "sourceContainerId": "41d59eb8f208cc23820f71cacb2ffb2c6063725af11fd9f89f7df8d32abbc5e1", + "sourceImageId": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "sourceImageTag": "sha256:c3e40cd9f6d716ee059f2ec7601ab2a73b13b491d940ba88eb3d6b277d8462c2", + "sourceStateSha256": "299667c709cf1b98308237b0ec9f7aadb04d63425f69f76804ab07dfc34beaa0", + "modelSha256": "297ad1a01f8340da02e42db7c08ed82ba755601b1d119afa0274bc2fbbaa5955", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-attempt.json b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-attempt.json new file mode 100644 index 0000000..f208bca --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "4748c30d4fbd8b578c400db1881140e322a0275d07e731fa5b8b7a9d0b183035", + "imageId": "sha256:45c1d8bebe6671a350ea93040c6e2fc0b87891fcf6186e495aea01ddd02c9891", + "authorizedBy": "\u7528\u6237\u6388\u6743\u8865\u5168Oracle-CDC\u63d2\u4ef6CDB/PDB\u80fd\u529b", + "startedAt": 1795488573.663769 +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-result.json b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-result.json new file mode 100644 index 0000000..9eef023 --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "af0c483cbbf96e90a5bfb363c6f033659c113cac87725f050f2fabf679ccae15", + "imageId": "sha256:45c1d8bebe6671a350ea93040c6e2fc0b87891fcf6186e495aea01ddd02c9891", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-dataops.json b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops.json new file mode 100644 index 0000000..1881a7a --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "oracle-pdb-20261124", + "imageTag": "aixun-datagov/dataops:oracle-pdb-20261124", + "imageId": "sha256:45c1d8bebe6671a350ea93040c6e2fc0b87891fcf6186e495aea01ddd02c9891", + "artifactSha256": "7b4786fdf4ea160b55b7955851f63048608eeb4e8f9b9e0e952970d280ae43d4", + "sourceContainerId": "4748c30d4fbd8b578c400db1881140e322a0275d07e731fa5b8b7a9d0b183035", + "sourceImageId": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908", + "sourceImageTag": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908", + "sourceStateSha256": "193e4cf253d60c71fecd76c90455829dfcf52adffb9cbf23fdf41fa424076677", + "modelSha256": "5de0303a33b0cf1b42b66afdddc2ec56becfad8d3e642e41129c43cdb903196b", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-attempt.json b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-attempt.json new file mode 100644 index 0000000..83bd249 --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "2c02a6bfbb8901557232257a9038f48c712ad0565e06c40acedc47ace6bacd9f", + "imageId": "sha256:7ea0a8e61a38edfae7cc918aa13f2ace07e592215de77f2ae3ad4beba4278aa9", + "authorizedBy": "\u7528\u6237\u6388\u6743\u8865\u5168Oracle-CDC\u63d2\u4ef6CDB/PDB\u80fd\u529b", + "startedAt": 1795488603.1243992 +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-result.json b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-result.json new file mode 100644 index 0000000..23f16eb --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "d505520cc8bed1a5133c5cd15871e2aec0fb2d68de4c679383e0f97238f1aa5a", + "imageId": "sha256:7ea0a8e61a38edfae7cc918aa13f2ace07e592215de77f2ae3ad4beba4278aa9", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-frontend.json b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend.json new file mode 100644 index 0000000..d9bb3aa --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "oracle-pdb-20261124", + "imageTag": "aixun-datagov/frontend:oracle-pdb-20261124", + "imageId": "sha256:7ea0a8e61a38edfae7cc918aa13f2ace07e592215de77f2ae3ad4beba4278aa9", + "artifactSha256": "14f8eac0aa68ffd546b9436e5892980221ab80752d07db1c6cbbf2c94a03a174", + "sourceContainerId": "2c02a6bfbb8901557232257a9038f48c712ad0565e06c40acedc47ace6bacd9f", + "sourceImageId": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053", + "sourceImageTag": "sha256:5dea972c455acab98e62993ad22d6a7216e831a6635155c7d427f477abe04053", + "sourceStateSha256": "57a5a76b1f12389d4d40850f4cac81c9e0640da144ac3439d0425a2ebc3f8fdb", + "modelSha256": "000de3af9c9920acfef2f20f264539a5b0fe7b23f01d6db05dbba7d27b8f999a", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-integration-attempt.json b/script/datagov/deployment/releases/oracle-pdb-20261124-integration-attempt.json new file mode 100644 index 0000000..ba01cfe --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "4d8bac3f1aa5acf134cc4876c2e8dbad3e2aa523b8d42bf096542434da55aeac", + "imageId": "sha256:c94bec7bea27914e85aab5e9b87d4c781f3e8fb92a8610ca2234e1bdec986a4a", + "authorizedBy": "\u7528\u6237\u6388\u6743\u8865\u5168Oracle-CDC\u63d2\u4ef6CDB/PDB\u80fd\u529b", + "startedAt": 1795488480.52418 +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-integration-result.json b/script/datagov/deployment/releases/oracle-pdb-20261124-integration-result.json new file mode 100644 index 0000000..f159ec5 --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "9110fbdf14f519b42e2cc5c36c8b41ffc3e4d52b2fc508b6770db229bc483fb2", + "imageId": "sha256:c94bec7bea27914e85aab5e9b87d4c781f3e8fb92a8610ca2234e1bdec986a4a", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca" +} diff --git a/script/datagov/deployment/releases/oracle-pdb-20261124-integration.json b/script/datagov/deployment/releases/oracle-pdb-20261124-integration.json new file mode 100644 index 0000000..09983b0 --- /dev/null +++ b/script/datagov/deployment/releases/oracle-pdb-20261124-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "oracle-pdb-20261124", + "imageTag": "aixun-datagov/integration:oracle-pdb-20261124", + "imageId": "sha256:c94bec7bea27914e85aab5e9b87d4c781f3e8fb92a8610ca2234e1bdec986a4a", + "artifactSha256": "8299d1234707c4987ae68b805b2a011608d2b9ef2197e72d85ee3ef665765c01", + "sourceContainerId": "4d8bac3f1aa5acf134cc4876c2e8dbad3e2aa523b8d42bf096542434da55aeac", + "sourceImageId": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca", + "sourceImageTag": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca", + "sourceStateSha256": "1e0b528a0590b8b30de6a9b12353706516e2a893e56ed19bd490b18f6bc7b7e4", + "modelSha256": "62b807d390fa7e3186c8457206882afa42ca869ce722e03bfae874e77073184c", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-dataops.json b/script/datagov/deployment/releases/realtime-20261120-dataops.json new file mode 100644 index 0000000..f980148 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "realtime-20261120", + "imageTag": "aixun-datagov/dataops:realtime-20261120", + "imageId": "sha256:0efb004c258155692ba5a2793930243215fe38dfb2615ecad1d35b47f0e6d2ef", + "artifactSha256": "3123b558f73bfcde77064f84a4afa6ce971099ef16108645675b7366393e7df3", + "sourceContainerId": "0fa3bd226907677508ee35a5fca6d5eaae0b3103db9ac6b2ddd0d3949ee3da1c", + "sourceImageId": "sha256:9c7d60a85143345e78b8467c77c7c8a2769a550caa633550d62cf1d416064dba", + "sourceImageTag": "sha256:9c7d60a85143345e78b8467c77c7c8a2769a550caa633550d62cf1d416064dba", + "sourceStateSha256": "a5f7b186f1df0837e06a27c1fc2a101bb1fffa8006c8aae06542f1680c0e085c", + "modelSha256": "cb15aef353579229b557fe8af971bbc557e5169beb1f66dbc8d6d0e71ae16401", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-frontend-attempt.json b/script/datagov/deployment/releases/realtime-20261120-frontend-attempt.json new file mode 100644 index 0000000..982900e --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "80563406f6cb68375bdc5ae0923bce81b1085c7b3a07cb62d60382dd4961adcf", + "imageId": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u5b9e\u65f6\u91c7\u96c6\u9875\u9762\u5e76\u5b8c\u6210\u529f\u80fd\uff0c\u4ea4\u7531\u7528\u6237\u6d4b\u8bd5", + "startedAt": 1795166361.2765949 +} diff --git a/script/datagov/deployment/releases/realtime-20261120-frontend-result.json b/script/datagov/deployment/releases/realtime-20261120-frontend-result.json new file mode 100644 index 0000000..f848088 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "ca0deff6026328971185964f3b09e6ce13f232e43c8a1c8eaec7cdd1fc323de7", + "imageId": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:d92ac99cbd9e3ea4b43dc6bd9246677e27f6535ffe5a0f5e8b8e0d5f3aeb9cc3" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-frontend.json b/script/datagov/deployment/releases/realtime-20261120-frontend.json new file mode 100644 index 0000000..fc9eeb7 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-20261120", + "imageTag": "aixun-datagov/frontend:realtime-20261120", + "imageId": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476", + "artifactSha256": "532bd40332b71254e87437a3d69db83c13d54cf8930643dc267016fbdf2f1091", + "sourceContainerId": "80563406f6cb68375bdc5ae0923bce81b1085c7b3a07cb62d60382dd4961adcf", + "sourceImageId": "sha256:d92ac99cbd9e3ea4b43dc6bd9246677e27f6535ffe5a0f5e8b8e0d5f3aeb9cc3", + "sourceImageTag": "sha256:d92ac99cbd9e3ea4b43dc6bd9246677e27f6535ffe5a0f5e8b8e0d5f3aeb9cc3", + "sourceStateSha256": "26a483f8002dc2ff82771144365c305597b376e297d9c3c562a3c83639864790", + "modelSha256": "82b4f09f2575b33a89569f0cee84abcab2a08d5f95d3f6a53f514c8b88eca4b1", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-integration-attempt.json b/script/datagov/deployment/releases/realtime-20261120-integration-attempt.json new file mode 100644 index 0000000..e88eb95 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "7a9ebc8ae0b44a2766e46dce2948ec14ea5cf69a6689abf6e298f9732040c42b", + "imageId": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u5b9e\u65f6\u91c7\u96c6\u9875\u9762\u5e76\u5b8c\u6210\u529f\u80fd\uff0c\u4ea4\u7531\u7528\u6237\u6d4b\u8bd5", + "startedAt": 1795165808.169473 +} diff --git a/script/datagov/deployment/releases/realtime-20261120-integration-result.json b/script/datagov/deployment/releases/realtime-20261120-integration-result.json new file mode 100644 index 0000000..49ab12f --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "7e2e1056141e8b690d819ca011d6917e5ef0030a3aaeb84c9c4c707be94a1028", + "imageId": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:aa53067e15f1a14f1904cdd3da23b1514d8a1f6e887d17d2304738595f5f3a8a" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-integration.json b/script/datagov/deployment/releases/realtime-20261120-integration.json new file mode 100644 index 0000000..52624a2 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-20261120", + "imageTag": "aixun-datagov/integration:realtime-20261120", + "imageId": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b", + "artifactSha256": "2c2455becfdd07e7ad8b7d1315c51f2de4adfc982f75f464082c757970daadf5", + "sourceContainerId": "7a9ebc8ae0b44a2766e46dce2948ec14ea5cf69a6689abf6e298f9732040c42b", + "sourceImageId": "sha256:aa53067e15f1a14f1904cdd3da23b1514d8a1f6e887d17d2304738595f5f3a8a", + "sourceImageTag": "sha256:aa53067e15f1a14f1904cdd3da23b1514d8a1f6e887d17d2304738595f5f3a8a", + "sourceStateSha256": "562ded3d4cabe11e3416d9b58968f971ff1b9e3be608710f913465351c0d9039", + "modelSha256": "ce65013b6794c3989cf19b2d33f9d597852c5bdd5c8f6da2df9b8c9ee9240956", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-dataops-attempt.json b/script/datagov/deployment/releases/realtime-20261120-r2-dataops-attempt.json new file mode 100644 index 0000000..aa430fb --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "0fa3bd226907677508ee35a5fca6d5eaae0b3103db9ac6b2ddd0d3949ee3da1c", + "imageId": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u5b9e\u65f6\u91c7\u96c6\u9875\u9762\u5e76\u5b8c\u6210\u529f\u80fd\uff0c\u4ea4\u7531\u7528\u6237\u6d4b\u8bd5", + "startedAt": 1795166335.0476868 +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-dataops-result.json b/script/datagov/deployment/releases/realtime-20261120-r2-dataops-result.json new file mode 100644 index 0000000..626ac76 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "5fc51b48d8a8c43459081acf7146806bbdcfc2eb7124030218583b3e5ba7e19a", + "imageId": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:9c7d60a85143345e78b8467c77c7c8a2769a550caa633550d62cf1d416064dba" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-dataops.json b/script/datagov/deployment/releases/realtime-20261120-r2-dataops.json new file mode 100644 index 0000000..571e7dd --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "realtime-20261120-r2", + "imageTag": "aixun-datagov/dataops:realtime-20261120-r2", + "imageId": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa", + "artifactSha256": "29aff17cafa6b4f1052b2ebd449e7378c258710384a5f2179e442fdeedc85d03", + "sourceContainerId": "0fa3bd226907677508ee35a5fca6d5eaae0b3103db9ac6b2ddd0d3949ee3da1c", + "sourceImageId": "sha256:9c7d60a85143345e78b8467c77c7c8a2769a550caa633550d62cf1d416064dba", + "sourceImageTag": "sha256:9c7d60a85143345e78b8467c77c7c8a2769a550caa633550d62cf1d416064dba", + "sourceStateSha256": "a5f7b186f1df0837e06a27c1fc2a101bb1fffa8006c8aae06542f1680c0e085c", + "modelSha256": "d2dd79f9d5870cd9f27a905d37225bb0d154c206b65f4d26d7b61022de09fd79", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-integration-attempt.json b/script/datagov/deployment/releases/realtime-20261120-r2-integration-attempt.json new file mode 100644 index 0000000..75721e8 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "7e2e1056141e8b690d819ca011d6917e5ef0030a3aaeb84c9c4c707be94a1028", + "imageId": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u65b0\u589e\u5b9e\u65f6\u91c7\u96c6\u9875\u9762\u5e76\u5b8c\u6210\u529f\u80fd\uff0c\u4ea4\u7531\u7528\u6237\u6d4b\u8bd5", + "startedAt": 1795166269.317955 +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-integration-result.json b/script/datagov/deployment/releases/realtime-20261120-r2-integration-result.json new file mode 100644 index 0000000..fa46aa6 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "12c50dfa78a5b7f6a79ddfa0e16363d3d6dab52c1993802830f7604fcd118468", + "imageId": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b" +} diff --git a/script/datagov/deployment/releases/realtime-20261120-r2-integration.json b/script/datagov/deployment/releases/realtime-20261120-r2-integration.json new file mode 100644 index 0000000..d3b4247 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-20261120-r2-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-20261120-r2", + "imageTag": "aixun-datagov/integration:realtime-20261120-r2", + "imageId": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e", + "artifactSha256": "4c2b221f7853d78beb6b3a1fcba88309ba4e125adea4980d05064352701fb157", + "sourceContainerId": "7e2e1056141e8b690d819ca011d6917e5ef0030a3aaeb84c9c4c707be94a1028", + "sourceImageId": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b", + "sourceImageTag": "sha256:f72cd08fb891078e223a46583e6ec2fbb9d85d040beb53b1adfa8449ed00dd6b", + "sourceStateSha256": "07979379b0d38993ebf2696628cc4c59213247690f8f145a2cd9a94140b0d9d1", + "modelSha256": "0db285fb509f0a82a78bc10b8e3efe1eafea49565f2191a863ea9130ffdabc59", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-actions-20261124-frontend-attempt.json b/script/datagov/deployment/releases/realtime-actions-20261124-frontend-attempt.json new file mode 100644 index 0000000..5735ef7 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-actions-20261124-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "2a341ae7c8bd0651f982471a7e8f21b34e7035807862f362d783d51a8b865c16", + "imageId": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8c03\u6574\u5b9e\u65f6\u91c7\u96c6\u64cd\u4f5c\u6309\u94ae\uff0c\u66f4\u591a\u56fa\u5b9a\u7b2c\u56db\u4e2a\u5165\u53e3", + "startedAt": 1795481843.446374 +} diff --git a/script/datagov/deployment/releases/realtime-actions-20261124-frontend-result.json b/script/datagov/deployment/releases/realtime-actions-20261124-frontend-result.json new file mode 100644 index 0000000..4b0b438 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-actions-20261124-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "68432e8782da9021e09a8d9fbffc60d45a62311decd487de726a521e32770d1b", + "imageId": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2" +} diff --git a/script/datagov/deployment/releases/realtime-actions-20261124-frontend.json b/script/datagov/deployment/releases/realtime-actions-20261124-frontend.json new file mode 100644 index 0000000..aae2610 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-actions-20261124-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-actions-20261124", + "imageTag": "aixun-datagov/frontend:realtime-actions-20261124", + "imageId": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27", + "artifactSha256": "404ee5015bc53a98d1f81a5b9e3e73532bf59f526baa8e7dcb94d6dea821c87d", + "sourceContainerId": "2a341ae7c8bd0651f982471a7e8f21b34e7035807862f362d783d51a8b865c16", + "sourceImageId": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2", + "sourceImageTag": "sha256:81059f83dfdc682ff35e4b7ebe328c93e3e8fcfe1147d3b078d305ae1f317fe2", + "sourceStateSha256": "5b53c8c30ed826cb7270f2de373eab4ba944ec626a3da8d196dc7fdee9093b1b", + "modelSha256": "573928dc9625f9aa83a1c23830a4a34df71c34738edcf3dad5c622815b3b972e", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-dataops-attempt.json b/script/datagov/deployment/releases/realtime-delete-20261123-dataops-attempt.json new file mode 100644 index 0000000..6682a8c --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "70fa9cfc8e726d138f3ce8b2141bcdd1d88f8a7800db3735dc2a3fd82faaba62", + "imageId": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u5b9e\u65f6\u91c7\u96c6\u589e\u52a0\u5220\u9664\u6309\u94ae\u5e76\u4ea4\u4ed8\u672c\u5730\u4f7f\u7528", + "startedAt": 1795398690.915071 +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-dataops-result.json b/script/datagov/deployment/releases/realtime-delete-20261123-dataops-result.json new file mode 100644 index 0000000..63c9f3e --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "a872770648988be4a23608b87e91ed0ea8b0057df5b775fb18eceaa10f374540", + "imageId": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9" +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-dataops.json b/script/datagov/deployment/releases/realtime-delete-20261123-dataops.json new file mode 100644 index 0000000..c7c2465 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "realtime-delete-20261123", + "imageTag": "aixun-datagov/dataops:realtime-delete-20261123", + "imageId": "sha256:878a3979d5d5b363b97b5ef91151bf74f6ba1554ec91641b122427f7167aff36", + "artifactSha256": "f0bcd97a1eca1439c1cdf2488d4e6b0072f90e5ac4a01416a4f0ee0278e3ed9f", + "sourceContainerId": "70fa9cfc8e726d138f3ce8b2141bcdd1d88f8a7800db3735dc2a3fd82faaba62", + "sourceImageId": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9", + "sourceImageTag": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9", + "sourceStateSha256": "b136ffb9f3964cd613906c312cad4e830e8990355b5763b50e4618dcf998095e", + "modelSha256": "62a8bc361377fc126b0ef20e0850137cfbd68347e86105cd4b04e61bcf0bd930", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-frontend-attempt.json b/script/datagov/deployment/releases/realtime-delete-20261123-frontend-attempt.json new file mode 100644 index 0000000..41f400b --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "ca0deff6026328971185964f3b09e6ce13f232e43c8a1c8eaec7cdd1fc323de7", + "imageId": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u5b9e\u65f6\u91c7\u96c6\u589e\u52a0\u5220\u9664\u6309\u94ae\u5e76\u4ea4\u4ed8\u672c\u5730\u4f7f\u7528", + "startedAt": 1795398780.8890939 +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-frontend-result.json b/script/datagov/deployment/releases/realtime-delete-20261123-frontend-result.json new file mode 100644 index 0000000..778b2be --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "986b4ee5a6c11e96bc3a67ec8c9010c687387509d128e5c8e1f65e1671169cd9", + "imageId": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476" +} diff --git a/script/datagov/deployment/releases/realtime-delete-20261123-frontend.json b/script/datagov/deployment/releases/realtime-delete-20261123-frontend.json new file mode 100644 index 0000000..a2a0346 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-delete-20261123-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-delete-20261123", + "imageTag": "aixun-datagov/frontend:realtime-delete-20261123", + "imageId": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517", + "artifactSha256": "29e891d0c2f099f19b1cd83ee1d0df95622f7cc00f72c0967d86c3ec99fcbcd8", + "sourceContainerId": "ca0deff6026328971185964f3b09e6ce13f232e43c8a1c8eaec7cdd1fc323de7", + "sourceImageId": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476", + "sourceImageTag": "sha256:4f5543043ae72224c79f308fb2bf0a215c851578726e31a6e914eabcba80d476", + "sourceStateSha256": "bbb242706093b2c4302b1f37d43cc87f9208ceaf009e2624d9487cc00c09c7db", + "modelSha256": "0ea812f5339e7b6512cf450f9a27b51dc48f501cc044716e951af09ad7c194b1", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-attempt.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-attempt.json new file mode 100644 index 0000000..e359fc2 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "12c50dfa78a5b7f6a79ddfa0e16363d3d6dab52c1993802830f7604fcd118468", + "imageId": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e", + "authorizedBy": "\u7528\u6237\u53cd\u9988\u5b9e\u65f6\u91c7\u96c6\u6821\u9a8c\u5931\u8d25\uff0c\u4fee\u590d\u8bca\u65ad\u5e76\u672c\u5730\u590d\u6838", + "startedAt": 1795395151.330074 +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-result.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-result.json new file mode 100644 index 0000000..92e8e35 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "03c9358ac25d84b5be74a0cc14f71a514dfbcd8ae4aa368d665ebfc12cac2ed0", + "imageId": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e" +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration.json new file mode 100644 index 0000000..bc9929a --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-diagnosis-20261123", + "imageTag": "aixun-datagov/integration:realtime-diagnosis-20261123", + "imageId": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e", + "artifactSha256": "efd7d072389e0a0bfc05ac0356fef23cbfecbcbac3228a779d6d5805ef108b64", + "sourceContainerId": "12c50dfa78a5b7f6a79ddfa0e16363d3d6dab52c1993802830f7604fcd118468", + "sourceImageId": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e", + "sourceImageTag": "sha256:bbc2d4d070d1040f5ffaf3a93a6e25fdcf05c385011efb53c80214bda7b8356e", + "sourceStateSha256": "c15b0a476d53209db8ab61997e3e08585ad0f1fc8da327511d22effe97d0c0d1", + "modelSha256": "216b9a03465cb86521f17be45d40b2ab96dc70fe1e9f53f5d8c6aa8b4a45eab5", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-attempt.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-attempt.json new file mode 100644 index 0000000..b4c7d3f --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "03c9358ac25d84b5be74a0cc14f71a514dfbcd8ae4aa368d665ebfc12cac2ed0", + "imageId": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa", + "authorizedBy": "\u7528\u6237\u53cd\u9988\u5b9e\u65f6\u91c7\u96c6\u6821\u9a8c\u5931\u8d25\uff0c\u4fee\u590d\u8bca\u65ad\u5e76\u672c\u5730\u590d\u6838", + "startedAt": 1795395392.556768 +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-result.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-result.json new file mode 100644 index 0000000..82fc280 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "9d375c6d6023197f25ffb286d5780094ad0f3d7e34c798a84548cd58e26b6efb", + "imageId": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e" +} diff --git a/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration.json b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration.json new file mode 100644 index 0000000..ff3af1d --- /dev/null +++ b/script/datagov/deployment/releases/realtime-diagnosis-20261123-r2-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-diagnosis-20261123-r2", + "imageTag": "aixun-datagov/integration:realtime-diagnosis-20261123-r2", + "imageId": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa", + "artifactSha256": "fc2f5e37ebc52d06de7c9e57e97f696d832a6c24f6d31b8248218db015c59353", + "sourceContainerId": "03c9358ac25d84b5be74a0cc14f71a514dfbcd8ae4aa368d665ebfc12cac2ed0", + "sourceImageId": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e", + "sourceImageTag": "sha256:f55e8a0a936dc0b9bdfad1fc61311e2d329997c6cf8f664627021b089d79073e", + "sourceStateSha256": "62600c74737a3184a35568de1eed0a87f30c00ed53916858b77ab94d19435e66", + "modelSha256": "571f98cf17a16d6e70db95d3ab34928137c3a40b4de9326a3b0493c3477c6c72", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-errors-20261123-integration-attempt.json b/script/datagov/deployment/releases/realtime-errors-20261123-integration-attempt.json new file mode 100644 index 0000000..9c28df9 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-errors-20261123-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "9d375c6d6023197f25ffb286d5780094ad0f3d7e34c798a84548cd58e26b6efb", + "imageId": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8c03\u6574\u5b9e\u65f6\u91c7\u96c6\u9519\u8bef\u63d0\u793a\u5e76\u660e\u786e\u6839\u56e0\uff0c\u5ef6\u7eed\u672c\u5730\u529f\u80fd\u4fee\u590d\u6388\u6743", + "startedAt": 1795396992.1158242 +} diff --git a/script/datagov/deployment/releases/realtime-errors-20261123-integration-result.json b/script/datagov/deployment/releases/realtime-errors-20261123-integration-result.json new file mode 100644 index 0000000..022cc89 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-errors-20261123-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "41c6ed046664b0adb6b620b1f6fe992d108fc67fb813373ae45553981e69d299", + "imageId": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa" +} diff --git a/script/datagov/deployment/releases/realtime-errors-20261123-integration.json b/script/datagov/deployment/releases/realtime-errors-20261123-integration.json new file mode 100644 index 0000000..348cc47 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-errors-20261123-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-errors-20261123", + "imageTag": "aixun-datagov/integration:realtime-errors-20261123", + "imageId": "sha256:0a664c88a9e9141c3c33a0c64ad77913ccbe6d9966b9e5d9ab86493722df5f4f", + "artifactSha256": "6fd27656e0c51cfce03fee4394f1ab5b9ff8b529170aa25f5ff332fed06beeef", + "sourceContainerId": "9d375c6d6023197f25ffb286d5780094ad0f3d7e34c798a84548cd58e26b6efb", + "sourceImageId": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa", + "sourceImageTag": "sha256:d06a59c5e6c58bbb0a332d5a0730e6a32c205eabef4678540542efd3487d14aa", + "sourceStateSha256": "f59c638e29fb4300b241c94c07646fbed39020f8dfb1e558bd67670cc0a4d725", + "modelSha256": "4aab1e60e74fa6fd6621e1fc8078853da29cfad79e14f22684bacd870d4882ad", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-icons-20261123-frontend-attempt.json b/script/datagov/deployment/releases/realtime-icons-20261123-frontend-attempt.json new file mode 100644 index 0000000..2f78cde --- /dev/null +++ b/script/datagov/deployment/releases/realtime-icons-20261123-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "937bb482a12f3faf81399f9f7a8b0c23eb3a2f242803fd16d9fb471980f49fd0", + "imageId": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u5b9e\u65f6\u91c7\u96c6\u64cd\u4f5c\u4f7f\u7528\u56fe\u6807\u52a0\u6587\u5b57", + "startedAt": 1795402821.7651122 +} diff --git a/script/datagov/deployment/releases/realtime-icons-20261123-frontend-result.json b/script/datagov/deployment/releases/realtime-icons-20261123-frontend-result.json new file mode 100644 index 0000000..e74bbe9 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-icons-20261123-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "f7f1b27e0c50f34766cc0dbfea062bc1385dae342d08e44174dbfccee8fdbf41", + "imageId": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09" +} diff --git a/script/datagov/deployment/releases/realtime-icons-20261123-frontend.json b/script/datagov/deployment/releases/realtime-icons-20261123-frontend.json new file mode 100644 index 0000000..1ee4468 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-icons-20261123-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-icons-20261123", + "imageTag": "aixun-datagov/frontend:realtime-icons-20261123", + "imageId": "sha256:4d5e4fc488421cf80919d670ffb3ffe8dd949e775e03187a02fa0c6b10a761f3", + "artifactSha256": "b4a8166f3a0dadd17ca777378955c750c47db28db7c2317e7df4c3ed4cf5ffff", + "sourceContainerId": "937bb482a12f3faf81399f9f7a8b0c23eb3a2f242803fd16d9fb471980f49fd0", + "sourceImageId": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09", + "sourceImageTag": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09", + "sourceStateSha256": "8fbe5500cebed88d3c8f9792252ca7ea106eab400bf480ccf91b4432bfbe917a", + "modelSha256": "48a34f1c7afe49a7a63414d4c9c70e58abac8c68cca4b56277d67970927c9d69", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-order-20261123-frontend-attempt.json b/script/datagov/deployment/releases/realtime-order-20261123-frontend-attempt.json new file mode 100644 index 0000000..1090113 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-order-20261123-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "986b4ee5a6c11e96bc3a67ec8c9010c687387509d128e5c8e1f65e1671169cd9", + "imageId": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u8c03\u6574\u5b9e\u65f6\u91c7\u96c6\u6309\u94ae\u987a\u5e8f\uff0c\u5220\u9664\u59cb\u7ec8\u6700\u540e", + "startedAt": 1795402354.614132 +} diff --git a/script/datagov/deployment/releases/realtime-order-20261123-frontend-result.json b/script/datagov/deployment/releases/realtime-order-20261123-frontend-result.json new file mode 100644 index 0000000..4d311e2 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-order-20261123-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "937bb482a12f3faf81399f9f7a8b0c23eb3a2f242803fd16d9fb471980f49fd0", + "imageId": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517" +} diff --git a/script/datagov/deployment/releases/realtime-order-20261123-frontend.json b/script/datagov/deployment/releases/realtime-order-20261123-frontend.json new file mode 100644 index 0000000..d265d4d --- /dev/null +++ b/script/datagov/deployment/releases/realtime-order-20261123-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-order-20261123", + "imageTag": "aixun-datagov/frontend:realtime-order-20261123", + "imageId": "sha256:6d899adcbe77fde41e5699827abe28f88f85291974b6cb921b8a260158a03f09", + "artifactSha256": "1ef2b890e0abb7748fbd6798d2badee4466617ceab5c57ae4389ac6cadd544e7", + "sourceContainerId": "986b4ee5a6c11e96bc3a67ec8c9010c687387509d128e5c8e1f65e1671169cd9", + "sourceImageId": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517", + "sourceImageTag": "sha256:f2627af9e1dc126fa23d56e6ee5550180f3e74fb853042e995db20ffee910517", + "sourceStateSha256": "4cbff800eb8b14da0cc2b330c14037bdb4c70d1f984773b57f805300b7f91da1", + "modelSha256": "dd99e64104e95e037ae3ea6f348b01d12ef4e64474992d8fb1e5c878ab41f24a", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-attempt.json b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-attempt.json new file mode 100644 index 0000000..b3c57b2 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "a9e999427e33fec647fc374e5421793fb1bb1c13690b9c7684aa91e9d2098d99", + "imageId": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u6e05\u7406\u65e7\u5b9e\u65f6\u91c7\u96c6\u5e76\u6309\u76f8\u540c\u53c2\u6570\u91cd\u5efa\u8349\u7a3f", + "startedAt": 1795484131.130236 +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-result.json b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-result.json new file mode 100644 index 0000000..c13c4f6 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "4748c30d4fbd8b578c400db1881140e322a0275d07e731fa5b8b7a9d0b183035", + "imageId": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-dataops.json b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops.json new file mode 100644 index 0000000..498a4d5 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "realtime-recreate-20261124", + "imageTag": "aixun-datagov/dataops:realtime-recreate-20261124", + "imageId": "sha256:a257b75c26733c2a0bf135a625531146640331a8c23c55d739bd601423a7e908", + "artifactSha256": "005b28d293ef066aff60d7cc2b70a27848329ad78258adfa4cc6d72c1ba04898", + "sourceContainerId": "a9e999427e33fec647fc374e5421793fb1bb1c13690b9c7684aa91e9d2098d99", + "sourceImageId": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376", + "sourceImageTag": "sha256:8d4c7594844dd6cf85e720a0fcb19cd5c9dda75ae0f814e7de5817956744d376", + "sourceStateSha256": "c7cc31d0c6e576156733b3d299638fff48f5fd16b2a0c1102732f34ce84654a9", + "modelSha256": "5468a35571008f93dfc72bd46a4db1ddbdf1d2683a8cefbb66086b34629b0f17", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-attempt.json b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-attempt.json new file mode 100644 index 0000000..942aa17 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "68432e8782da9021e09a8d9fbffc60d45a62311decd487de726a521e32770d1b", + "imageId": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u6e05\u7406\u65e7\u5b9e\u65f6\u91c7\u96c6\u5e76\u6309\u76f8\u540c\u53c2\u6570\u91cd\u5efa\u8349\u7a3f", + "startedAt": 1795484162.8463051 +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-result.json b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-result.json new file mode 100644 index 0000000..4182455 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend-result.json @@ -0,0 +1,9 @@ +{ + "service": "frontend", + "containerId": "e3e1e3602de42c892880ced649402d171e65c26f7d22bea37244a63409793eaa", + "imageId": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-frontend.json b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend.json new file mode 100644 index 0000000..14473e1 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-frontend.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "service": "frontend", + "release": "realtime-recreate-20261124", + "imageTag": "aixun-datagov/frontend:realtime-recreate-20261124", + "imageId": "sha256:d81fd25b796314cb422fc8232dc0eaab9d9340c1049f2115cc38e7354c510a61", + "artifactSha256": "374903036cfef10d68fe4f0db351e15cb171ac1b47232406a8eeb92cafa5acf4", + "sourceContainerId": "68432e8782da9021e09a8d9fbffc60d45a62311decd487de726a521e32770d1b", + "sourceImageId": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27", + "sourceImageTag": "sha256:5c27763fb639381723676b841acb5995f44b5f7fa423e77de2c51ad66725ad27", + "sourceStateSha256": "ae5ae5b55a2b4d4fdc3d13765634f9f86afb05adc2e79deeee1d298671f6f173", + "modelSha256": "2a59dc5362f74fdbd8a0fc6e2ed03e1d981aeac030ce33ca3165a7e1f5583ee3", + "identitySha256": "d0c9630a8fcfc59276ca59df8adcf0043ee76a2c5f5ca0eb6745651a651c1f9f", + "artifactPath": "/opt/aixun-datagov/frontend-current" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-integration-attempt.json b/script/datagov/deployment/releases/realtime-recreate-20261124-integration-attempt.json new file mode 100644 index 0000000..ed5a681 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-integration-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "24dc294c1e9653f0b7cc884849134def5c0ab0c16901ca236d2ba26be475da72", + "imageId": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca", + "authorizedBy": "\u7528\u6237\u8981\u6c42\u6e05\u7406\u65e7\u5b9e\u65f6\u91c7\u96c6\u5e76\u6309\u76f8\u540c\u53c2\u6570\u91cd\u5efa\u8349\u7a3f", + "startedAt": 1795484093.4841821 +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-integration-result.json b/script/datagov/deployment/releases/realtime-recreate-20261124-integration-result.json new file mode 100644 index 0000000..3aee838 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-integration-result.json @@ -0,0 +1,9 @@ +{ + "service": "integration", + "containerId": "4d8bac3f1aa5acf134cc4876c2e8dbad3e2aa523b8d42bf096542434da55aeac", + "imageId": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a" +} diff --git a/script/datagov/deployment/releases/realtime-recreate-20261124-integration.json b/script/datagov/deployment/releases/realtime-recreate-20261124-integration.json new file mode 100644 index 0000000..f22dce8 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-recreate-20261124-integration.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "integration", + "release": "realtime-recreate-20261124", + "imageTag": "aixun-datagov/integration:realtime-recreate-20261124", + "imageId": "sha256:db05b01f02acd266dfad33d284c05956fc27c3c9c44abe47e14b95640efd59ca", + "artifactSha256": "17345c60980a7974de3267afb73443c22c72739384882833611642ea924f60e1", + "sourceContainerId": "24dc294c1e9653f0b7cc884849134def5c0ab0c16901ca236d2ba26be475da72", + "sourceImageId": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a", + "sourceImageTag": "sha256:1184ae30a83b97c93ab957d834ad688ea259312ea640ab6964ade0ec6005586a", + "sourceStateSha256": "9fd545a39f6a378387b8d1efee094223e0d37988d24213e5f1c80279a0f3191f", + "modelSha256": "241d6ccedecb578e2598ece1146ffb358d4a200819709a7f2cabde994543e51a", + "identitySha256": "b8dba93c3fb1418c792f60579268fdcc808452f3907a9b393164a83d819eb2d7" +} diff --git a/script/datagov/deployment/releases/realtime-targets-20261123-dataops-attempt.json b/script/datagov/deployment/releases/realtime-targets-20261123-dataops-attempt.json new file mode 100644 index 0000000..0241c5a --- /dev/null +++ b/script/datagov/deployment/releases/realtime-targets-20261123-dataops-attempt.json @@ -0,0 +1,6 @@ +{ + "sourceContainerId": "5fc51b48d8a8c43459081acf7146806bbdcfc2eb7124030218583b3e5ba7e19a", + "imageId": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9", + "authorizedBy": "\u7528\u6237\u53cd\u9988\u5b9e\u65f6\u91c7\u96c6\u5185\u90e8\u670d\u52a1\u5668\u9519\u8bef\uff0c\u4fee\u590d\u5e76\u672c\u5730\u590d\u6838", + "startedAt": 1795395908.648351 +} diff --git a/script/datagov/deployment/releases/realtime-targets-20261123-dataops-result.json b/script/datagov/deployment/releases/realtime-targets-20261123-dataops-result.json new file mode 100644 index 0000000..145e442 --- /dev/null +++ b/script/datagov/deployment/releases/realtime-targets-20261123-dataops-result.json @@ -0,0 +1,9 @@ +{ + "service": "dataops", + "containerId": "70fa9cfc8e726d138f3ce8b2141bcdd1d88f8a7800db3735dc2a3fd82faaba62", + "imageId": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9", + "status": "DEPLOYED_FUNCTIONAL_UAT_NOT_RUN", + "artifactReadback": "PASS", + "applicationReadiness": "NOT_RUN", + "recoveryImageId": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa" +} diff --git a/script/datagov/deployment/releases/realtime-targets-20261123-dataops.json b/script/datagov/deployment/releases/realtime-targets-20261123-dataops.json new file mode 100644 index 0000000..539348c --- /dev/null +++ b/script/datagov/deployment/releases/realtime-targets-20261123-dataops.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "service": "dataops", + "release": "realtime-targets-20261123", + "imageTag": "aixun-datagov/dataops:realtime-targets-20261123", + "imageId": "sha256:d7bea6eea2089517a53d06f2d02eff579971d3af50cee87e9d8fa408ceca2cd9", + "artifactSha256": "e19383da35d5f9c9123d799bc8bd76924b002262e147887c2176b8b142e1aeb8", + "sourceContainerId": "5fc51b48d8a8c43459081acf7146806bbdcfc2eb7124030218583b3e5ba7e19a", + "sourceImageId": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa", + "sourceImageTag": "sha256:a05f99609932857240ebbee9f5ce2a65928a67eb383babccbb4e20490ae9e6fa", + "sourceStateSha256": "da55110f5531f2d9530f62d72e1139fc07379d091a251384be811fe1e08a4705", + "modelSha256": "f50f72d5ee69ec0c45e061afe46a4ae170d0b2eb4b3b8bd3c4a8f07377194035", + "identitySha256": "68b340373dcc194a7483f67243b47b9d9612f151d7fce5c41d3c0af220018be6" +} diff --git a/script/datagov/m2/docker-compose.yml b/script/datagov/m2/docker-compose.yml index 1b7049b..3cac5a6 100644 --- a/script/datagov/m2/docker-compose.yml +++ b/script/datagov/m2/docker-compose.yml @@ -101,7 +101,9 @@ services: build: context: ./m2/seatunnel dockerfile: Dockerfile - image: aixun-datagov/seatunnel:2.3.13-ingestion-kingbase-20261104 + additional_contexts: + native_cdc: ../../aixun-modules/aixun-integration/seatunnel-native-cdc/target + image: aixun-datagov/seatunnel:2.3.13-cdc-20261120-r2 container_name: aixun-datagov-m2-seatunnel hostname: m2-seatunnel labels: *m2-labels diff --git a/script/datagov/m2/fetch-artifacts.sh b/script/datagov/m2/fetch-artifacts.sh index 8a93273..a48dd8d 100755 --- a/script/datagov/m2/fetch-artifacts.sh +++ b/script/datagov/m2/fetch-artifacts.sh @@ -20,6 +20,15 @@ fetch() { fetch "${ARTIFACT_DIR}/connector-jdbc-2.3.13.jar" \ d6be827cc6a529791f985a114fa65f032dde229b2c4b4f0b6ad1ae9328770d2e \ https://repo1.maven.org/maven2/org/apache/seatunnel/connector-jdbc/2.3.13/connector-jdbc-2.3.13.jar +fetch "${ARTIFACT_DIR}/connector-cdc-mysql-2.3.13.jar" \ + 57b13e1a4d9cd3055db39692e42dfd8fa8ee3d4b22197ba7de4296107cc360da \ + https://repo.maven.apache.org/maven2/org/apache/seatunnel/connector-cdc-mysql/2.3.13/connector-cdc-mysql-2.3.13.jar +fetch "${ARTIFACT_DIR}/connector-cdc-base-2.3.13.jar" \ + e0db5a70576ce6a7b189d43c268c99d4a912bfa26348442d7fd4fda22571a88a \ + https://repo.maven.apache.org/maven2/org/apache/seatunnel/connector-cdc-base/2.3.13/connector-cdc-base-2.3.13.jar +fetch "${ARTIFACT_DIR}/connector-doris-2.3.13.jar" \ + 032f60e81022035bf84e975263cd20e87ede6118f8b3582b284491d80c5a50b7 \ + https://repo.maven.apache.org/maven2/org/apache/seatunnel/connector-doris/2.3.13/connector-doris-2.3.13.jar fetch "${ARTIFACT_DIR}/connector-http-base-2.3.13.jar" \ 3ed4a53bfff002a96bbf437bae02b03579b7e2c10c1be953bea7b8968d494a5e \ https://repo1.maven.org/maven2/org/apache/seatunnel/connector-http-base/2.3.13/connector-http-base-2.3.13.jar diff --git a/script/datagov/m2/seatunnel/CdcFormatProbe.java b/script/datagov/m2/seatunnel/CdcFormatProbe.java new file mode 100644 index 0000000..f97a68f --- /dev/null +++ b/script/datagov/m2/seatunnel/CdcFormatProbe.java @@ -0,0 +1,40 @@ +import org.apache.seatunnel.api.table.catalog.*; +import org.apache.seatunnel.api.table.type.*; +import org.apache.seatunnel.api.source.Collector; +import org.apache.seatunnel.api.serialization.DeserializationSchema; +import org.apache.seatunnel.format.json.ogg.OggJsonDeserializationSchema; +import org.apache.seatunnel.format.json.debezium.DebeziumJsonDeserializationSchema; +import java.util.*; +import java.nio.charset.StandardCharsets; + +/** Real 2.3.13 decoder contract; no broker, database or secret access. */ +class CdcFormatProbe { + public static void main(String[] args) throws Exception { + var columns=List.of(PhysicalColumn.of("ID",BasicType.INT_TYPE,10L,false,null,null), + PhysicalColumn.of("NAME",BasicType.STRING_TYPE,100L,true,null,null)); + var table=CatalogTable.of(TableIdentifier.of("cdc","APP","ORDERS"),new TableSchema(columns,null,List.of()),Map.of(),List.of(),""); + for(String format:List.of("ogg_json","debezium_json")){ + DeserializationSchema decoder=format.equals("ogg_json")? + new OggJsonDeserializationSchema(table,null,null,false):new DebeziumJsonDeserializationSchema(table,false,false); + List rows=new ArrayList<>(); + Collector collector=new Collector<>(){ + public void collect(SeaTunnelRow row){rows.add(row);} + public Object getCheckpointLock(){return this;} + }; + String op=format.equals("ogg_json")?"op_type":"op"; + String[] operations=format.equals("ogg_json")?new String[]{"I","U","D"}:new String[]{"c","u","d"}; + String a="{\"ID\":1,\"NAME\":\"before\"}",b="{\"ID\":2,\"NAME\":null}"; + String[] messages={"{\""+op+"\":\""+operations[0]+"\",\"before\":null,\"after\":"+a+"}", + "{\""+op+"\":\""+operations[1]+"\",\"before\":"+a+",\"after\":"+b+"}", + "{\""+op+"\":\""+operations[2]+"\",\"before\":"+b+",\"after\":null}"}; + for(String msg:messages)decoder.deserialize(msg.getBytes(StandardCharsets.UTF_8),collector); + if(rows.size()!=4 || rows.get(0).getRowKind()!=RowKind.INSERT || rows.get(1).getRowKind()!=RowKind.UPDATE_BEFORE || + rows.get(2).getRowKind()!=RowKind.UPDATE_AFTER || rows.get(3).getRowKind()!=RowKind.DELETE || + !Integer.valueOf(1).equals(rows.get(1).getField(0)) || !Integer.valueOf(2).equals(rows.get(2).getField(0)) || rows.get(2).getField(1)!=null) + throw new AssertionError("Changelog contract failed: "+format); + boolean failed=false;try{decoder.deserialize("invalid-json".getBytes(StandardCharsets.UTF_8),collector);}catch(Exception e){failed=true;} + if(!failed)throw new AssertionError("Malformed change was silently skipped"); + System.out.println(format+": INSERT, UPDATE_BEFORE, UPDATE_AFTER, DELETE, key change, null, malformed rejection PASS"); + } + } +} diff --git a/script/datagov/m2/seatunnel/CdcPluginProbe.java b/script/datagov/m2/seatunnel/CdcPluginProbe.java new file mode 100644 index 0000000..2eba440 --- /dev/null +++ b/script/datagov/m2/seatunnel/CdcPluginProbe.java @@ -0,0 +1,15 @@ +import org.apache.seatunnel.api.table.factory.*; +/** Class loading only: never connects to a database or submits a job. */ +class CdcPluginProbe { + public static void main(String[] args) throws Exception { + ClassLoader loader=Thread.currentThread().getContextClassLoader(); + String source=args.length==0?"MySQL-CDC":args[0]; + System.out.println("SOURCE="+FactoryUtil.discoverFactory(loader,TableSourceFactory.class,source).factoryIdentifier()); + System.out.println("SINK="+FactoryUtil.discoverFactory(loader,TableSinkFactory.class,"Doris").factoryIdentifier()); + System.out.println("DRIVER="+Class.forName("com.mysql.cj.jdbc.Driver").getName()); + if("Oracle-CDC".equals(source))System.out.println("DRIVER="+Class.forName("oracle.jdbc.OracleDriver").getName()); + if("SqlServer-CDC".equals(source))System.out.println("DRIVER="+Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").getName()); + if("Dameng-Native-CDC".equals(source))System.out.println("DRIVER="+Class.forName("dm.jdbc.driver.DmDriver").getName()); + if("Kingbase-Native-CDC".equals(source))System.out.println("DRIVER="+Class.forName("com.kingbase8.Driver").getName()); + } +} diff --git a/script/datagov/m2/seatunnel/Dockerfile b/script/datagov/m2/seatunnel/Dockerfile index 2327249..319e6b5 100644 --- a/script/datagov/m2/seatunnel/Dockerfile +++ b/script/datagov/m2/seatunnel/Dockerfile @@ -1,12 +1,34 @@ FROM aixun-datagov/poc-seatunnel:2.3.13-auth-1 USER root +COPY patches/RestJobExecutionEnvironment.java /tmp/aixun-cdc-patch/RestJobExecutionEnvironment.java +RUN javac --release 8 -cp /opt/seatunnel/starter/seatunnel-starter.jar -d /tmp/aixun-cdc-patch/classes /tmp/aixun-cdc-patch/RestJobExecutionEnvironment.java && \ + jar uf /opt/seatunnel/starter/seatunnel-starter.jar -C /tmp/aixun-cdc-patch/classes . && \ + rm -rf /tmp/aixun-cdc-patch RUN install -d -o seatunnel -g seatunnel /opt/seatunnel/plugins/connector-jdbc +RUN install -d -o seatunnel -g seatunnel /opt/seatunnel/plugins/connector-cdc-mysql +RUN install -d -o seatunnel -g seatunnel /opt/seatunnel/plugins/connector-cdc-oracle /opt/seatunnel/plugins/connector-cdc-sqlserver +COPY local/artifacts/connector-cdc-base-2.3.13.jar /opt/seatunnel/plugins/connector-cdc-mysql/connector-cdc-base-2.3.13.jar +COPY local/artifacts/connector-cdc-base-2.3.13.jar /opt/seatunnel/plugins/connector-cdc-oracle/connector-cdc-base-2.3.13.jar +COPY local/artifacts/connector-cdc-base-2.3.13.jar /opt/seatunnel/plugins/connector-cdc-sqlserver/connector-cdc-base-2.3.13.jar +COPY local/artifacts/connector-cdc-oracle-2.3.13.jar /opt/seatunnel/connectors/connector-cdc-oracle-2.3.13.jar +COPY patches/OracleDialect.java patches/OracleSchema.java patches/OracleSnapshotSplitReadTask.java /tmp/aixun-oracle-patch/ +RUN javac --release 8 -cp '/opt/seatunnel/starter/seatunnel-starter.jar:/opt/seatunnel/lib/*:/opt/seatunnel/connectors/*:/opt/seatunnel/plugins/connector-cdc-oracle/*' -d /tmp/aixun-oracle-patch/classes /tmp/aixun-oracle-patch/*.java && \ + jar uf /opt/seatunnel/connectors/connector-cdc-oracle-2.3.13.jar -C /tmp/aixun-oracle-patch/classes . && \ + rm -rf /tmp/aixun-oracle-patch +COPY local/artifacts/connector-cdc-sqlserver-2.3.13.jar /opt/seatunnel/connectors/connector-cdc-sqlserver-2.3.13.jar +COPY local/artifacts/connector-kafka-2.3.13.jar /opt/seatunnel/connectors/connector-kafka-2.3.13.jar +COPY local/artifacts/ojdbc11-23.26.2.0.0.jar /opt/seatunnel/lib/ojdbc11-23.26.2.0.0.jar +COPY local/artifacts/orai18n-23.26.2.0.0.jar /opt/seatunnel/lib/orai18n-23.26.2.0.0.jar +COPY local/artifacts/mssql-jdbc-13.4.0.jre11.jar /opt/seatunnel/lib/mssql-jdbc-13.4.0.jre11.jar COPY local/artifacts/connector-jdbc-2.3.13.jar /opt/seatunnel/connectors/connector-jdbc-2.3.13.jar +COPY local/artifacts/connector-cdc-mysql-2.3.13.jar /opt/seatunnel/connectors/connector-cdc-mysql-2.3.13.jar +COPY local/artifacts/connector-doris-2.3.13.jar /opt/seatunnel/connectors/connector-doris-2.3.13.jar COPY local/artifacts/connector-http-base-2.3.13.jar /opt/seatunnel/connectors/connector-http-base-2.3.13.jar COPY local/artifacts/connector-file-local-2.3.13.jar /opt/seatunnel/connectors/connector-file-local-2.3.13.jar COPY local/artifacts/connector-hive-2.3.13.jar /opt/seatunnel/connectors/connector-hive-2.3.13.jar COPY local/artifacts/mysql-connector-j-9.5.0.jar /opt/seatunnel/plugins/connector-jdbc/mysql-connector-j-9.5.0.jar +COPY local/artifacts/mysql-connector-j-9.5.0.jar /opt/seatunnel/lib/mysql-connector-j-9.5.0.jar COPY local/artifacts/postgresql-42.7.13.jar /opt/seatunnel/plugins/connector-jdbc/postgresql-42.7.13.jar COPY local/artifacts/mariadb-java-client-3.5.10.jar /opt/seatunnel/plugins/connector-jdbc/mariadb-java-client-3.5.10.jar COPY local/artifacts/hive-jdbc-4.2.0-standalone.jar /opt/seatunnel/plugins/connector-jdbc/hive-jdbc-4.2.0-standalone.jar @@ -16,6 +38,15 @@ COPY local/artifacts/DmJdbcDriver18-8.1.3.62.jar /opt/seatunnel/plugins/connecto COPY local/artifacts/mssql-jdbc-13.4.0.jre11.jar /opt/seatunnel/plugins/connector-jdbc/mssql-jdbc-13.4.0.jre11.jar COPY local/artifacts/ojdbc11-23.26.2.0.0.jar /opt/seatunnel/plugins/connector-jdbc/ojdbc11-23.26.2.0.0.jar COPY local/artifacts/kingbase8-9.0.1.jre7.jar /opt/seatunnel/plugins/connector-jdbc/kingbase8-9.0.1.jre7.jar +COPY --from=native_cdc connector-aixun-native-cdc-2.3.13-1.jar /opt/seatunnel/connectors/connector-aixun-dameng-cdc-2.3.13-1.jar +COPY --from=native_cdc connector-aixun-native-cdc-2.3.13-1.jar /opt/seatunnel/connectors/connector-aixun-kingbase-cdc-2.3.13-1.jar +COPY local/artifacts/kingbase8-9.0.1.jre7.jar /opt/seatunnel/lib/kingbase8-9.0.1.jre7.jar +COPY local/artifacts/DmJdbcDriver18-8.1.3.62.jar /opt/seatunnel/lib/DmJdbcDriver18-8.1.3.62.jar +RUN printf '\nseatunnel.source.Dameng-Native-CDC = connector-aixun-dameng-cdc\nseatunnel.source.Kingbase-Native-CDC = connector-aixun-kingbase-cdc\n' >> /opt/seatunnel/connectors/plugin-mapping.properties +COPY patches/VerifyNativeDiscovery.java /tmp/VerifyNativeDiscovery.java +RUN javac --release 8 -cp /opt/seatunnel/starter/seatunnel-starter.jar -d /tmp /tmp/VerifyNativeDiscovery.java && \ + java -DSEATUNNEL_HOME=/opt/seatunnel -cp '/tmp:/opt/seatunnel/starter/seatunnel-starter.jar:/opt/seatunnel/lib/*' VerifyNativeDiscovery && \ + rm /tmp/VerifyNativeDiscovery.java /tmp/VerifyNativeDiscovery.class COPY --chmod=0555 start-seatunnel.sh /opt/aixun-m2/start-seatunnel.sh RUN find /opt/seatunnel/lib /opt/seatunnel/connectors -type f -iname '*opengauss*.jar' -delete && \ test "$(find /opt/seatunnel/lib /opt/seatunnel/connectors -type f -iname '*opengauss*.jar' | wc -l)" -eq 0 && \ diff --git a/script/datagov/m2/seatunnel/NativeCdcCapabilityProbe.java b/script/datagov/m2/seatunnel/NativeCdcCapabilityProbe.java new file mode 100644 index 0000000..4a912f3 --- /dev/null +++ b/script/datagov/m2/seatunnel/NativeCdcCapabilityProbe.java @@ -0,0 +1,23 @@ +import java.sql.*; +import java.util.*; + +/** Read-only local DM capability check. Does not mine business logs, change parameters, or apply DDL. */ +class NativeCdcCapabilityProbe { + public static void main(String[] args)throws Exception{ + Properties p=new Properties();p.setProperty("user",System.getenv("DATAGOV_DM_USERNAME")); + p.setProperty("password",System.getenv("DATAGOV_DM_PASSWORD"));p.setProperty("connectTimeout","5000");p.setProperty("socketTimeout","15000"); + Class.forName("dm.jdbc.driver.DmDriver"); + try(Connection db=DriverManager.getConnection("jdbc:dm://"+System.getenv("DATAGOV_DM_HOST")+":"+System.getenv("DATAGOV_DM_PORT"),p)){ + try(Statement s=db.createStatement();ResultSet rs=s.executeQuery("SELECT ID_CODE() FROM DUAL")){if(rs.next())System.out.println("DM_BUILD="+rs.getString(1));} + try(Statement s=db.createStatement();ResultSet rs=s.executeQuery("SELECT PARA_NAME,PARA_VALUE FROM V$DM_INI WHERE PARA_NAME IN ('RLOG_APPEND_LOGIC','RLOG_LLOG_COMPRESS','LOGMNR_DELAY_ANALYZE')")){ + while(rs.next())System.out.println(rs.getString(1)+"="+rs.getString(2)); + } + check(db,"ARCHIVE_COLUMNS","SELECT NAME,FIRST_CHANGE#,NEXT_CHANGE# FROM V$ARCHIVED_LOG WHERE 1=0"); + check(db,"LOGMNR_COLUMNS","SELECT OPERATION,COMMIT_SCN,STATUS,SCN,SSN,REDO_VALUE,UNDO_VALUE FROM V$LOGMNR_CONTENTS WHERE 1=0"); + }catch(SQLException e){System.out.println("PROBE_FAILED SQLSTATE="+e.getSQLState()+" CODE="+e.getErrorCode());System.exit(2);} + } + static void check(Connection db,String label,String sql){ + try(Statement s=db.createStatement();ResultSet r=s.executeQuery(sql)){System.out.println(label+"=PASS");} + catch(SQLException e){System.out.println(label+"=UNAVAILABLE SQLSTATE="+e.getSQLState()+" CODE="+e.getErrorCode());} + } +} diff --git a/script/datagov/m2/seatunnel/fetch-native-cdc.py b/script/datagov/m2/seatunnel/fetch-native-cdc.py new file mode 100644 index 0000000..31316d4 --- /dev/null +++ b/script/datagov/m2/seatunnel/fetch-native-cdc.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Fetch pinned CDC dependencies from Maven Central; never modifies a running node.""" +import hashlib +import urllib.request +from pathlib import Path + +ARTIFACTS = ( + ("org/apache/seatunnel/connector-kafka/2.3.13", "connector-kafka-2.3.13.jar", "303f5d9544e8cc192a50374c5cb8c1ad2c3f6123955291e66e8ff9dd14909298"), + ("org/apache/seatunnel/connector-cdc-oracle/2.3.13", "connector-cdc-oracle-2.3.13.jar", "1ffbf133b9eac604a4efdaa12874607945efa6fda4bc95a58187d4e9a70cd23a"), + ("org/apache/seatunnel/connector-cdc-sqlserver/2.3.13", "connector-cdc-sqlserver-2.3.13.jar", "8bfe28f5bcffc08ed9f6784e5a717ae8a54d47eb7b5e51d2dfbd9e959e90edc2"), + ("com/oracle/database/nls/orai18n/23.26.2.0.0", "orai18n-23.26.2.0.0.jar", "d0ed0aadf7e319ee8f313a85436919eb75f1012cc20f97d384e72adfbecfe3bd"), +) + +def main(): + root = Path(__file__).resolve().parent / "local/artifacts" + root.mkdir(parents=True, exist_ok=True) + for coordinate, name, expected in ARTIFACTS: + target = root / name + data = target.read_bytes() if target.exists() else urllib.request.urlopen( + "https://repo.maven.apache.org/maven2/" + coordinate + "/" + name, timeout=60).read() + if hashlib.sha256(data).hexdigest() != expected: + raise SystemExit("Checksum mismatch: " + name) + if not target.exists(): + target.write_bytes(data) + print("PASS " + name) + +if __name__ == "__main__": + main() diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-base-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-base-2.3.13.jar new file mode 100644 index 0000000..a87538d Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-base-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-mysql-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-mysql-2.3.13.jar new file mode 100644 index 0000000..96855fe Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-mysql-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-oracle-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-oracle-2.3.13.jar new file mode 100644 index 0000000..5a47f26 Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-oracle-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-sqlserver-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-sqlserver-2.3.13.jar new file mode 100644 index 0000000..cc09713 Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-cdc-sqlserver-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-doris-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-doris-2.3.13.jar new file mode 100644 index 0000000..7d6af74 Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-doris-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/connector-kafka-2.3.13.jar b/script/datagov/m2/seatunnel/local/artifacts/connector-kafka-2.3.13.jar new file mode 100644 index 0000000..c69468e Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/connector-kafka-2.3.13.jar differ diff --git a/script/datagov/m2/seatunnel/local/artifacts/orai18n-23.26.2.0.0.jar b/script/datagov/m2/seatunnel/local/artifacts/orai18n-23.26.2.0.0.jar new file mode 100644 index 0000000..bdb2a09 Binary files /dev/null and b/script/datagov/m2/seatunnel/local/artifacts/orai18n-23.26.2.0.0.jar differ diff --git a/script/datagov/m2/seatunnel/patches/OracleDialect.java b/script/datagov/m2/seatunnel/patches/OracleDialect.java new file mode 100644 index 0000000..dbdc872 --- /dev/null +++ b/script/datagov/m2/seatunnel/patches/OracleDialect.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source; + +import org.apache.seatunnel.api.table.catalog.CatalogTable; +import org.apache.seatunnel.api.table.catalog.ConstraintKey; +import org.apache.seatunnel.api.table.catalog.PrimaryKey; +import org.apache.seatunnel.common.utils.SeaTunnelException; +import org.apache.seatunnel.connectors.cdc.base.config.JdbcSourceConfig; +import org.apache.seatunnel.connectors.cdc.base.dialect.JdbcDataSourceDialect; +import org.apache.seatunnel.connectors.cdc.base.source.enumerator.splitter.ChunkSplitter; +import org.apache.seatunnel.connectors.cdc.base.source.reader.external.FetchTask; +import org.apache.seatunnel.connectors.cdc.base.source.split.SourceSplitBase; +import org.apache.seatunnel.connectors.cdc.base.utils.CatalogTableUtils; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.config.OracleSourceConfig; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.config.OracleSourceConfigFactory; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.enumerator.OracleChunkSplitter; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.reader.fetch.OracleSourceFetchTaskContext; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.reader.fetch.logminer.OracleRedoLogFetchTask; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.reader.fetch.scan.OracleSnapshotFetchTask; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.utils.OracleSchema; + +import io.debezium.connector.oracle.OracleConnection; +import io.debezium.jdbc.JdbcConnection; +import io.debezium.relational.TableId; +import io.debezium.relational.history.TableChanges.TableChange; + +import java.sql.SQLException; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import static org.apache.seatunnel.connectors.seatunnel.cdc.oracle.utils.OracleConnectionUtils.createOracleConnection; + +public class OracleDialect implements JdbcDataSourceDialect { + + private static final long serialVersionUID = 1L; + private final OracleSourceConfigFactory configFactory; + private final OracleSourceConfig sourceConfig; + private transient OracleSchema oracleSchema; + private final Map tableMap; + + public OracleDialect( + OracleSourceConfigFactory configFactory, List catalogTables) { + this.configFactory = configFactory; + this.sourceConfig = configFactory.create(0); + this.tableMap = CatalogTableUtils.convertTables(catalogTables); + } + + @Override + public String getName() { + return "Oracle"; + } + + @SuppressWarnings("checkstyle:MagicNumber") + @Override + public boolean isDataCollectionIdCaseSensitive(JdbcSourceConfig sourceConfig) { + try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) { + OracleConnection oracleConnection = (OracleConnection) jdbcConnection; + return oracleConnection.getOracleVersion().getMajor() == 11; + } catch (SQLException e) { + throw new SeaTunnelException("Error reading oracle variables: " + e.getMessage(), e); + } + } + + @Override + public JdbcConnection openJdbcConnection(JdbcSourceConfig sourceConfig) { + OracleConnection connection=createOracleConnection(sourceConfig.getDbzConnectorConfig().getJdbcConfig()); + String pdb=((OracleSourceConfig)sourceConfig).getDbzConnectorConfig().getPdbName(); + if(pdb!=null) { + try { connection.setSessionToPdb(pdb); } + catch(RuntimeException e) { + try { connection.close(); } catch(SQLException close) { e.addSuppressed(close); } + throw new SeaTunnelException("Cannot switch Oracle metadata connection to target PDB",e); + } + } + return connection; + } + + @Override + public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) { + return new OracleChunkSplitter(sourceConfig, this); + } + + @Override + public List discoverDataCollections(JdbcSourceConfig sourceConfig) { + OracleSourceConfig oracleSourceConfig = (OracleSourceConfig) sourceConfig; + String pdb=oracleSourceConfig.getDbzConnectorConfig().getPdbName(); + String database = pdb==null?oracleSourceConfig.getDbzConnectorConfig().getDatabaseName():pdb; + + return tableMap.keySet().stream() + .map(tableId -> new TableId(database, tableId.schema(), tableId.table())) + .collect(Collectors.toList()); + } + + @Override + public TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) { + if (oracleSchema == null) { + oracleSchema = new OracleSchema(sourceConfig.getDbzConnectorConfig(), tableMap); + } + return oracleSchema.getTableSchema(jdbc, tableId); + } + + @Override + public OracleSourceFetchTaskContext createFetchTaskContext( + SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) { + return new OracleSourceFetchTaskContext(taskSourceConfig, this); + } + + @Override + public FetchTask createFetchTask(SourceSplitBase sourceSplitBase) { + if (sourceSplitBase.isSnapshotSplit()) { + return new OracleSnapshotFetchTask(sourceSplitBase.asSnapshotSplit()); + } else { + return new OracleRedoLogFetchTask(sourceSplitBase.asIncrementalSplit()); + } + } + + @Override + public Optional getPrimaryKey(JdbcConnection jdbcConnection, TableId tableId) { + return Optional.ofNullable(tableMap.get(tableId).getTableSchema().getPrimaryKey()); + } + + @Override + public List getConstraintKeys(JdbcConnection jdbcConnection, TableId tableId) { + return tableMap.get(tableId).getTableSchema().getConstraintKeys(); + } +} diff --git a/script/datagov/m2/seatunnel/patches/OracleSchema.java b/script/datagov/m2/seatunnel/patches/OracleSchema.java new file mode 100644 index 0000000..48bd9d5 --- /dev/null +++ b/script/datagov/m2/seatunnel/patches/OracleSchema.java @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.cdc.oracle.utils; + +import org.apache.seatunnel.api.table.catalog.CatalogTable; +import org.apache.seatunnel.common.utils.SeaTunnelException; +import org.apache.seatunnel.connectors.cdc.base.utils.CatalogTableUtils; + +import io.debezium.connector.oracle.OracleConnection; +import io.debezium.connector.oracle.OracleConnectorConfig; +import io.debezium.jdbc.JdbcConnection; +import io.debezium.relational.Table; +import io.debezium.relational.TableId; +import io.debezium.relational.Tables; +import io.debezium.relational.history.TableChanges; +import io.debezium.relational.history.TableChanges.TableChange; + +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +/** A component used to get schema by table path. */ +public class OracleSchema { + + private final OracleConnectorConfig connectorConfig; + private final Map schemasByTableId; + private final Map tableMap; + + public OracleSchema( + OracleConnectorConfig connectorConfig, Map tableMap) { + this.connectorConfig = connectorConfig; + this.schemasByTableId = new HashMap<>(); + this.tableMap = tableMap; + } + + /** + * Gets table schema for the given table path. It will request to MySQL server by running `SHOW + * CREATE TABLE` if cache missed. + */ + public TableChange getTableSchema(JdbcConnection jdbc, TableId tableId) { + // Also switch on cache hits: the same connection may have been reset to CDB by log mining. + if(connectorConfig.getPdbName()!=null) { + try { ((OracleConnection)jdbc).setSessionToPdb(connectorConfig.getPdbName()); } + catch(RuntimeException e) {throw new SeaTunnelException("Cannot switch Oracle schema session to target PDB",e);} + } + // read schema from cache first + TableChange schema = schemasByTableId.get(tableId); + if (schema == null) { + schema = readTableSchema(jdbc, tableId); + } + return schema; + } + + private TableChange readTableSchema(JdbcConnection jdbc, TableId tableId) { + OracleConnection oracleConnection = (OracleConnection) jdbc; + Tables tables = new Tables(); + + try { + oracleConnection.readSchema( + tables, + tableId.catalog(), + tableId.schema(), + id -> connectorConfig.getTableFilters().dataCollectionFilter().isIncluded(id) || + (connectorConfig.getPdbName()!=null && tableMap.containsKey(tableId) && + java.util.Objects.equals(id.schema(),tableId.schema()) && java.util.Objects.equals(id.table(),tableId.table())), + null, + false); + for (TableId id : tables.tableIds()) { + TableId configured=id; + if(connectorConfig.getPdbName()!=null && !tableMap.containsKey(id) && tableMap.containsKey(tableId) && + java.util.Objects.equals(id.schema(),tableId.schema()) && java.util.Objects.equals(id.table(),tableId.table()))configured=tableId; + if (tableMap.containsKey(configured)) { + Table table = + CatalogTableUtils.mergeCatalogTableConfig( + tables.forTable(id).edit().tableId(configured).create(), tableMap.get(configured)); + TableChanges.TableChange tableChange = + new TableChanges.TableChange( + TableChanges.TableChangeType.CREATE, table); + schemasByTableId.put(configured, tableChange); + } + } + } catch (SQLException e) { + throw new SeaTunnelException( + String.format("Failed to read schema for table %s ", tableId), e); + } + + if (!schemasByTableId.containsKey(tableId)) { + throw new SeaTunnelException( + String.format("Can't obtain schema for table %s ", tableId)); + } + + return schemasByTableId.get(tableId); + } +} diff --git a/script/datagov/m2/seatunnel/patches/OracleSnapshotSplitReadTask.java b/script/datagov/m2/seatunnel/patches/OracleSnapshotSplitReadTask.java new file mode 100644 index 0000000..d883162 --- /dev/null +++ b/script/datagov/m2/seatunnel/patches/OracleSnapshotSplitReadTask.java @@ -0,0 +1,287 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.reader.fetch.scan; + +import org.apache.seatunnel.connectors.cdc.base.relational.JdbcSourceEventDispatcher; +import org.apache.seatunnel.connectors.cdc.base.source.split.SnapshotSplit; +import org.apache.seatunnel.connectors.cdc.base.source.split.wartermark.WatermarkKind; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.source.offset.RedoLogOffset; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.utils.OracleConnectionUtils; +import org.apache.seatunnel.connectors.seatunnel.cdc.oracle.utils.OracleUtils; + +import org.apache.kafka.connect.errors.ConnectException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.debezium.DebeziumException; +import io.debezium.connector.oracle.OracleConnection; +import io.debezium.connector.oracle.OracleConnectorConfig; +import io.debezium.connector.oracle.OracleDatabaseSchema; +import io.debezium.connector.oracle.OracleOffsetContext; +import io.debezium.connector.oracle.OraclePartition; +import io.debezium.pipeline.EventDispatcher; +import io.debezium.pipeline.source.AbstractSnapshotChangeEventSource; +import io.debezium.pipeline.source.spi.SnapshotProgressListener; +import io.debezium.pipeline.spi.ChangeRecordEmitter; +import io.debezium.pipeline.spi.SnapshotResult; +import io.debezium.relational.RelationalSnapshotChangeEventSource; +import io.debezium.relational.SnapshotChangeRecordEmitter; +import io.debezium.relational.Table; +import io.debezium.relational.TableId; +import io.debezium.util.Clock; +import io.debezium.util.ColumnUtils; +import io.debezium.util.Strings; +import io.debezium.util.Threads; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.Duration; + +/** A wrapped task to fetch snapshot split of table. */ +public class OracleSnapshotSplitReadTask + extends AbstractSnapshotChangeEventSource { + + private static final Logger LOG = LoggerFactory.getLogger(OracleSnapshotSplitReadTask.class); + + /** Interval for showing a log statement with the progress while scanning a single table. */ + private static final Duration LOG_INTERVAL = Duration.ofMillis(10_000); + + private final OracleConnectorConfig connectorConfig; + private final OracleDatabaseSchema databaseSchema; + private final OracleConnection jdbcConnection; + private final JdbcSourceEventDispatcher dispatcher; + private final Clock clock; + private final SnapshotSplit snapshotSplit; + private final OracleOffsetContext offsetContext; + private final SnapshotProgressListener snapshotProgressListener; + + public OracleSnapshotSplitReadTask( + OracleConnectorConfig connectorConfig, + OracleOffsetContext previousOffset, + SnapshotProgressListener snapshotProgressListener, + OracleDatabaseSchema databaseSchema, + OracleConnection jdbcConnection, + JdbcSourceEventDispatcher dispatcher, + SnapshotSplit snapshotSplit) { + super(connectorConfig, snapshotProgressListener); + this.offsetContext = previousOffset; + this.connectorConfig = connectorConfig; + this.databaseSchema = databaseSchema; + this.jdbcConnection = jdbcConnection; + this.dispatcher = dispatcher; + this.clock = Clock.SYSTEM; + this.snapshotSplit = snapshotSplit; + this.snapshotProgressListener = snapshotProgressListener; + } + + @Override + public SnapshotResult execute( + ChangeEventSourceContext context, + OraclePartition partition, + OracleOffsetContext previousOffset) + throws InterruptedException { + SnapshottingTask snapshottingTask = getSnapshottingTask(partition, previousOffset); + final SnapshotContext ctx; + try { + ctx = prepare(partition); + } catch (Exception e) { + LOG.error("Failed to initialize snapshot context.", e); + throw new RuntimeException(e); + } + try { + return doExecute(context, previousOffset, ctx, snapshottingTask); + } catch (InterruptedException e) { + LOG.warn("Snapshot was interrupted before completion"); + throw e; + } catch (Exception t) { + throw new DebeziumException(t); + } finally { + complete(ctx); + } + } + + @Override + protected SnapshotResult doExecute( + ChangeEventSourceContext context, + OracleOffsetContext previousOffset, + SnapshotContext snapshotContext, + SnapshottingTask snapshottingTask) + throws Exception { + final OracleSnapshotContext ctx = (OracleSnapshotContext) snapshotContext; + ctx.offset = offsetContext; + + final RedoLogOffset lowWatermark = + OracleConnectionUtils.currentRedoLogOffset(jdbcConnection); + LOG.info( + "Snapshot step 1 - Determining low watermark {} for split {}", + lowWatermark, + snapshotSplit); + ((SnapshotSplitChangeEventSourceContext) context).setLowWatermark(lowWatermark); + dispatcher.dispatchWatermarkEvent( + ctx.partition.getSourcePartition(), snapshotSplit, lowWatermark, WatermarkKind.LOW); + + LOG.info("Snapshot step 2 - Snapshotting data"); + createDataEvents(ctx, snapshotSplit.getTableId()); + + final RedoLogOffset highWatermark = + OracleConnectionUtils.currentRedoLogOffset(jdbcConnection); + LOG.info( + "Snapshot step 3 - Determining high watermark {} for split {}", + highWatermark, + snapshotSplit); + ((SnapshotSplitChangeEventSourceContext) context).setHighWatermark(highWatermark); + dispatcher.dispatchWatermarkEvent( + ctx.partition.getSourcePartition(), + snapshotSplit, + highWatermark, + WatermarkKind.HIGH); + return SnapshotResult.completed(ctx.offset); + } + + @Override + protected SnapshottingTask getSnapshottingTask( + OraclePartition partition, OracleOffsetContext previousOffset) { + return new SnapshottingTask(false, true); + } + + @Override + protected SnapshotContext prepare( + OraclePartition partition) throws Exception { + // The previous split's complete() resets the shared connection to CDB. + if (connectorConfig.getPdbName() != null) { + jdbcConnection.setSessionToPdb(connectorConfig.getPdbName()); + } + return new OracleSnapshotContext(partition); + } + + @Override + protected void complete(SnapshotContext snapshotContext) { + if (connectorConfig.getPdbName() != null) { + jdbcConnection.resetSessionToCdb(); + } + } + + private void createDataEvents( + RelationalSnapshotChangeEventSource.RelationalSnapshotContext< + OraclePartition, OracleOffsetContext> + snapshotContext, + TableId tableId) + throws Exception { + EventDispatcher.SnapshotReceiver snapshotReceiver = + dispatcher.getSnapshotChangeEventReceiver(); + LOG.debug("Snapshotting table {}", tableId); + createDataEventsForTable( + snapshotContext, snapshotReceiver, databaseSchema.tableFor(tableId)); + snapshotReceiver.completeSnapshot(); + } + + /** Dispatches the data change events for the records of a single table. */ + private void createDataEventsForTable( + RelationalSnapshotChangeEventSource.RelationalSnapshotContext< + OraclePartition, OracleOffsetContext> + snapshotContext, + EventDispatcher.SnapshotReceiver snapshotReceiver, + Table table) + throws InterruptedException { + + long exportStart = clock.currentTimeInMillis(); + LOG.info("Exporting data from split '{}' of table {}", snapshotSplit.splitId(), table.id()); + + final String selectSql = + OracleUtils.buildSplitScanQuery( + snapshotSplit.getTableId(), + snapshotSplit.getSplitKeyType(), + snapshotSplit.getSplitStart() == null, + snapshotSplit.getSplitEnd() == null); + LOG.info( + "For split '{}' of table {} using select statement: '{}'", + snapshotSplit.splitId(), + table.id(), + selectSql); + + try (PreparedStatement selectStatement = + OracleUtils.readTableSplitDataStatement( + jdbcConnection, + selectSql, + snapshotSplit.getSplitStart() == null, + snapshotSplit.getSplitEnd() == null, + snapshotSplit.getSplitStart(), + snapshotSplit.getSplitEnd(), + snapshotSplit.getSplitKeyType(), + connectorConfig.getSnapshotFetchSize()); + ResultSet rs = selectStatement.executeQuery()) { + + ColumnUtils.ColumnArray columnArray = ColumnUtils.toArray(rs, table); + long rows = 0; + Threads.Timer logTimer = getTableScanLogTimer(); + + while (rs.next()) { + rows++; + final Object[] row = + jdbcConnection.rowToArray(table, databaseSchema, rs, columnArray); + if (logTimer.expired()) { + long stop = clock.currentTimeInMillis(); + LOG.info( + "Exported {} records for split '{}' after {}", + rows, + snapshotSplit.splitId(), + Strings.duration(stop - exportStart)); + snapshotProgressListener.rowsScanned( + snapshotContext.partition, table.id(), rows); + logTimer = getTableScanLogTimer(); + } + dispatcher.dispatchSnapshotEvent( + snapshotContext.partition, + table.id(), + getChangeRecordEmitter(snapshotContext, table.id(), row), + snapshotReceiver); + } + LOG.info( + "Finished exporting {} records for split '{}', total duration '{}'", + rows, + snapshotSplit.splitId(), + Strings.duration(clock.currentTimeInMillis() - exportStart)); + } catch (SQLException e) { + throw new ConnectException("Snapshotting of table " + table.id() + " failed", e); + } + } + + protected ChangeRecordEmitter getChangeRecordEmitter( + SnapshotContext snapshotContext, + TableId tableId, + Object[] row) { + snapshotContext.offset.event(tableId, clock.currentTime()); + return new SnapshotChangeRecordEmitter<>( + snapshotContext.partition, snapshotContext.offset, row, clock); + } + + private Threads.Timer getTableScanLogTimer() { + return Threads.timer(clock, LOG_INTERVAL); + } + + private static class OracleSnapshotContext + extends RelationalSnapshotChangeEventSource.RelationalSnapshotContext< + OraclePartition, OracleOffsetContext> { + + public OracleSnapshotContext(OraclePartition partition) throws SQLException { + super(partition, ""); + } + } +} diff --git a/script/datagov/m2/seatunnel/patches/RestJobExecutionEnvironment.java b/script/datagov/m2/seatunnel/patches/RestJobExecutionEnvironment.java new file mode 100644 index 0000000..b6efcd7 --- /dev/null +++ b/script/datagov/m2/seatunnel/patches/RestJobExecutionEnvironment.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Based on Apache SeaTunnel 2.3.13. AiXun change: fail closed before parsing + * a restored CDC job when durable checkpoint data is absent or too old. + */ +package org.apache.seatunnel.engine.server.rest; + +import org.apache.seatunnel.shade.com.google.common.annotations.VisibleForTesting; +import org.apache.seatunnel.shade.com.typesafe.config.Config; +import org.apache.seatunnel.shade.org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.seatunnel.api.common.JobContext; +import org.apache.seatunnel.engine.common.Constant; +import org.apache.seatunnel.engine.common.config.JobConfig; +import org.apache.seatunnel.engine.core.dag.actions.Action; +import org.apache.seatunnel.engine.core.dag.logical.LogicalDag; +import org.apache.seatunnel.engine.core.job.AbstractJobEnvironment; +import org.apache.seatunnel.engine.core.job.JobImmutableInformation; +import org.apache.seatunnel.engine.core.job.JobPipelineCheckpointData; +import org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser; +import org.apache.seatunnel.engine.server.SeaTunnelServer; +import com.hazelcast.instance.impl.Node; +import com.hazelcast.spi.impl.NodeEngineImpl; +import java.net.URL; +import java.util.*; + +public class RestJobExecutionEnvironment extends AbstractJobEnvironment { + private final Config seaTunnelJobConfig; + private final NodeEngineImpl nodeEngine; + private final Long jobId; + private final SeaTunnelServer seaTunnelServer; + public RestJobExecutionEnvironment(SeaTunnelServer server,JobConfig jobConfig,Config config, + Node node,boolean restore,Long jobId) { + super(jobConfig,restore); + this.seaTunnelServer=server;this.seaTunnelJobConfig=config;this.nodeEngine=node.getNodeEngine(); + this.jobConfig.setJobContext(new JobContext(jobId!=null?jobId:nodeEngine.getHazelcastInstance() + .getFlakeIdGenerator(Constant.SEATUNNEL_ID_GENERATOR_NAME).newId())); + this.jobId=Long.valueOf(this.jobConfig.getJobContext().getJobId()); + } + public Long getJobId(){return jobId;} + @VisibleForTesting @Override public LogicalDag getLogicalDag(){ + ImmutablePair,Set> parsed=getJobConfigParser().parse(seaTunnelServer.getClassLoaderService()); + actions.addAll(parsed.getLeft());jarUrls.addAll(commonPluginJars);jarUrls.addAll(parsed.getRight()); + actions.forEach(action->addCommonPluginJarsToAction(action,new HashSet<>(commonPluginJars),Collections.emptySet())); + return getLogicalDagGenerator().generate(); + } + @Override protected MultipleTableJobConfigParser getJobConfigParser(){ + List checkpoints=Collections.emptyList(); + Config env=seaTunnelJobConfig.getConfig("env"); + boolean guarded=env.hasPath("\"aixun.restore.checkpoint\""); + if(guarded && !isStartWithSavePoint)throw new IllegalStateException("AIXUN_RESTORE_FLAG_REQUIRED"); + if(isStartWithSavePoint){ + checkpoints=seaTunnelServer.getCheckpointService().getLatestCheckpointData(jobConfig.getJobContext().getJobId()); + if(checkpoints.isEmpty())throw new IllegalStateException("AIXUN_RESTORE_CHECKPOINT_MISSING"); + if(guarded){ + long minimum=env.getLong("\"aixun.restore.checkpoint\""); + if(checkpoints.size()!=1 || minimum<0 || checkpoints.get(0).getCheckpointId()(jarUrls),new ArrayList<>(connectorJarIdentifiers)); + } +} diff --git a/script/datagov/m2/seatunnel/patches/VerifyNativeDiscovery.java b/script/datagov/m2/seatunnel/patches/VerifyNativeDiscovery.java new file mode 100644 index 0000000..d3c0087 --- /dev/null +++ b/script/datagov/m2/seatunnel/patches/VerifyNativeDiscovery.java @@ -0,0 +1,17 @@ +import java.util.Collections; +import org.apache.seatunnel.api.common.PluginIdentifier; +import org.apache.seatunnel.plugin.discovery.seatunnel.SeaTunnelSourcePluginDiscovery; + +/** Build-time regression check against the actual engine, without database access. */ +public final class VerifyNativeDiscovery { + public static void main(String[] args) { + SeaTunnelSourcePluginDiscovery discovery = new SeaTunnelSourcePluginDiscovery(); + for (String name : new String[] {"Dameng-Native-CDC", "Kingbase-Native-CDC"}) { + PluginIdentifier id = PluginIdentifier.of("seatunnel", "source", name); + if (discovery.getPluginJarPaths(Collections.singletonList(id)).size() != 2) { + throw new IllegalStateException("Expected native connector and CDC base: " + name); + } + System.out.println("Native discovery PASS: " + name); + } + } +} diff --git a/script/quality/check.sh b/script/quality/check.sh index 730c3d3..b3a7932 100755 --- a/script/quality/check.sh +++ b/script/quality/check.sh @@ -7,6 +7,7 @@ usage() { Usage: check.sh MODE [scope] --backend MODULES [TEST] Maven tests; optional Surefire class/method pattern --backend-build MODULES Maven package (including tests), no clean/install + --native-cdc Build and test isolated SeaTunnel Java 8 connectors --frontend [PATH...] Lint selected paths relative to aixun-ui, or all src --frontend-build Frontend production build --files PATH... Syntax and secret checks for explicit text files @@ -17,6 +18,10 @@ HELP } mode="${1:---help}"; [[ $# -eq 0 ]] || shift case "$mode" in + --native-cdc) + [[ $# -eq 0 ]] || { usage >&2; exit 2; } + exec ./mvnw -B -f aixun-modules/aixun-integration/seatunnel-native-cdc/pom.xml package + ;; --backend|--backend-build) [[ $# -ge 1 && $# -le 2 && "$1" != -* ]] || { usage >&2; exit 2; } modules="$1"; shift diff --git a/script/sql/oracle/finance_cdc_remaining_grants.sql b/script/sql/oracle/finance_cdc_remaining_grants.sql new file mode 100644 index 0000000..99a326b --- /dev/null +++ b/script/sql/oracle/finance_cdc_remaining_grants.sql @@ -0,0 +1,21 @@ +-- Run by a DBA authorized to grant SYS object privileges, in CDB$ROOT of FREE. +-- Account already exists. No password reset, account creation or database restart here. +ALTER SESSION SET CONTAINER = CDB$ROOT; +GRANT EXECUTE ON SYS.DBMS_LOGMNR TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT EXECUTE ON SYS.DBMS_LOGMNR_D TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$DATABASE TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOG TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOG_HISTORY TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOGMNR_LOGS TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOGMNR_CONTENTS TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOGMNR_PARAMETERS TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$LOGFILE TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$ARCHIVED_LOG TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$ARCHIVE_DEST_STATUS TO C##ERP_FINANCE_CDC CONTAINER=ALL; +GRANT SELECT ON SYS.V_$TRANSACTION TO C##ERP_FINANCE_CDC CONTAINER=ALL; + +-- Separate prerequisite: DBA must plan ARCHIVELOG activation and archive storage/retention. +-- Current observation: NOARCHIVELOG; supplemental logging disabled. +-- After archive setup, DBA should enable minimum supplemental logging at root and +-- ALL COLUMNS supplemental logging on FREEPDB1.ERP_FINANCE.ACCOUNTING_VOUCHERS. +-- This file intentionally does not restart the database or change logging configuration.