Skip to content

Use bulk string response for VGETATTR#1830

Merged
tiagonapoli merged 2 commits into
mainfrom
tiagonapoli/fix-vgetattr-response
May 27, 2026
Merged

Use bulk string response for VGETATTR#1830
tiagonapoli merged 2 commits into
mainfrom
tiagonapoli/fix-vgetattr-response

Conversation

@tiagonapoli
Copy link
Copy Markdown
Collaborator

VGETATTR was using \WriteSimpleString\ to send attribute data. This switches to \WriteBulkString\ (length-prefixed format), which correctly handles arbitrary binary content in attributes.

This matches Redis behavior — \RedisModule_ReplyWithString\ sends a bulk string, not a simple string.

Changes

  • **\libs/server/Resp/Vector/RespServerSessionVectors.cs**: Replace \WriteSimpleString\ with \WriteBulkString\ for the VGETATTR response
  • **\ est/standalone/Garnet.test.vectorset/RespVectorSetTests.cs**: Add \VGETATTR_BinaryAttributes\ test verifying round-trip of attributes containing CR/LF, null bytes, and high bytes

Tiago Napoli and others added 2 commits May 26, 2026 20:16
VGETATTR was using WriteSimpleString to send attribute data. Switch
to WriteBulkString (length-prefixed format) which correctly handles
arbitrary binary content. This matches Redis behavior -- its
RedisModule_ReplyWithString sends a bulk string, not a simple string.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verifies that attributes containing CR/LF, null bytes, and high bytes
are correctly round-tripped through VADD SETATTR and VGETATTR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 03:17
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 updates the RESP encoding for the Vector Set VGETATTR response to use a length-prefixed bulk string, making attribute replies binary-safe (e.g., able to include CR/LF, null bytes, and high bytes) and aligning behavior with Redis module reply semantics.

Changes:

  • Switch VGETATTR response writing from simple string to bulk string (binary-safe RESP format).
  • Add a regression test that verifies binary attribute round-trip through VADD ... SETATTR and VGETATTR.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
libs/server/Resp/Vector/RespServerSessionVectors.cs Emit VGETATTR attribute data as RESP bulk string instead of simple string to support arbitrary bytes.
test/standalone/Garnet.test.vectorset/RespVectorSetTests.cs Add a test covering binary attribute content (CR/LF, null, high bytes) round-trip via VGETATTR.

Comment thread test/standalone/Garnet.test.vectorset/RespVectorSetTests.cs
@tiagonapoli tiagonapoli merged commit 4559e89 into main May 27, 2026
137 of 138 checks passed
@tiagonapoli tiagonapoli deleted the tiagonapoli/fix-vgetattr-response branch May 27, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants