You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "TedCraft (via GitHub)" <gi...@apache.org> on 2026/09/23 23:47:08 UTC
[I] Support Firebird Wire Protocol packets: Common responses [shardingsphere]
TedCraft opened a new issue, #39935:
URL: https://github.com/apache/shardingsphere/issues/39935
## Feature Request
**For English only**, other languages will not be accepted.
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot make decision by current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Is your feature request related to a problem?
Currently, ShardingSphere-Proxy supports the basic packets required to perform transactions with Firebird. However, for full compatibility with the Firebird drivers, ShardingSphere-Proxy must support all Wire Protocol packets.
### Describe the feature you would like.
Add support for the Firebird Wire protocol packages listed below.
- [x] [Generic response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-generic)
Pull request: #35937
- [x] [SQL response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-sql)
Pull request: #35937
- [x] [Fetch response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-fetch)
Pull request: #35937
- [ ] [Inline blob response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-inline-blob)
- [ ] [Slice response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-slice)
- [ ] [Dummy response](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-dummy)
- [ ] [Exit or disconnect command (aux connection)](https://firebirdsql.org/file/documentation/html/en/firebirddocs/wireprotocol/firebird-wire-protocol.html#wireprotocol-responses-exit)
### Steps to implement Wire Protocol packet
1. Add packet to org.apache.shardingsphere.database.protocol.firebird module
2. Add executor for created packet to org.apache.shardingsphere.proxy.frontend.firebird module
3. Add exceptions to org.apache.shardingsphere.database.exception.firebird module if needed
4. Add unit tests for created classes.
--
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Support Firebird Wire Protocol packets: Common responses [shardingsphere]
Posted by "bhaskars2904 (via GitHub)" <gi...@apache.org>.
bhaskars2904 commented on issue #39935:
URL: https://github.com/apache/shardingsphere/issues/39935#issuecomment-5867691865
I would like to work on this issue.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Support Firebird Wire Protocol packets: Common responses [shardingsphere]
Posted by "abhinav-phi (via GitHub)" <gi...@apache.org>.
abhinav-phi commented on issue #39935:
URL: https://github.com/apache/shardingsphere/issues/39935#issuecomment-5902930200
I've implemented the four remaining common response packets for this issue.
**PR:** #40013
## Scope
Generic, SQL and Fetch responses are already covered by #35937, so this PR picks up the four unchecked items in the issue:
| Spec section | Class added | Op code |
|---|---|---|
| 3.4 Inline blob response | `FirebirdInlineBlobResponsePacket` | `op_inline_blob` (114) |
| 3.5 Slice response | `FirebirdSliceResponsePacket` | `op_slice` (60) |
| 3.6 Dummy response | `FirebirdDummyResponsePacket` | `op_dummy` (71) |
| 3.7 Exit or disconnect command (aux connection) | `FirebirdExitResponsePacket`, `FirebirdDisconnectResponsePacket` | `op_exit` (2), `op_disconnect` (6) |
All five classes live in `org.apache.shardingsphere.database.protocol.firebird.packet.generic` and follow the pattern of the already-merged response packets (`FirebirdGenericResponsePacket`, `FirebirdSQLResponsePacket`, `FirebirdFetchResponsePacket`): `final class ... extends FirebirdPacket`, with Lombok `@RequiredArgsConstructor` / `@Getter` on the three packets that carry fields, and a `protected void write(FirebirdPacketPayload payload)` that writes the operation code followed by the fields defined in the spec.
I also added `INLINE_BLOB(114)` to `FirebirdCommandPacketType`, which was not yet present.
## Against the implementation steps in the issue
1. **Packet added to `database.protocol.firebird`** — done, as listed above.
2. **Executor in `proxy.frontend.firebird`** — not applicable for this PR. All four packets are server-to-client only: `op_inline_blob` is emitted inside a fetch/SQL response, `op_dummy` is the server keep-alive packet, and `op_exit`/`op_disconnect` are sent by the server on the aux connection. None of them is triggered by a client request, so there is nothing to dispatch. For the slice response this is worth spelling out: it is the response to `op_get_slice` (58), but there is no get-slice *request* packet yet — `FirebirdCommandPacketFactory` has no `GET_SLICE` case — so no executor can be attached until that request is implemented. This matches how the merged generic/SQL/fetch response packets were added, as packet classes plus unit tests.
3. **Exceptions in `database.exception.firebird`** — none needed. These packets only serialize a server payload and raise no vendor errors.
4. **Unit tests** — added, one test class per new class.
## Implementation notes
**Inline blob response.** Per the spec, the blob information buffer uses "the same encoding as `p_resp_data` in response to a blob information request with all blob information items", and the blob data buffer uses "the same encoding as `p_resp_data` in response to Get segment". Rather than duplicating those encodings, both fields are typed as `FirebirdPacket` and framed as length-prefixed, 4-byte-aligned buffers — the same composition `FirebirdGenericResponsePacket` already uses for its `data` field. A `FirebirdBlobInfoReturnPacket` and a `FirebirdGetBlobSegmentResponsePacket` can therefore be passed in directly.
**Slice response — one point I would like feedback on.** The specification is explicitly uncertain about this one. Section 3.5 states "This might not reflect actual encoding in the protocol", and the second field is documented as "Slice length (possibly a buffer?, needs verification)". I implemented the documented layout literally: operation code, slice length as a 4-byte integer, the slice length again, then the slice data as a length-prefixed buffer. I have flagged the caveat in the packet Javadoc as well. If the actual server-side encoding differs — for example if the second field is reserved padding rather than a repeated length — that is the one place this PR would need adjusting, and I would be glad to correct it.
**Exit vs disconnect.** The spec describes exit and disconnect as a single packet form carrying either `op_exit` or `op_disconnect`. I implemented them as two small classes, since each is a distinct wire operation and one-class-per-packet is the prevailing convention in this module. Happy to collapse them into one parameterized class if that is preferred.
## Tests
New test classes: `FirebirdDummyResponsePacketTest`, `FirebirdExitResponsePacketTest`, `FirebirdDisconnectResponsePacketTest`, `FirebirdSliceResponsePacketTest`, `FirebirdInlineBlobResponsePacketTest` — 10 tests in total.
The slice test is parameterized over an empty, a 4-byte aligned and an unaligned slice; the inline blob test covers both aligned and unaligned buffer framing. The tests assert against real serialized bytes on an `UnpooledByteBuf` rather than only verifying mock interactions, so the operation code, field order, buffer length prefixes and padding alignment are all actually checked.
```
mvn -P check -pl database/protocol/dialect/firebird test
Tests run: 542, Failures: 0, Errors: 0, Skipped: 0
mvn -P check -pl proxy/frontend/dialect/firebird test
Tests run: 282, Failures: 0, Errors: 0, Skipped: 0
```
All four Firebird modules (`protocol`, `proxy frontend`, `proxy backend`, `proxy dialect`) build successfully, the two modules with tests were run as shown above, and `spotless:apply` reports all files clean.
## AI disclosure
Per [AI_POLICY.md](https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md): this work was AI-assisted. I used the MiniMax Code (MCode) AI coding agent to draft the packet classes and unit tests; I reviewed, ran and own every change. The affected files are the five new packet classes, the five new test classes, and the `INLINE_BLOB(114)` constant in `FirebirdCommandPacketType` — all in `database/protocol/dialect/firebird`. The packet layouts were implemented from the official Firebird wire protocol documentation and the existing packet classes in this module; no third-party code was copied.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org