GeezerVison is showing github.com — [Redis 8.12] Add BITRANGEINTARRAY command support by a-TODO-rov · Pull Request #4830 · redis/jedis
Conversation
a-TODO-rov
commented
Nov 5, 2026
•
edited by cursor
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Add BITRANGEINTARRAY command support
Summary
Adds bitrangeintarray for the Redis 8.12 BITRANGEINTARRAY command (redis/redis#15986). It returns the offsets of the set bits in a range of a bitmap, or of the clear bits with ZEROS, as List<Long>. It works on string and native bitmaps, and is available across the String, binary and pipeline APIs.
Key Decisions & Assumptions
- There are two forms:
bitrangeintarray(key, start, end) and bitrangeintarray(key, start, end, BitRangeIntArrayParams). Start and end are mandatory, as they are on the server.
BitRangeIntArrayParams carries the unit (BitCountOption), limit(long) and zeros(). It sends them in a fixed order, each at most once.
- A negative
limit throws IllegalArgumentException, because the server always rejects it. limit(0) is sent as LIMIT 0.
- The command is added to
DefaultCacheable, like BITCOUNT and BITPOS.
StaticCommandFlagsRegistryInitializer is intentionally unchanged. Its entry comes with the next regeneration from an 8.12 server. Routing doesn't depend on it: keyed commands go to the slot's primary, or to a replica via executeCommandToReplica.
- No
ClusterCommandObjects override is needed: it is a single-key command.
Behavioral / Conceptual Changes
- In BYTE units (the default), a
LIMIT page can hold up to count + 7 offsets, because the server completes the last byte. The Javadoc on limit states the paging rule for both units.
- Servers older than 8.12 reply with
ERR unknown command. There is no client-side version check.
Testing
- Unit tests cover the params (validation, wire order, equals/hashCode), the command arguments, the delegation and cacheability.
- Integration tests run on standalone and cluster with RESP2 and RESP3. They cover string and native bitmaps, paging, replica reads, client-side cache invalidation and the legacy
Jedis client. They are gated with @EnabledOnCommand("BITRANGEINTARRAY").
RedisConditions.hasCommand now uses lower-case names to match the COMMAND reply.
Notes
- The release-notes entry needs this PR's link added.
Note Low Risk
Additive bitmap read API with no changes to existing commands; failures on Redis older than 8.12 are the expected unknown-command errors.
Overview
Adds client support for Redis 8.12 BITRANGEINTARRAY: new bitrangeintarray overloads on String and binary keys return matching bit offsets as List<Long>, wired through CommandObjects, Jedis, UnifiedJedis, and pipeline APIs.
Introduces BitRangeIntArrayParams for optional BYTE/BIT range units, LIMIT, and zeros() (clear-bit offsets), with protocol registration of BITRANGEINTARRAY and the ZEROS keyword. DefaultCacheable treats the command as cacheable by default.
8.1.0 release notes document the API; build formatting includes the new params/tests. Coverage adds params/unit, integration (ranges, paging, pipeline/transaction), mocked delegation, and a small cacheability test.
Reviewed by Cursor Bugbot for commit 74eca5a. Bugbot is set up for automated code reviews on this repo. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Carries the unit (BYTE or BIT), LIMIT count and ZEROS options of
BITRANGEINTARRAY, sent in that fixed order. A negative count is
rejected before sending, since the server always rejects it.
Returns the offsets of the set bits, or of the clear bits with ZEROS,
in a range of a bitmap, as List<Long>. Added to the String and binary
command interfaces and their pipeline variants, CommandObjects,
UnifiedJedis, PipeliningBase and Jedis.
BITRANGEINTARRAY is a read-only, single-key command like BITCOUNT and
BITPOS, so its replies are cacheable by default.
Cover the params arguments, the command arguments, delegation from
UnifiedJedis and PipeliningBase, and default cacheability.
Cover ranges, empty replies, LIMIT and paging, ZEROS, native bitmaps,
errors, the legacy client with pipeline and transaction, client-side
caching and the connection close on the output buffer limit.
COMMAND replies command names in lower case, so the upper-case lookup
never matched and the command assumptions in the BITRANGEINTARRAY
caching and unknown-command tests always took the same branch.
In BYTE units the server completes the byte of the last offset, so a
page can hold more than count offsets.
Only the form with BitRangeIntArrayParams can send ZEROS or LIMIT.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-11T12:12:42.379366Z |
74eca5a |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Test Results
220 files + 9 220 suites +9 1m 8s ⏱️ - 6m 36s
3 936 tests - 4 427 3 930 ✅ - 4 170 6 💤 - 257 0 ❌ ±0
3 905 runs - 4 478 3 899 ✅ - 4 221 6 💤 - 257 0 ❌ ±0
Results for commit 8308d7a. ± Comparison against base commit c701a36.
This pull request removes 8363 and adds 3936 tests. Note that renamed tests count towards both.
redis.clients.jedis.ACLJedisPoolTest ‑ allowUrlWithNoDBAndNoPassword
redis.clients.jedis.ACLJedisPoolTest ‑ checkCloseableConnections
redis.clients.jedis.ACLJedisPoolTest ‑ checkConnections
redis.clients.jedis.ACLJedisPoolTest ‑ checkPoolOverflow
redis.clients.jedis.ACLJedisPoolTest ‑ checkPoolRepairedWhenJedisIsBroken
redis.clients.jedis.ACLJedisPoolTest ‑ checkResourceIsClosableAndReusable
redis.clients.jedis.ACLJedisPoolTest ‑ checkResourceWithConfigIsClosableAndReusable
redis.clients.jedis.ACLJedisPoolTest ‑ customClientName
redis.clients.jedis.ACLJedisPoolTest ‑ customClientNameNoSSL
redis.clients.jedis.ACLJedisPoolTest ‑ nonDefaultDatabase
…
ALL_AVAILABLE Policy Tests ‑ shouldContinueWhenAllPending
ALL_AVAILABLE Policy Tests ‑ shouldContinueWhenPending
ALL_AVAILABLE Policy Tests ‑ shouldFailImmediatelyWithAnyFailure
ALL_AVAILABLE Policy Tests ‑ shouldFailWhenAllConnectionsFail
ALL_AVAILABLE Policy Tests ‑ shouldFailWhenAnyConnectionFails
ALL_AVAILABLE Policy Tests ‑ shouldFailWithEmptyContext
ALL_AVAILABLE Policy Tests ‑ shouldFailWithSingleFailure
ALL_AVAILABLE Policy Tests ‑ shouldSucceedWhenAllAvailable
ALL_AVAILABLE Policy Tests ‑ shouldSucceedWithSingleConnection
ConformsTo Policy Evaluation Tests ‑ shouldDelegateToPolicy
…
This pull request removes 263 skipped tests and adds 6 skipped tests. Note that renamed tests count towards both.
redis.clients.jedis.MultiDbClientTest[2] ‑ testCachePreservedAcrossDatabaseSwitches()[2]
redis.clients.jedis.MultiDbClientTest[2] ‑ testCacheWithDynamicDatabaseAddition()[2]
redis.clients.jedis.MultiDbClientTest[2] ‑ testCacheWithMultiDbClient()[2]
redis.clients.jedis.MultiDbClientTest[2] ‑ testCacheWithMultiDbClientPoolRecreation()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonArrLenRoot()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonDebugMemoryRoot()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonGetWithClass()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonObjKeysRoot()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonObjLenRoot()[2]
redis.clients.jedis.commands.commandobjects.CommandObjectsJsonCommandsTest[2] ‑ testJsonStrAppendRootPath()[2]
…
redis.clients.jedis.PushMessageNotificationTest ‑ testConnectionResp3PushNotifications
redis.clients.jedis.PushMessageNotificationTest ‑ testConnectionResp3PushNotificationsWithCustomListener
redis.clients.jedis.UdsTest ‑ jedisConnectsToUds
redis.clients.jedis.UdsTest ‑ jedisConnectsToUdsResp3
redis.clients.jedis.UdsTest ‑ redisClientConnectsToUds
redis.clients.jedis.UdsTest ‑ redisClientConnectsToUdsResp3
♻️ This comment has been updated with latest results.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ap tests
The native bitmap tests now read each node's bitmap-default-roaring and
proto-max-bulk-len before changing them and restore exactly those values,
trying every node even when one restore fails.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c34c19bc65
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
|
@Test
|
|
|
public void testBitrangeintarray() {
|
|
|
String key = "key";
|
|
|
byte[] bkey = "key".getBytes();
|
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.
Use SafeEncoder for the new binary test keys
Both new mocked binary-key cases construct bytes with String.getBytes(); the same pattern appears in UnifiedJedisBitmapCommandsTest. This uses the platform charset instead of Jedis's configured SafeEncoder charset, so these tests do not exercise the supported string-to-byte conversion path on alternate-charset setups. Replace both calls with SafeEncoder.encode("key").
AGENTS.md reference: AGENTS.md:L81-L83
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
ggivo reacted with thumbs up emoji
Uh oh!
There was an error while loading. Please reload this page.
No test relies on it any more: every BITRANGEINTARRAY test is gated by @EnabledOnCommand.
Tests of the command run only where the server has it.
The client-side cache test base now registers EnabledOnCommandCondition, as JedisCommandsTestBase does, so the annotation takes effect in all its runners.
ggivo
changed the title
Add BITRANGEINTARRAY command support
[8.12] Add BITRANGEINTARRAY command support
Nov 5, 2026
The interface and params Javadocs restated the server's paging rules;
they now say what each method and option does and link the command page.
Test comments drop the Scenario BRIA-xx ids, which refer to a document
that isn't in the repo.
Reading from a replica and caching a reply work the same for every
command, so these tests add nothing specific to BITRANGEINTARRAY. The
replica test also repeated testReadFromReplicas' replica setup and waited
up to 10 s. DefaultCacheableTest still covers that the command is cacheable.
The native bitmap, 32-bit offset and output-buffer tests set
bitmap-default-roaring, proto-max-bulk-len and client-output-buffer-limit
on the shared test servers, which stay changed if the restore fails. What
they check on the client side, decoding integer arrays and a closed
connection, is not specific to this command.
Keep the integration tests that exercise the client: the range forms and
units, empty replies, the byte[] forms, all options together, and the
legacy String/byte[], pipeline and transaction calls. Drop the ones that
check server semantics (BITCOUNT parity, paging, LIMIT and ZEROS rules,
WRONGTYPE, the value left unchanged) or repeat a params unit test.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c861f5a9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* Same as {@link #bitrangeintarray(String, long, long)}, with these options from {@code params}:
|
|
|
* <ul>
|
|
|
* <li>{@code unit(BIT)}: start and end are bit indexes instead of byte indexes</li>
|
|
|
* <li>{@code limit(count)}: return at most {@code count} offsets</li>
|
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.
Correct the LIMIT guarantee for BYTE ranges
When callers leave the default BYTE unit or explicitly select it, the server completes the byte containing the countth match, so the response can contain up to count + 7 offsets—as the new BitRangeIntArrayParams.limit documentation itself explains. This public API therefore promises a hard maximum it does not provide, which can mislead callers that size buffers or reject responses based on count; qualify the guarantee as BIT-only and document the BYTE behavior here.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 5, 2026
ggivo
changed the title
[8.12] Add BITRANGEINTARRAY command support
[Redis 8.12] Add BITRANGEINTARRAY command support
Nov 6, 2026
This was referenced Nov 10, 2026
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
ggivo
ggivo approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|