feat(spider-storage): Add support for MySQL database. - #450
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughChangesMariaDB generated ID handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change adds MySQL storage support by replacing MariaDB-specific insert-returning behavior, with reported end-to-end tests passing for both MariaDB and MySQL; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
LinZhihao-723
left a comment
There was a problem hiding this comment.
First of all, storage is not a valid scope for the PR title/commit message. Please spend more time drafting the PR title, as you are constantly making this mistake.
LinZhihao-723
left a comment
There was a problem hiding this comment.
Before we merge: can you run unit tests with MySQL DB backend to make sure task test:rust-unit-tests can pass?
|
@CodeRabbit Please open an issue to run unit tests on both MariaDB and MySQL in task and in CI. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="y-scope/spider"
pr_number="450"
requester="sitaowang1998"
pr_url="https://github.com/${repo}/pull/${pr_number}"
comment_url="$(
gh api "repos/${repo}/issues/${pr_number}/comments" --paginate \
--jq '.[] | select(.user.login == "sitaowang1998" and (.body | contains("Please open an issue to run unit tests on both MariaDB and MySQL in task and in CI."))) | .html_url' \
| head -n 1
)"
if [ -z "${comment_url}" ]; then
comment_url="${pr_url}"
fi
issue_body="$(cat <<EOF
## Summary
Run the storage unit-test suite against both MariaDB and MySQL.
## Rationale
PR `#450` removes MariaDB-specific \`RETURNING\` syntax so Spider supports MySQL. The test workflow must validate database behaviour on both supported database engines.
## Required changes
- Update the task-based local test workflow to run the relevant unit tests with MariaDB and with MySQL.
- Update CI to run the relevant unit tests with MariaDB and with MySQL.
- Keep database setup and test configuration explicit for each engine.
- Ensure test failures identify the database engine that failed.
## Affected areas
- Storage database test configuration.
- Task definitions for unit tests.
- CI workflow definitions that provision database services and run unit tests.
## Acceptance criteria
- A developer can run the relevant unit tests through the project task workflow against MariaDB.
- A developer can run the same unit tests through the project task workflow against MySQL.
- CI executes the relevant unit tests against MariaDB and MySQL.
- CI reports failures separately for each database engine.
- The documented test commands and CI configuration remain reproducible.
## Backlinks
- Pull request: ${pr_url}
- Request comment: ${comment_url}
- Requested by: @${requester}
EOF
)"
issue_url="$(
gh issue create \
--repo "${repo}" \
--title "test(storage): Run unit tests against MariaDB and MySQL in task workflows and CI" \
--body "${issue_body}" \
--assignee "${requester}"
)"
printf 'Created issue: %s\n' "${issue_url}"Length of output: 2267
You are interacting with an AI system. |
Description
Background
The current
Spideronly support MariaDB as the database in storage, and it usesRETURNING ...syntax, which is a MariaDB-only extension.During @20001020ycx testing, the incompatibility with MySQL database was exposed.
Change
This PR replaces all 5
RETURNING idin the code withsqlx::last_insert_id. NowSpidersupports MySQL as database.Checklist
breaking change.
Validation performed
Unit Tests
Run unit tests with both MariaDB and MySQL 8.0-debian. All tests pass.
End-to-End Tests
Run the end-to-end tests from #385 using Docker Compose local support. The end-to-end tests run on two clusters, one using the bundled MariaDB, the other one with bundled MariaDB replaced by MySQL 8.0-debian. Both test executions pass.
Summary by CodeRabbit