You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "Tangruilin (via GitHub)" <gi...@apache.org> on 2026/05/30 07:46:10 UTC
[PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Tangruilin opened a new pull request, #3507:
URL: https://github.com/apache/kvrocks/pull/3507
…pipeline
Part of #2642
- Add t.Parallel() to all 34 subtests for concurrent execution
- Use util.KeyPrefix(t) for unique key names per subtest
- Replace per-bit SETBIT calls with pipelined SETBIT in Set2SetBit (reduces ~8000 RTTs to 1 RTT for 1000-byte vectors)
- Replace defer with t.Cleanup() so resources live until subtests finish
- Move KeyPrefix helper to dedicated keys.go
- Fix duplicate test name "BITPOS BIT not found check check"
- Test time: 52s → 11s (~4.7x speedup)
Assisted-by: Claude Code:DeepSeek-v4-pro
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk merged PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#issuecomment-4620155809
## [](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3507) **Quality Gate failed**
Failed conditions
 [42.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3507&metric=new_coverage&view=list) (required ≥ 50%)
<!-- sqra:qg_revision=cbe9421cf62d04b083583245a847ff0871807f623239f910232d775e105e54fd -->
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3507)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#issuecomment-4585411147
Greate! Thanks for the PR! I'll take a look at it in a few days.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3395851735
##########
tests/gocase/unit/type/bitmap/bitmap_test.go:
##########
@@ -122,261 +125,313 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
func TestBitmap(t *testing.T) {
srv := util.StartServer(t, map[string]string{})
- defer srv.Close()
+ t.Cleanup(func() { srv.Close() })
ctx := context.Background()
rdb := srv.NewClient()
- defer func() { require.NoError(t, rdb.Close()) }()
+ t.Cleanup(func() { require.NoError(t, rdb.Close()) })
t.Run("GET bitmap string after setbit", func(t *testing.T) {
- require.NoError(t, rdb.SetBit(ctx, "b0", 0, 0).Err())
- require.NoError(t, rdb.SetBit(ctx, "b1", 35, 0).Err())
- Set2SetBit(t, rdb, ctx, "b2", []byte("\xac\x81\x32\x5d\xfe"))
- Set2SetBit(t, rdb, ctx, "b3", []byte("\xff\xff\xff\xff"))
- require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, "b0", "b1", "b2", "b3"))
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ b0, b1, b2, b3 := p+"b0", p+"b1", p+"b2", p+"b3"
+ require.NoError(t, rdb.SetBit(ctx, b0, 0, 0).Err())
+ require.NoError(t, rdb.SetBit(ctx, b1, 35, 0).Err())
+ Set2SetBit(t, rdb, ctx, b2, []byte("\xac\x81\x32\x5d\xfe"))
+ Set2SetBit(t, rdb, ctx, b3, []byte("\xff\xff\xff\xff"))
+ require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, b0, b1, b2, b3))
})
t.Run("GET bitmap with out of max size", func(t *testing.T) {
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ k := p + "b0"
require.NoError(t, rdb.Do(ctx, "config", "set", "max-bitmap-to-string-mb", 1).Err())
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#issuecomment-4716321436
> Thank you!
It looks like the coverage check didn't pass on my PR. The changes are entirely in Go test files, so I'm wondering — could we exclude test code from the coverage analysis?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3355078465
##########
tests/gocase/unit/type/bitmap/bitmap_test.go:
##########
@@ -122,261 +125,313 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
func TestBitmap(t *testing.T) {
srv := util.StartServer(t, map[string]string{})
- defer srv.Close()
+ t.Cleanup(func() { srv.Close() })
ctx := context.Background()
rdb := srv.NewClient()
- defer func() { require.NoError(t, rdb.Close()) }()
+ t.Cleanup(func() { require.NoError(t, rdb.Close()) })
t.Run("GET bitmap string after setbit", func(t *testing.T) {
- require.NoError(t, rdb.SetBit(ctx, "b0", 0, 0).Err())
- require.NoError(t, rdb.SetBit(ctx, "b1", 35, 0).Err())
- Set2SetBit(t, rdb, ctx, "b2", []byte("\xac\x81\x32\x5d\xfe"))
- Set2SetBit(t, rdb, ctx, "b3", []byte("\xff\xff\xff\xff"))
- require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, "b0", "b1", "b2", "b3"))
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ b0, b1, b2, b3 := p+"b0", p+"b1", p+"b2", p+"b3"
+ require.NoError(t, rdb.SetBit(ctx, b0, 0, 0).Err())
+ require.NoError(t, rdb.SetBit(ctx, b1, 35, 0).Err())
+ Set2SetBit(t, rdb, ctx, b2, []byte("\xac\x81\x32\x5d\xfe"))
+ Set2SetBit(t, rdb, ctx, b3, []byte("\xff\xff\xff\xff"))
+ require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, b0, b1, b2, b3))
})
t.Run("GET bitmap with out of max size", func(t *testing.T) {
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ k := p + "b0"
require.NoError(t, rdb.Do(ctx, "config", "set", "max-bitmap-to-string-mb", 1).Err())
Review Comment:
This test modifies the global config. For the sake of rigor, I think we should not run it in parallel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#issuecomment-4714140371
## [](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3507) **Quality Gate failed**
Failed conditions
 [42.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3507&metric=new_coverage&view=list) (required ≥ 50%)
<!-- sqra:qg_revision=e166dc4e4065146bd7e17757a9f746a27b8edf0d511c6a32ec9e5732759eff6d -->
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3507)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3373032525
##########
tests/gocase/unit/type/bitmap/bitmap_test.go:
##########
@@ -122,261 +125,313 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
func TestBitmap(t *testing.T) {
srv := util.StartServer(t, map[string]string{})
- defer srv.Close()
+ t.Cleanup(func() { srv.Close() })
ctx := context.Background()
rdb := srv.NewClient()
- defer func() { require.NoError(t, rdb.Close()) }()
+ t.Cleanup(func() { require.NoError(t, rdb.Close()) })
t.Run("GET bitmap string after setbit", func(t *testing.T) {
- require.NoError(t, rdb.SetBit(ctx, "b0", 0, 0).Err())
- require.NoError(t, rdb.SetBit(ctx, "b1", 35, 0).Err())
- Set2SetBit(t, rdb, ctx, "b2", []byte("\xac\x81\x32\x5d\xfe"))
- Set2SetBit(t, rdb, ctx, "b3", []byte("\xff\xff\xff\xff"))
- require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, "b0", "b1", "b2", "b3"))
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ b0, b1, b2, b3 := p+"b0", p+"b1", p+"b2", p+"b3"
+ require.NoError(t, rdb.SetBit(ctx, b0, 0, 0).Err())
+ require.NoError(t, rdb.SetBit(ctx, b1, 35, 0).Err())
+ Set2SetBit(t, rdb, ctx, b2, []byte("\xac\x81\x32\x5d\xfe"))
+ Set2SetBit(t, rdb, ctx, b3, []byte("\xff\xff\xff\xff"))
+ require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, b0, b1, b2, b3))
})
t.Run("GET bitmap with out of max size", func(t *testing.T) {
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ k := p + "b0"
require.NoError(t, rdb.Do(ctx, "config", "set", "max-bitmap-to-string-mb", 1).Err())
Review Comment:
This subtest changes a global server config (max-bitmap-to-string-mb) while running in parallel with the rest of TestBitmap. Because CONFIG SET is process-wide, it can race with other subtests and cause unrelated GET/bitmap assertions to fail nondeterministically. Capture the previous value and restore it via t.Cleanup (or avoid t.Parallel for this subtest).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3368657958
##########
tests/gocase/util/server.go:
##########
@@ -292,7 +292,6 @@ func StartServerWithCLIOptions(
},
}
}
-
Review Comment:
Revert this unrelated change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3385384528
##########
tests/gocase/unit/type/bitmap/bitmap_test.go:
##########
@@ -122,261 +125,313 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
func TestBitmap(t *testing.T) {
srv := util.StartServer(t, map[string]string{})
- defer srv.Close()
+ t.Cleanup(func() { srv.Close() })
ctx := context.Background()
rdb := srv.NewClient()
- defer func() { require.NoError(t, rdb.Close()) }()
+ t.Cleanup(func() { require.NoError(t, rdb.Close()) })
t.Run("GET bitmap string after setbit", func(t *testing.T) {
- require.NoError(t, rdb.SetBit(ctx, "b0", 0, 0).Err())
- require.NoError(t, rdb.SetBit(ctx, "b1", 35, 0).Err())
- Set2SetBit(t, rdb, ctx, "b2", []byte("\xac\x81\x32\x5d\xfe"))
- Set2SetBit(t, rdb, ctx, "b3", []byte("\xff\xff\xff\xff"))
- require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, "b0", "b1", "b2", "b3"))
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ b0, b1, b2, b3 := p+"b0", p+"b1", p+"b2", p+"b3"
+ require.NoError(t, rdb.SetBit(ctx, b0, 0, 0).Err())
+ require.NoError(t, rdb.SetBit(ctx, b1, 35, 0).Err())
+ Set2SetBit(t, rdb, ctx, b2, []byte("\xac\x81\x32\x5d\xfe"))
+ Set2SetBit(t, rdb, ctx, b3, []byte("\xff\xff\xff\xff"))
+ require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00", "\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, b0, b1, b2, b3))
})
t.Run("GET bitmap with out of max size", func(t *testing.T) {
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ k := p + "b0"
require.NoError(t, rdb.Do(ctx, "config", "set", "max-bitmap-to-string-mb", 1).Err())
Review Comment:
I will fix it tonight
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(test): parallelize bitmap subtests and optimize Set2SetBit with … [kvrocks]
Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#issuecomment-4718237559
> > Thank you!
>
> It looks like the coverage check didn't pass on my PR. The changes are entirely in Go test files, so I'm wondering — could we exclude test code from the coverage analysis?
Because this project won’t block the merge, you don’t need to worry about it.
PS: I think there may still be some issues with the current coverage calculation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org