Repository navigation
fix(runtime): make concurrent OceanBase replica startup idempotent - #1957
Tsukikage7 wants to merge 13 commits into
Conversation
|
Ready for review? |
|
@hidb4ai Yes, this is ready for code review. I've marked it ready. Main and E2E pass on the current head, c8a0730. This supersedes the description's earlier note about upstream workflows awaiting authorization. GitHub still reports merge conflicts, and Desktop validation fails in the Windows CLI diagnostic probe ( The source and real OceanBase validation details are documented in the description. Published-image and unmodified Helm chart acceptance remain unverified, separate from the completed source-fixture acceptance. |
hidb4ai
left a comment
There was a problem hiding this comment.
Found one startup compatibility regression for already provisioned databases; details inline.
| for table in metadata.sorted_tables: | ||
| if table not in selected: | ||
| continue | ||
| await connection.execute(CreateTable(table, if_not_exists=True)) |
There was a problem hiding this comment.
[P2] Preserve startup with a provisioned schema and DML-only account
IF NOT EXISTS still checks CREATE privileges on OceanBase for an existing table. On real OceanBase CE 4.3.5.5, I initialized the Access schema and static administrator, granted the runtime user only SELECT/INSERT/UPDATE/DELETE, and called open_builtin_access_control with the same preset. Base 329b4be7 starts and authorizes server.admin; c8a0730 fails here with 1142 (CREATE command denied on pc_access_audit). Restarting this already provisioned deployment now requires expanding its runtime database privileges. Please preserve a no-DDL path for existing objects while retaining race-safe creation for missing tables and indexes.
There was a problem hiding this comment.
本轮在 head 4748ad6b 上核了这条 P2 的修复状态,结论分两半。
已闭合的两处(FULLTEXT 索引)
4748ad6b 给两个站点补了存在性查询,只有索引缺失时才发 CREATE ... IF NOT EXISTS:
oceanbase/atomic_memory_index.py:104-111(information_schema.statistics+_INDEX_EXISTS);oceanbase/experience_index.py:72-76(新增_OCEANBASE_FTS_INDEX_EXISTS_SQL);topic_memory_index.py::_ensure_index本来就有同样的守卫。
test_native_schema_creation.py::test_fulltext_initialization_preserves_provisioned_and_missing_indexes 用 1142 断言 provisioned 时不发 CREATE;exact head 副本 tests/builtin/persistence/ + tests/test_access_bootstrap.py 为 803 passed / 5 failed,5 个失败在 base 0c1dfc28 同集合复现(Windows 文件锁 + test_mysql_vector_admission 的 allow_missing_database 桩签名),非本 PR 引入。
仍未覆盖的部分(表路径)
启动期还会发 DDL 的站点至少有:
create_tables()→_create_mysql_tables()(persistence/schema.py:70):用inspect().has_table(),MySQL 方言实现是DESCRIBE,只吞 1146/1049/1051(本仓 pin 的 SQLAlchemy 2.0.51),其余错误上抛;表存在则不进入CreateTable(if_not_exists=True);ensure_artifact_head_searchable_text()与require_current_schema()的 ALTER:均以 information_schema 查询为前提。
你报告的失败对象是 pc_access_audit,那是一张表,落在 _create_mysql_tables() 这条线上,而该线本 head 未改。从 head 源码看,只有 has_table() 对该表返回 False 时才会发 CREATE TABLE IF NOT EXISTS;DML 账户持有 SELECT 时 DESCRIBE 应当成功,所以我这边(无真实 OceanBase)无法复现该分支,也无法确认 c8a07306 的 1142 是来自表路径还是当时的索引路径(c8a07306 确实删过 atomic 的存在性检查,4748ad6b 又加回来了)。
请在 4748ad6b 上重跑一次 DML-only 复现,并给出失败语句原文与对象名,以判定:
- 报错对象是
pc_atomic_memory_current/pc_artifact_heads的索引 ⇒ 本 head 已闭合,可以解除; - 报错对象仍是
pc_access_audit等表 ⇒ 说明该租户下has_table()返回 False,需要对表路径同样改成"先查 information_schema、再决定是否 CREATE",这条 P2 不能算解除。
There was a problem hiding this comment.
Replayed the original scenario on c430184918b9e6a03457715d8a0191eb893e1777 against real OceanBase CE 4.3.5.5: provision the Access schema and static administrator with the administrative account, grant a separate runtime account only SELECT/INSERT/UPDATE/DELETE, then call open_builtin_access_control with the same preset. Both consecutive startups now succeed and authorize server.admin. The original c8a0730 failure was indeed CREATE TABLE IF NOT EXISTS pc_access_audit: that version executed table DDL unconditionally. The current has_table() guard removes that path. This reported Access startup regression is fixed.
…61030 # Conflicts: # src/powercontext/builtin/persistence/oceanbase/atomic_memory_index.py # src/powercontext/builtin/persistence/oceanbase/experience_index.py # src/powercontext/builtin/persistence/oceanbase/topic_memory_index.py # src/powercontext/builtin/persistence/schema.py
hireview001
left a comment
There was a problem hiding this comment.
- Resolve merge conflicts with the target branch.
- CI failed: tests (3.11, unit) (failure).
- CI failed: tests (3.14, unit) (failure).
- CI failed: tests (3.12, unit) (failure).
- CI failed: tests (3.13, unit) (failure).
- CI failed: quality (failure).
- CI failed: Recall effort (OceanBase) (failure).
- CI failed: E2E harness (failure). Failed steps: Recall effort (OceanBase) / Check code and types on Linux.
- CI failed: Main (failure). Failed steps: quality / Run checks; tests (3.13, unit) / Run unit tests; tests (3.12, unit) / Run unit tests.
| quoted_name = re.escape(preparer.quote_identifier(name)) | ||
| quoted_column = re.escape(preparer.quote_identifier(column.name)) |
There was a problem hiding this comment.
[P2] Recognize unquoted native index definitions
With sql_quote_show_create=OFF, OceanBase returns VECTOR KEY ix_pc_atomic_memory_current_embedding (embedding) ..., so these mandatory quoted patterns never match the existing index. Reinitialization then issues CREATE again and fails with 1235, aborting Atomic Memory initialization. On real OceanBase CE 4.3.5.5, the complete OceanBaseAtomicMemoryIndex(profile).initialize(connection) succeeds at merge base 5032075, fails at c4301849 against the same provisioned database with this session setting, and succeeds again after only restoring sql_quote_show_create=ON. Please support both valid SHOW CREATE forms, or normalize the setting while preserving the caller's session state, so compatible existing indexes remain reusable.
There was a problem hiding this comment.
Verified on 8cabe99af6c59f27b2189479bee87b784c87423a against native OceanBase CE 4.4.2.1: the live regression confirms unquoted SHOW CREATE output and successful Atomic Memory reinitialization with sql_quote_show_create=OFF. Concurrent and repeated native-vector initialization also passed. This finding is fixed.
| ) | ||
| ) | ||
| ).all() | ||
| assert set(rows) == { |
There was a problem hiding this comment.
[P2] Scope the FULLTEXT inventory assertion to the tested projections
This query inventories every FULLTEXT index in the database, but _isolated_database() now provisions BUILTIN_TABLES, including pc_artifact_search_text and its ix_pc_artifact_search_fts index. On real OceanBase CE 4.3.5.5 at c4301849, all concurrent initializers and the repeated initialization completed, then this assertion failed because the result also contained ('pc_artifact_search_text', 'ix_pc_artifact_search_fts', 'FULLTEXT'). The new live acceptance test therefore fails on the current valid builtin schema. Restrict the query/assertion to the four projections being tested, while still requiring all four expected native indexes, so unrelated registered indexes do not break concurrent-startup acceptance.
There was a problem hiding this comment.
Verified on 8cabe99af6c59f27b2189479bee87b784c87423a against native OceanBase CE 4.4.2.1: concurrent and repeated FULLTEXT initialization now passes with the full builtin schema, including the unrelated Artifact search index. The assertion still requires all four expected projection indexes. This finding is fixed.
hireview001
left a comment
There was a problem hiding this comment.
- Resolve merge conflicts with the target branch.
knqiufan
left a comment
There was a problem hiding this comment.
The existing unquoted VECTOR index recognition and FULLTEXT inventory findings still apply to this head. Please address those existing threads before merging; the earlier DML-only account issue has been fixed.
|
Update on
The live startup suite passed 6/6, no skips, against native OceanBase CE 4.4.2.1 (Linux arm64), including concurrent startup, repeated startup, and the unquoted VECTOR regression. The same runtime image also passed the staged Helm and Pod failover acceptance reported in #1609. Main CI is still running; its preflight and documentation checks have passed. |
hidb4ai
left a comment
There was a problem hiding this comment.
Both previously reported findings are fixed on 8cabe99a and passed native OceanBase replay. I am holding approval because Main CI failed in test_model_ingress_authentication_with_real_core_and_provider[enforcing-responses] with httpx.RemoteProtocolError, and dependent upgrade/backend validation was skipped. I have not established that CI failure as a regression introduced by this PR. Please rerun the failed test matrix and dependent validation successfully before merging.
hidb4ai
left a comment
There was a problem hiding this comment.
Reviewed b4b85c7a. The previously reported startup regressions remain fixed, including unquoted native VECTOR definitions and FULLTEXT inventory scope. Native OceanBase replay and repeated Access startup with a DML-only account passed; current PR CI and the selected upgrade checks are green. No blocking findings, new database tables, or public interfaces.
hireview001
left a comment
There was a problem hiding this comment.
- Resolve merge conflicts with the target branch.
Preserve native idempotent index creation and bounded authorization retries with the built-in authorization layout and OceanBase vector encoding. Align the evidence-schema test fixture with provisioned tables and refresh the 1.5.2 schema review. Validated make check, make contract-test, focused startup regressions, seven native OceanBase tests, and two DML-only Access startups.
Retain the idempotent startup changes alongside batched Atomic Memory reads and publication, and refresh the schema review against the merged persistence inputs. Validated make check, focused persistence regressions, seven native OceanBase startup/search tests, and three native related-pagination tests.
hireview001
left a comment
There was a problem hiding this comment.
- CI failed: CI result (failure).
- CI failed: harness-validation / Acceptance (sqlite) (failure).
- CI failed: script-installation / installation (ubuntu-latest) (failure).
- CI did not complete: gateway-validation / check (cancelled).
- CI did not complete: openclaw-package (cancelled).
- CI failed: Main (failure). Failed steps: openclaw-package / Post Set up the Python environment; gateway-validation / check / Post Install Python Core for mandatory UDS recovery acceptance; script-installation / installation (ubuntu-latest) / Exercise bootstrap, version selection, profiles, and persistent memory.
hidb4ai
left a comment
There was a problem hiding this comment.
Rechecked 59f39f813. The startup findings remain fixed and the merge conflicts are resolved. No new code defect, database table, or public interface was found. Current CI still needs successful completion:
- Linux installation exceeds its 300-second deadline during the initial client installation; dependency resolution and preparation alone took about 290 seconds.
- SQLite acceptance fails all three trials with
AgentSetupTimeoutErrorafter 360 seconds while installing agent dependencies, before task execution.
Those setup paths are unchanged from base 44aded6; these logs do not establish a regression introduced by this PR. Gateway and OpenClaw test steps passed, but their jobs were cancelled during cache-upload cleanup. Please rerun the failed and cancelled checks successfully before merging. Approval of this head is on hold pending that validation.
hireview001
left a comment
There was a problem hiding this comment.
- Resolve merge conflicts with the target branch.
hidb4ai
left a comment
There was a problem hiding this comment.
Confirmed the reported merge conflict for unchanged head 59f39f813 against current master e65423c6: git merge-tree conflicts in release/upgrade-support.json and the OceanBase Atomic Memory, Experience, and Topic Memory index initializers.
The initialization conflicts overlap master's shared ensure_fulltext_index and its bounded 1205 lock-conflict recovery. Please preserve that recovery and the no-DDL path for existing objects while integrating this PR's idempotent DDL and native VECTOR handling, then revalidate concurrent/repeated startup on the merged result.
The previous CI validation request remains unresolved; there has been no newer run. Approval remains on hold pending conflict resolution and successful validation.
hidb4ai
left a comment
There was a problem hiding this comment.
Rechecked unchanged head 59f39f813 against current master fe9338075. The same four merge conflicts and the previous CI validation request remain unresolved, so approval remains on hold.
Additional validation on real OceanBase CE 4.3.5.4: the concurrent FULLTEXT startup case initially exceeded its 120-second deadline, then passed on an isolated rerun. A paired Experience-initializer check reproduced duplicate-index failures on the base and completed on this head; the timeout therefore does not establish a new PR regression. The real Core/database/model chain also retained generated memory and FTS/vector/hybrid retrieval across app/runtime recreation; this was in-process HTTP coverage, not a separate-process or deployment acceptance test.
Please resolve the conflicts while preserving master's lock-conflict recovery and existing-object no-DDL guards, then validate concurrent startup and CI on the resulting merged commit. Current-head results do not validate that future merge resolution.
Which issue or RFC does this PR close?
Related to #1609. Supplies the runtime cold-start dependency for the API/background Helm deployment in #1854; does not close either item.
Rationale for this change
Concurrent API/background replicas can race between schema existence checks and DDL, or lose a static authorization preset's first unique-key insert. On OceanBase CE 4.4.2.1, native VECTOR creation can additionally return error 1235 even with IF NOT EXISTS while another replica owns the column reservation and its logical index metadata is still settling.
What changes are included in this PR?
pc_atomic_memory_current).The branch includes current master through 329b4be, including upstream cancellation cleanup. The PR's net change is 11 source/test files; no Helm manifests, credentials or acceptance artifacts are included.
Are there any user-facing changes?
Concurrent replicas can initialize a fresh external OceanBase database reliably, while unusable native indexes still prevent startup. No public API or persisted-format change is introduced, and existing SQLite recorder retries are unchanged. Real concurrent cold-start acceptance covered OceanBase CE 4.4.2.1. The final head also passed the CI clean-migration suite on OceanBase CE 4.3.5.6; this is a separate migration/authorization/vector regression scope. Seekdb and other versions have not received concurrent cold-start acceptance for this patch.
How was this change tested?
On final head c8a0730:
uv run --locked python -m pytest tests/builtin/persistence/test_native_schema_creation.py tests/builtin/persistence/test_vector_initialization.py tests/builtin/persistence/test_topic_memory_oceanbase.py tests/test_access_bootstrap.py tests/builtin/persistence/test_sqlite_profile.py tests/builtin/runtime/test_model_usage_recorder.py -q: 87 passed, 1 skipped (no live database configured in this local run).make check: passed, includinguv run --locked prek run -a, both type-check scopes and 49 integration-manifest tests.make docs-test: passed; 916 public pages and their internal links verified.uv run --locked python -m pytest -q: 5060 passed, 430 skipped, 4 deselected, 1 failed in 20m43s. The sole failure is the existingtests/builtin/test_native_code.py::test_credentials_and_symlinks_are_not_readfixture attempting togit add .envunder the host global Git ignore rule. The exact test passed separately withGIT_CONFIG_GLOBAL=/dev/null; user Git configuration and test source were unchanged.action_required, awaiting maintainer authorization; the fork run does not replace upstream required checks.Separate real-backend acceptance was completed before the latest master merge, using the final six production-file patch on base 2058325. These production files are identical on this PR head:
Limit: the Kubernetes run used a temporary source fixture, not a newly published application image. Published-image pull/entrypoint and the unmodified chart against that image remain unverified. The real-backend and Kubernetes acceptance has not been rerun after the latest master merge; the cleaned environment was not recreated.
AI usage statement
OpenAI Codex assisted with implementation and validation. The exact model identifier was not recorded in the local task evidence.