Repository navigation
ci: shard OceanBase clean migration checks #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zamaoxiaoji
wants to merge
5
commits into
oceanbase:master
Choose a base branch
from
zamaoxiaoji:ci/2233-shard-oceanbase-migrations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+635
−26
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd5b5d0
ci: shard OceanBase clean migration checks
zamaoxiaoji 915cd58
test(ci): isolate migration fixture pytest options
zamaoxiaoji 8ac0c79
ci: reconcile migration sharding with upstream
zamaoxiaoji caac0ad
docs: update sharded migration observability guidance
zamaoxiaoji 2d5f202
test(release): isolate upgrade gate checkout fixture
zamaoxiaoji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Copyright (c) 2026 OceanBase. | ||
| # | ||
| # Licensed 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. | ||
|
|
||
| """Verify complete, exactly-once OceanBase acceptance across downloaded shard artifacts.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import json | ||
| import sys | ||
| from collections import Counter | ||
| from pathlib import Path | ||
|
|
||
| GROUPS = ("scope-search", "background-metrics", "clean-migration", "startup-snapshot", "long-query") | ||
|
|
||
|
|
||
| def verify_group(paths: list[Path], shards: int) -> int: | ||
| """Require matching collections and successful, disjoint execution of every node.""" | ||
| collection: list[str] | None = None | ||
| passed: list[str] = [] | ||
| indices: set[int] = set() | ||
| for path in paths: | ||
| report = json.loads(path.read_text(encoding="utf-8")) | ||
| if not isinstance(report, dict): | ||
| message = f"{path}: expected a summary object" | ||
| raise TypeError(message) | ||
| index = report.get("shard_index") | ||
| if ( | ||
| type(index) is not int | ||
| or not 0 <= index < shards | ||
| or index in indices | ||
| or type(report.get("shard_count")) is not int | ||
| or report["shard_count"] != shards | ||
| or report.get("backend") != "oceanbase" | ||
| or report.get("complete") is not True | ||
| ): | ||
| message = f"{path}: incomplete summary or invalid shard identity" | ||
| raise ValueError(message) | ||
| nodes = report.get("collected_nodes") | ||
| actual = report.get("passed_nodes") | ||
| if ( | ||
| not isinstance(nodes, list) | ||
| or not nodes | ||
| or not all(isinstance(node, str) and node for node in nodes) | ||
| or len(set(nodes)) != len(nodes) | ||
| or not isinstance(actual, list) | ||
| or not all(isinstance(node, str) for node in actual) | ||
| ): | ||
| message = f"{path}: invalid collection or passed nodes" | ||
| raise ValueError(message) | ||
| if collection is None: | ||
| collection = nodes | ||
| if nodes != collection: | ||
| message = f"{path}: full collections differ between shards" | ||
| raise ValueError(message) | ||
| if actual != nodes[index::shards]: | ||
| message = f"{path}: passed nodes differ from the assigned shard" | ||
| raise ValueError(message) | ||
| indices.add(index) | ||
| passed.extend(actual) | ||
| if indices != set(range(shards)) or Counter(passed) != Counter(collection or []): | ||
| message = "shard coverage must contain every collected node exactly once" | ||
| raise ValueError(message) | ||
| return len(passed) | ||
|
|
||
|
|
||
| def verify_reports(directory: Path, shards: int) -> None: | ||
| """Verify every acceptance group in exactly one artifact per expected shard.""" | ||
| artifacts = sorted(path for path in directory.iterdir() if path.is_dir()) | ||
| if len(artifacts) != shards: | ||
| message = f"expected {shards} shard artifacts, found {len(artifacts)}" | ||
| raise ValueError(message) | ||
| for group in GROUPS: | ||
| count = verify_group([artifact / group / "summary.json" for artifact in artifacts], shards) | ||
| print(f"{group}: all {count} OceanBase cases passed exactly once without skips.", flush=True) | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument( | ||
| "--reports", type=Path, required=True, help="Directory containing one artifact directory per shard" | ||
| ) | ||
| parser.add_argument("--shards", type=int, required=True) | ||
| args = parser.parse_args() | ||
| if args.shards < 1: | ||
| parser.error("--shards must be positive") | ||
| try: | ||
| verify_reports(args.reports, args.shards) | ||
| except (OSError, TypeError, ValueError) as error: | ||
| print(f"Shard verification failed: {error}", file=sys.stderr) | ||
| return 1 | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] 保留旧 job 名后,两份 observability 文档仍把
test_background_metrics.py的执行归给该 job本 PR 把执行体移到
atomic-memory-clean-oceanbase-shards(矩阵0/1/2),而沿用旧 id 的atomic-memory-clean-oceanbase现在只做「下载三个 artifact + 跑check_atomic_memory_migration_shards.py」。但docs/en/development/observability.md:136与docs/zh/development/observability.md:138仍写「E2E harnessworkflow 的atomic-memory-clean-oceanbasejob 通过 clean migration acceptance runner 执行tests/e2e/test_background_metrics.py,不允许测试 skip」。影响:按 job 名排查 background listener 失败时会落到聚合 job,那里没有
RUN <node>行、也没有background-metrics/background.log;这些证据现在位于atomic-memory-clean-oceanbase-<sha>-shard-0artifact 的background-metrics/下(该组只有 1 个 node,因此只有 shard 0 有background.log)。文档描述的「执行者」与本 head 的实现不一致。证据:
git grep -n "atomic-memory-clean-oceanbase" -- docs/只命中上述两行;本 head 的聚合 job121522025190日志(Check out→Download shard reports→Verify complete execution coverage)只有 5 行... cases passed exactly once without skips.汇总,没有任何RUN/pytest 输出。仓库内不存在其它引用旧 job 名的脚本或 workflow(.github/ci-paths.toml、master.yml的 seekdb 路径都用--shard默认值,未受影响)。建议:同一 PR 内把两份文档改成「
...-shards(三个 runner)执行、atomic-memory-clean-oceanbase负责聚合校验」,并说明background.log在 shard 0 的 artifact 内。聚合 job 本身已 success(scope-search 2 / background-metrics 1 / clean-migration 47 / startup-snapshot 3 / long-query 8),所以这条不影响门禁,只影响按文档排障。