-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Pika Quality #3194
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
base: unstable
Are you sure you want to change the base?
feat: Pika Quality #3194
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new integration test exercising Telnet/TCP interactions and extends server tests to validate cache-size configuration and admin-command loading/execution; also updates CI cleanup steps in the GitHub Actions workflow. Admin-command checks are duplicated in the server tests. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (4)
tests/integration/network_stability_test.go (2)
11-35: Consider verifying the server's response to empty commands.The test sends an empty command (
\n) but doesn't verify what response, if any, the server returns for it. The subsequent read only validates that PING and ECHO work correctly. To thoroughly test the core dump fix, consider:
- Reading the response after the empty command to confirm the server doesn't crash or send error responses
- Verifying the server remains responsive after processing empty input
Example enhancement:
_, err = conn.Write([]byte("\n")) Expect(err).NotTo(HaveOccurred()) + +// Read response to empty command (may be empty or error) +buf := make([]byte, 1024) +conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond)) +_, _ = conn.Read(buf) +conn.SetReadDeadline(time.Time{}) _, err = conn.Write([]byte("*1\r\n$4\r\nPING\r\n")) Expect(err).NotTo(HaveOccurred()) -buf := make([]byte, 1024) n, err := conn.Read(buf)
37-55: Strengthen validation of multiple empty command handling.Similar to the first test, this validates that PING works after empty commands but doesn't verify the server's actual handling of the empty commands themselves. Consider adding assertions to confirm:
- The server doesn't send unexpected responses to the empty commands
- The connection remains in a valid state throughout
Also note the inconsistency: this test uses
\r\nwhile the first test uses\n. If both represent empty commands in the protocol, consider standardizing on one or explicitly testing both variants.tests/integration/server_test.go (2)
438-461: Consider restoring original configuration values after the test.The test modifies cache configuration parameters but doesn't restore them to their original values. While the
BeforeEachhook flushes the database, configuration changes persist across tests and might affect subsequent test execution.Consider capturing and restoring the original values:
It("should handle cache size configurations correctly", func() { configGet := client.ConfigGet(ctx, "cache-value-item-max-size") Expect(configGet.Err()).NotTo(HaveOccurred()) Expect(configGet.Val()).To(HaveKey("cache-value-item-max-size")) + originalCacheValue := configGet.Val()["cache-value-item-max-size"] configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") Expect(configGet2.Err()).NotTo(HaveOccurred()) Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) + originalMaxKey := configGet2.Val()["max-key-size-in-cache"] + defer func() { + client.ConfigSet(ctx, "cache-value-item-max-size", originalCacheValue) + client.ConfigSet(ctx, "max-key-size-in-cache", originalMaxKey) + }() configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024")
840-843: Test provides minimal validation of thread pool behavior.While this test confirms the auth command executes and returns an error for an invalid password, it doesn't actually verify that the command is processed in the admin thread pool specifically. The test would pass as long as auth is functional, regardless of which thread pool handles it.
If verifying thread pool assignment is critical, consider:
- Adding instrumentation or logging that can be inspected to confirm thread pool usage
- Testing under concurrent load to expose thread pool assignment issues
- Checking server metrics or debug endpoints that expose thread pool statistics
However, if the goal is simply to ensure auth commands work correctly after configuration changes, this test is sufficient.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/integration/network_stability_test.go(1 hunks)tests/integration/server_test.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/integration/network_stability_test.go (1)
tests/integration/options.go (1)
SINGLEADDR(13-13)
tests/integration/server_test.go (1)
src/pika_admin.cc (4)
ConfigGet(1583-2314)ConfigGet(1583-1583)ConfigSet(2317-3098)ConfigSet(2317-2317)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Analyze (go)
- GitHub Check: build_on_ubuntu
- GitHub Check: build_on_macos
- GitHub Check: build_on_centos
🔇 Additional comments (1)
tests/integration/server_test.go (1)
823-837: LGTM with a note about AI summary inconsistency.The test appropriately verifies that the
admin-cmd-listconfiguration is loaded correctly and contains the expected commands.Note: The AI-generated summary mentions "Admin command tests appear duplicated," but only one instance is visible in the provided code. This may be a summary error or refer to content outside the diff scope.
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.
Pull request overview
This PR adds integration tests to validate several bug fixes and configuration improvements in PikaDB:
- Tests for cache configuration parameters (
cache-value-item-max-sizeandmax-key-size-in-cache) - Tests for admin command list configuration loading
- Network stability tests to prevent server crashes from empty commands (telnet-related issue)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| tests/integration/network_stability_test.go | New file adding tests for network stability, validating server doesn't crash when receiving empty commands via raw TCP connections (simulating telnet behavior) |
| tests/integration/server_test.go | Added three test cases: cache size configuration validation, admin-cmd-list config loading verification, and auth command processing in admin thread pool |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Expect(client.Get(ctx, "foo").Err()).To(MatchError(redis.Nil)) | ||
| Expect(client.Get(ctx, "key1").Err()).To(MatchError(redis.Nil)) | ||
| }) | ||
|
|
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet2.Val()).To(Equal("OK")) | ||
|
|
||
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") |
Copilot
AI
Dec 5, 2025
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.
Missing error check before accessing result. The error should be checked with Expect(configGet3.Err()).NotTo(HaveOccurred()) before accessing configGet3.Val() to prevent potential panics if the ConfigGet operation fails.
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Err()).NotTo(HaveOccurred()) |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | ||
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | ||
|
|
||
| configGet4 := client.ConfigGet(ctx, "max-key-size-in-cache") |
Copilot
AI
Dec 5, 2025
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.
Missing error check before accessing result. The error should be checked with Expect(configGet4.Err()).NotTo(HaveOccurred()) before accessing configGet4.Val() to prevent potential panics if the ConfigGet operation fails.
| configGet4 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| configGet4 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| Expect(configGet4.Err()).NotTo(HaveOccurred()) |
|
|
||
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | ||
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet1.Val()).To(Equal("OK")) | ||
|
|
||
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | ||
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet2.Val()).To(Equal("OK")) | ||
|
|
||
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | ||
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | ||
|
|
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | |
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) |
|
|
||
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | ||
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | ||
|
|
||
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | ||
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet1.Val()).To(Equal("OK")) | ||
|
|
||
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | ||
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet2.Val()).To(Equal("OK")) | ||
|
|
||
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | ||
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | ||
|
|
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | |
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | |
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | |
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) |
| configGet := client.ConfigGet(ctx, "admin-cmd-list") | ||
| Expect(configGet.Err()).NotTo(HaveOccurred()) | ||
| Expect(configGet.Val()).To(HaveLen(1)) | ||
|
|
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
|
|
||
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | ||
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | ||
|
|
||
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | ||
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet1.Val()).To(Equal("OK")) | ||
|
|
||
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | ||
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet2.Val()).To(Equal("OK")) | ||
|
|
||
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | ||
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | ||
|
|
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | |
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) | |
| configGet2 := client.ConfigGet(ctx, "max-key-size-in-cache") | |
| Expect(configGet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configGet2.Val()).To(HaveKey("max-key-size-in-cache")) | |
| configSet1 := client.ConfigSet(ctx, "cache-value-item-max-size", "1024") | |
| Expect(configSet1.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet1.Val()).To(Equal("OK")) | |
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | |
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | |
| Expect(configSet2.Val()).To(Equal("OK")) | |
| configGet3 := client.ConfigGet(ctx, "cache-value-item-max-size") | |
| Expect(configGet3.Val()["cache-value-item-max-size"]).To(Equal("1024")) |
|
|
||
| configSet2 := client.ConfigSet(ctx, "max-key-size-in-cache", "1048576") | ||
| Expect(configSet2.Err()).NotTo(HaveOccurred()) | ||
| Expect(configSet2.Val()).To(Equal("OK")) |
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
| Expect(configGet.Val()).To(HaveLen(1)) | ||
|
|
||
| adminCmdList, ok := configGet.Val()["admin-cmd-list"] | ||
| Expect(ok).To(BeTrue()) |
Copilot
AI
Dec 5, 2025
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.
Trailing whitespace detected. Remove trailing whitespace to maintain code cleanliness and consistency with Go formatting standards.
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pika.yml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Analyze (go)
- GitHub Check: build_on_centos
- GitHub Check: build_on_ubuntu
| rm -rf /__w/pikiwidb/pikiwidb/buildtrees 2>/dev/null || true | ||
| rm -rf /__w/pikiwidb/pikiwidb/deps 2>/dev/null || true | ||
| find /__w/pikiwidb/pikiwidb -type f \( -name "librocksdb.a" -o -name "libprotoc.a" -o -name "libprotobuf.a" \) -delete 2>/dev/null || true | ||
| find /__w/pikiwidb/pikiwidb -type f \( -name "*.o" -o -name "*.a" -o -name "*.la" -o -name "*.so" -o -name "*_test" \) ! -path "*/build/pika" -delete 2>/dev/null || true |
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.
Fix path exclusion pattern to preserve entire build/pika subtree.
The exclusion pattern ! -path "*/build/pika" only excludes paths that exactly match */build/pika, not files within that directory. Files like /__w/pikiwidb/pikiwidb/build/pika/bin/pika.a would still be deleted because their full path doesn't match the pattern.
Extend the pattern to exclude the entire subtree.
- find /__w/pikiwidb/pikiwidb -type f \( -name "*.o" -o -name "*.a" -o -name "*.la" -o -name "*.so" -o -name "*_test" \) ! -path "*/build/pika" -delete 2>/dev/null || true
+ find /__w/pikiwidb/pikiwidb -type f \( -name "*.o" -o -name "*.a" -o -name "*.la" -o -name "*.so" -o -name "*_test" \) ! -path "*/build/pika/*" -delete 2>/dev/null || true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| find /__w/pikiwidb/pikiwidb -type f \( -name "*.o" -o -name "*.a" -o -name "*.la" -o -name "*.so" -o -name "*_test" \) ! -path "*/build/pika" -delete 2>/dev/null || true | |
| find /__w/pikiwidb/pikiwidb -type f \( -name "*.o" -o -name "*.a" -o -name "*.la" -o -name "*.so" -o -name "*_test" \) ! -path "*/build/pika/*" -delete 2>/dev/null || true |
🤖 Prompt for AI Agents
.github/workflows/pika.yml around line 176: the find command currently uses !
-path "*/build/pika" which only protects the directory itself but not files
under it; update the exclusion to cover the entire subtree (for example change
the pattern to ! -path "*/build/pika/*" or use -path "*/build/pika" -prune) so
files inside build/pika (and its subdirs) are not deleted.
#3043 #3047
这两处修复都涉及到了参数cache-value-item-max-size 和 max-key-size-in-cache
添加测试点:
● 验证配置项的存在性:通过ConfigGet命令确认cache-value-item-max-size 和max-key-size-in-cache 配置项存在
● 验证配置可以被设置:通过ConfigSet命令尝试设置配置值
#3048
用例验证配置项 admin-cmd-list 中是否包含 "auth" 命令,确保配置被正确设置。
#3095
测试了两种情况:
● 使用原始 TCP 连接来模拟 telnet 客户端行为
● 验证服务器不会崩溃并能继续处理正常命令
测试结果如下:

Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.