feat(auditplan): add CatalogName field to schema_meta for PG-family databases#3315
Closed
actiontech-bot wants to merge 1 commit into
Closed
feat(auditplan): add CatalogName field to schema_meta for PG-family databases#3315actiontech-bot wants to merge 1 commit into
actiontech-bot wants to merge 1 commit into
Conversation
…olumn The schema meta scan task detail page used to show PostgreSQL database name under the 'schema' column, which is actually the catalog and not the PG schema/namespace. In PostgreSQL semantics catalog (database) and schema (namespace) are two independent layers, so they must be carried separately: - Add CatalogName to SchemaMetaSQL so that PG-family extractors can populate the catalog (database) name independently from the schema (namespace) name. - Persist the catalog via a new MetricNameMetaCatalog metric so that it flows through ExtractSQL / mergeSQL / genSQLId / GetSQLData without reusing the existing SchemaName field. - Expose a new 'catalog' column on the schema meta task detail page via Head(), backed by ApMetricNameMetaCatalog in zh/en locale. - Include CatalogName in genSQLId so that the same (schema, table, type) tuple living in different catalogs is no longer merged into one row, which would otherwise hide cross-database objects. For databases without a catalog/schema two-layer namespace (MySQL, TiDB, Oracle etc.) CatalogName stays empty and the catalog column renders as '-' in the UI, keeping the existing behaviour intact. Refs: actiontech/sqle-ee#2894
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
为 TBase(TDSQL PostgreSQL 版)库表元数据扫描任务做配套的 CE 侧基础扩展:在
SchemaMetaSQL与audit_plan_sqlsInfo 中新增独立的CatalogName(PG 系语义下指 database 名)字段与MetricNameMetaCatalog指标,并在任务详情页 Head() 中暴露一列catalog。PostgreSQL 系数据库的
catalog(database)与schema(namespace)是两层独立命名空间,原实现将 db 名误写入SchemaName,本次改为两个字段分别承载;genSQLId也将Catalog纳入 hash key,防止跨 catalog 同名对象被合并。对不存在 catalog/schema 双层命名空间的数据库(MySQL / TiDB / Oracle 等),
CatalogName保持空字符串,UI 列渲染为-,行为完全不变。Changes
sqle/server/auditplan/task_type_mysql_schema_meta.goSchemaMetaSQL增加CatalogName stringMetrics()/mergeSQL/ExtractSQL接入MetricNameMetaCataloggenSQLIdhash 输入加CatalogHead()新增catalog列;GetSQLData写出schema_meta_catalogsqle/server/auditplan/metrics.go:新增MetricNameMetaCatalog常量与ALLMetric注册sqle/locale/active.zh.toml/active.en.toml/message_zh.go:新增 i18n 键ApMetricNameMetaCatalogTest plan
go vet ./...(docker golang:1.24.1)通过go test ./sqle/server/auditplan/...通过actiontech/sqle-ee#2894依赖本 PR 合并后自动同步到 main-ee 方可通过 CI;本 PR 单独合并不会改变现有 MySQL / Oracle / TiDB schema_meta 任务行为Fixes actiontech/sqle-ee#2894