Skip to content

fix(mysql): 修复 JdbcStore 在 utf8mb4 下初始化表失败 - #1781

Merged
chickenlj merged 3 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1765-mysql-schema
Jun 18, 2026
Merged

chickenlj merged 3 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1765-mysql-schema

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

关联 Issue

背景

MySQL/MariaDB 下 agentscope_store 的联合主键在 utf8mb4 编码下超过 InnoDB 3072 字节限制,导致 schema 初始化失败。

修改

  • 将 MySQL 方言中的 namespace_path 调整为 VARCHAR(512)
  • 将 item_key 调整为 VARCHAR(255)
  • 新增回归测试,校验联合主键长度不超过 InnoDB 的 utf8mb4 限制

验证

  • mvn -pl agentscope-extensions/agentscope-extensions-mysql -am -Dtest=MysqlJdbcStoreDialectTest test

@guslegend0510
guslegend0510 requested a review from a team June 16, 2026 14:57
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/ext/integration External protocols & middleware integrations labels Jun 17, 2026

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR fixes MysqlJdbcStoreDialect failing to create tables under utf8mb4 encoding due to the composite primary key exceeding InnoDB's 3072-byte index limit. The fix reduces namespace_path to VARCHAR(512) and increases item_key to VARCHAR(255), yielding (512+255) × 4 = 3068 bytes ≤ 3072 — mathematically correct. A regression test validates the constraint. The namespace_path reduction from 768 to 512 is a silent truncation, though the original value was already unusable under utf8mb4.

(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR fixes MysqlJdbcStoreDialect failing to create tables under utf8mb4 encoding due to the composite primary key exceeding InnoDB's 3072-byte index limit. The fix reduces namespace_path to VARCHAR(512) and increases item_key to VARCHAR(255), yielding (512+255) × 4 = 3068 bytes ≤ 3072 — mathematically correct. A regression test validates the constraint. The namespace_path reduction from 768 to 512 is a silent truncation, though the original value was already unusable under utf8mb4.

(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)

@chickenlj chickenlj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chickenlj
chickenlj merged commit 1bef37a into agentscope-ai:main Jun 18, 2026
5 checks passed
wzl521 pushed a commit to wzl521/agentscope-java that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ext/integration External protocols & middleware integrations bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:Failed to initialize JdbcStore schema for table agentscope_store

4 participants