makssent opened a new pull request, #40280:
URL: https://github.com/apache/shardingsphere/pull/40280
Fixes #40240.
Changes proposed in this pull request:
- Added `IO_OPEN_ERROR` to `FirebirdVendorError` (code `isc_io_error` with
the Firebird server message) and `IO_ERROR` to `FirebirdState` (SQLSTATE
`08001`). `FirebirdDialectExceptionMapper` now maps `UnknownDatabaseException`
to `IO_OPEN_ERROR` instead of `UNAVAILABLE_DATABASE`.
- The Firebird server answers `op_attach` with `isc_io_error` when the
database file does not exist
([Firebird](https://github.com/FirebirdSQL/firebird/blob/v5.0.4/src/jrd/os/posix/unix.cpp#L687-L688)).
- Jaybird uses the first code of the response status vector as the error
code of `SQLException`
([Jaybird](https://github.com/FirebirdSQL/jaybird/blob/v6.0.7/src/main/org/firebirdsql/gds/ng/wire/AbstractWireOperations.java#L118-L150)).
- Previously, when a client attached to a database that the proxy does not
have (for example, `nosuch_db`), the proxy answered `op_attach` with error
`isc_unavailable`. The client got a different error code and message than the
Firebird server gives for a database that does not exist. Now the proxy answers
with `isc_io_error` and the same message as the Firebird server does.
- Updated the unit tests `FirebirdDialectExceptionMapperTest` and
`FirebirdErrorPacketFactoryTest`.
<details>
<summary>Verification</summary>
The same queries were executed directly against a real database and through
the proxy, and the results were compared.
* Server: Firebird 5.0
* Clients: Jaybird 6.0.7, Jaybird 5.0.13
The client attaches to a database that does not exist, directly by the
database file path and through the proxy by the name of a logical database that
does not exist. The program prints the error code, SQLSTATE and message, with
the file path replaced by `<database>`.
Before the fix:
| Operation | Proxy | Server | Match |
|---|---|---|---|
| Attach to a database that does not exist | error `isc_unavailable`
`unavailable database; <database>` | error `isc_io_error` `I/O error during
"open" operation for file "<database>"; Error while trying to open file; No
such file or directory` | no |
After the fix:
| Operation | Proxy | Server | Match |
|---|---|---|---|
| Attach to a database that does not exist | error `isc_io_error` `I/O
error during "open" operation for file "<database>"; Error while trying to open
file; No such file or directory` | error `isc_io_error` `I/O error during
"open" operation for file "<database>"; Error while trying to open file; No
such file or directory` | yes |
</details>
---
Before submitting this PR, I confirm that:
- [x] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [x] I have reviewed my changes.
- [ ] I have (or in comment I request) added corresponding labels for the
pull request.
- [x] I have passed the required local checks: `./mvnw clean install -B -T1C
-Pcheck`.
- [ ] I have updated the relevant documentation, if applicable.
- [x] I have added or updated unit tests for my changes, if applicable.
- [ ] I have updated the Release Notes of the current development version,
if applicable. For more details, see [Update Release
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/).
- [ ] I have disclosed the tool and affected files or scope for any material
AI assistance, as required by the [AI-assisted contribution policy].
[AI-assisted contribution policy]:
https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]