chore(pgwire): remove legacy server code#6039
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis change set removes legacy PostgreSQL wire protocol support from both production and test code. It deletes all legacy server, authenticator, and type container classes, and eliminates conditional logic, configuration, and test parameterization related to "legacy mode." Exception handling for protocol errors is unified under a single exception type, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PGWireServerModern
participant AuthenticatorModern
participant SQLExecutor
Client->>PGWireServerModern: Connect & send startup message
PGWireServerModern->>AuthenticatorModern: Authenticate (cleartext)
AuthenticatorModern-->>PGWireServerModern: Authentication result
PGWireServerModern->>SQLExecutor: Parse/execute query
SQLExecutor-->>PGWireServerModern: Query result
PGWireServerModern-->>Client: Send response
Estimated code review effort🎯 5 (Critical) | ⏱️ ~90 minutes
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
@coderabbitai please review |
🧩 Analysis chain@bluestreak01 On it — kicking off the review now. I’ll analyze the diff and scan for any lingering references to the removed legacy PGWire server code, and follow up with findings shortly. 🏁 Script executed: Length of output: 3655 @bluestreak01 Re-running the scan with a fixed script (no tee, with rg/grep fallback). I’ll post concrete findings on any lingering references and risky deltas right after this executes, and proceed with a full review. 🏁 Script executed: Length of output: 5351 @bluestreak01 Here’s a focused pass kicking off:
Once the results come back, I’ll summarize any remaining references or risks and proceed with the full automated review as requested. 🏁 Script executed: Length of output: 1995 @bluestreak01 Running a corrected scan (no nl/tee; robust fallbacks) to list removed files accurately and check for lingering references to the removed legacy PGWire classes. I’ll summarize concrete findings right after. 🏁 Script executed: Length of output: 23927 @bluestreak01 Here are my initial findings and checks for PR #6039:
Suggested follow-ups (non-blocking):
Proceeding with the full automated review for deeper coverage (style, docs, tests, edge cases). If you’d like, I can also open a follow-up issue to track the comment/doc cleanup. ✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (3)
core/src/main/java/io/questdb/cutlass/pgwire/modern/PGUtils.java (1)
156-170: Guard against int overflow when casting blob size.sequence.length() is long; returning Integer.BYTES + (int) blobSize may overflow if blobSize > Integer.MAX_VALUE, even if it’s below maxBlobSize. Add an explicit upper bound check before the cast.
case ColumnType.BINARY: BinarySequence sequence = record.getBin(columnIndex); if (sequence == null) { return Integer.BYTES; } else { long blobSize = sequence.length(); - if (blobSize < maxBlobSize) { - return Integer.BYTES + (int) blobSize; - } else { - throw MessageProcessingException.instance(pipelineEntry) + if (blobSize < 0 || blobSize > Integer.MAX_VALUE) { + throw MessageProcessingException.instance(pipelineEntry) + .put("blob size not supported [blobSize=").put(blobSize) + .put(", maxSupported=").put(Integer.MAX_VALUE) + .put(", columnIndex=").put(columnIndex) + .put(']'); + } + if (blobSize < maxBlobSize) { + return Integer.BYTES + (int) blobSize; + } + throw MessageProcessingException.instance(pipelineEntry) .put("blob is too large [blobSize=").put(blobSize) .put(", maxBlobSize=").put(maxBlobSize) .put(", columnIndex=").put(columnIndex) .put(']'); - } }core/src/main/java/io/questdb/cutlass/pgwire/modern/CleartextPasswordPgWireAuthenticatorModern.java (2)
414-442: Don’t rely on assert for protocol validation; handle invalid msgType at runtimeAsserts are compiled out in production. A malformed client sending a wrong message type will bypass validation. Guard at runtime and fail the handshake deterministically.
- byte msgType = Unsafe.getUnsafe().getByte(recvBufReadPos); - assert msgType == MESSAGE_TYPE_PASSWORD_MESSAGE; + byte msgType = Unsafe.getUnsafe().getByte(recvBufReadPos); + if (msgType != MESSAGE_TYPE_PASSWORD_MESSAGE) { + LOG.error().$("unexpected message type [expected=").$(MESSAGE_TYPE_PASSWORD_MESSAGE) + .$(", actual=").$(msgType).$(']').$(); + throw MessageProcessingException.INSTANCE; + }
432-441: Use proper SQLSTATE/severity on auth failureprepareErrorResponse encodes SQLSTATE "00000" (successful completion) and severity "ERROR". For auth failure, PostgreSQL uses severity FATAL and SQLSTATE 28P01. This helps clients (including JDBC) classify the error correctly.
- prepareErrorResponse("invalid username/password"); + prepareAuthFailureResponse();Outside this hunk, add:
// Consider placing next to prepareErrorResponse private void prepareAuthFailureResponse() { sink.put(MESSAGE_TYPE_ERROR_RESPONSE); long addr = sink.skip(); sink.put('S'); sink.encodeUtf8Z("FATAL"); sink.put('V'); sink.encodeUtf8Z("FATAL"); sink.put('C'); sink.encodeUtf8Z("28P01"); // invalid_password sink.put('M'); sink.encodeUtf8Z("invalid username/password"); sink.put((char) 0); sink.putLen(addr); }
🧹 Nitpick comments (8)
core/src/main/java/io/questdb/cutlass/pgwire/modern/PGWireServerModern.java (1)
176-180: Remove unnecessary null check in resetQueryCache().typesAndSelectCache is always non-null (either a real cache or NO_OP_CACHE). The null guard is dead code.
@Override public void resetQueryCache() { - if (typesAndSelectCache != null) { - typesAndSelectCache.clear(); - } + typesAndSelectCache.clear(); }core/src/main/java/io/questdb/cutlass/pgwire/modern/PGUtils.java (1)
84-98: Javadoc tweak to reflect inclusive limit.The code rejects blobs when blobSize >= maxBlobSize. Clarify the Javadoc to “exceeds or equals maxBlobSize” to avoid ambiguity.
- * @throws MessageProcessingException if the binary value exceeds maxBlobSize + * @throws MessageProcessingException if the binary value exceeds or equals maxBlobSizecore/src/test/java/io/questdb/test/cutlass/pgwire/PGErrorHandlingTest.java (1)
171-174: Make assertion resilient to driver message wording.Matching string “The connection attempt failed.” can be brittle across pgjdbc versions. Prefer asserting SQLState if available.
- } catch (PSQLException e) { - TestUtils.assertContains(e.getMessage(), "The connection attempt failed."); + } catch (PSQLException e) { + // 08001/08006 commonly used for connection failures + Assert.assertTrue( + "Unexpected SQLState for connection failure: " + e.getSQLState(), + "08001".equals(e.getSQLState()) || "08006".equals(e.getSQLState()) + ); }core/src/main/java/io/questdb/cutlass/pgwire/modern/PgNonNullBinaryArrayView.java (1)
121-125: Correct exception type migration (LGTM) + production-safety improvement.
- Using MessageProcessingException for protocol/format violations is consistent and ensures upstream handling.
- Consider replacing the assert shape.size() > 0 with a runtime check to avoid being stripped in production.
- assert shape.size() > 0; + if (shape.size() == 0) { + throw MessageProcessingException.instance(pipelineEntry) + .put("invalid array shape (no dimensions)"); + }Also applies to: 159-169
core/src/main/java/io/questdb/cutlass/pgwire/modern/CleartextPasswordPgWireAuthenticatorModern.java (1)
227-230: Add context logging before swallowing MessageProcessingExceptionhandleIO() maps MessageProcessingException to AuthenticatorException without logging. Add minimal context to aid diagnosis (state, socket fd).
- } catch (MessageProcessingException e) { - throw AuthenticatorException.INSTANCE; - } + } catch (MessageProcessingException e) { + LOG.error().$("auth handshake failed [state=").$(state) + .$(", fd=").$(socket != null ? socket.getFd() : -1).$(']').$(); + throw AuthenticatorException.INSTANCE; + }core/src/test/java/io/questdb/test/cutlass/pgwire/PGMultiStatementMessageTest.java (3)
402-410: Update comment to reflect legacy removalThe comment still references “legacy code fails… include quirks when legacy is removed.” Legacy is gone; consider pruning or updating the comment.
444-448: Avoid magic numeric mask; use the named constant7L is brittle and obscures intent. Prefer CONN_AWARE_ALL for consistency.
- assertWithPgServer(7L, (connection, binary, mode, port) -> { + assertWithPgServer(CONN_AWARE_ALL, (connection, binary, mode, port) -> {
951-988: Rename test to drop “Legacy” suffixMethod name still contains "Legacy" but now runs under CONN_AWARE_ALL. Rename for clarity.
- public void testQueryEventuallySucceedsOnDataUnavailableEventTriggeredImmediatelyLegacy() throws Exception { + public void testQueryEventuallySucceedsOnDataUnavailableEventTriggeredImmediately() throws Exception {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (32)
core/src/main/java/io/questdb/cutlass/pgwire/AbstractTypeContainer.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/CleartextPasswordPgWireAuthenticator.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/DefaultPgWireAuthenticatorFactory.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/IPGWireServer.java(1 hunks)core/src/main/java/io/questdb/cutlass/pgwire/MessageProcessingException.java(3 hunks)core/src/main/java/io/questdb/cutlass/pgwire/PGWireServer.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/TypesAndInsert.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/TypesAndSelect.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/TypesAndUpdate.java(0 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/CleartextPasswordPgWireAuthenticatorModern.java(5 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/PGConnectionContextModern.java(26 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/PGPipelineEntry.java(38 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/PGUtils.java(4 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/PGWireServerModern.java(2 hunks)core/src/main/java/io/questdb/cutlass/pgwire/modern/PgNonNullBinaryArrayView.java(4 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/BasePGTest.java(1 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/IntervalPGTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGArraysTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGCommitFailureTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGDeclareSyntaxTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGErrorHandlingTest.java(1 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGFunctionsTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGInsertErrorTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGMemoryLimitTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGMultiStatementMessageTest.java(10 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGQuerySuspendTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGSecurityTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGTlsCompatTest.java(0 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PGUpdateConcurrentTest.java(2 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PgBootstrapTest.java(1 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/Port0PGWireConfiguration.java(1 hunks)core/src/test/java/io/questdb/test/cutlass/pgwire/PreparedStatementInvalidationTest.java(0 hunks)
💤 Files with no reviewable changes (18)
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGArraysTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGInsertErrorTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/IntervalPGTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PreparedStatementInvalidationTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGFunctionsTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGSecurityTest.java
- core/src/main/java/io/questdb/cutlass/pgwire/TypesAndSelect.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGMemoryLimitTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGCommitFailureTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGDeclareSyntaxTest.java
- core/src/main/java/io/questdb/cutlass/pgwire/DefaultPgWireAuthenticatorFactory.java
- core/src/main/java/io/questdb/cutlass/pgwire/TypesAndUpdate.java
- core/src/main/java/io/questdb/cutlass/pgwire/TypesAndInsert.java
- core/src/main/java/io/questdb/cutlass/pgwire/AbstractTypeContainer.java
- core/src/main/java/io/questdb/cutlass/pgwire/PGWireServer.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGQuerySuspendTest.java
- core/src/test/java/io/questdb/test/cutlass/pgwire/PGTlsCompatTest.java
- core/src/main/java/io/questdb/cutlass/pgwire/CleartextPasswordPgWireAuthenticator.java
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-04T09:16:27.366Z
Learnt from: jerrinot
PR: questdb/questdb#5996
File: core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpSenderTest.java:350-356
Timestamp: 2025-08-04T09:16:27.366Z
Learning: In QuestDB ILP tests, maximum dimension values like `(1 << 28) - 1` are intentionally hard-coded instead of using constants like `ArrayView.DIM_MAX_LEN` to serve as "canaries" that will cause test failures if the API limits change, ensuring developers are aware of breaking changes to the ILP API.
Applied to files:
core/src/main/java/io/questdb/cutlass/pgwire/modern/PGUtils.javacore/src/main/java/io/questdb/cutlass/pgwire/modern/PgNonNullBinaryArrayView.java
📚 Learning: 2025-07-31T08:21:17.390Z
Learnt from: mtopolnik
PR: questdb/questdb#5997
File: core/src/main/java/io/questdb/griffin/engine/functions/array/DoubleArrayAccessFunctionFactory.java:127-131
Timestamp: 2025-07-31T08:21:17.390Z
Learning: In DoubleArrayAccessFunctionFactory.java, overflow validation for array index casting from long to int is performed in the validateIndexArgs() method rather than at each individual cast site. The validateIndexArgs() method is called early in newInstance() to validate all index arguments, making subsequent casts safe.
Applied to files:
core/src/main/java/io/questdb/cutlass/pgwire/modern/PgNonNullBinaryArrayView.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
- GitHub Check: New pull request (SelfHosted Other tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Other tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Other tests Start X64Zfs Agent)
- GitHub Check: New pull request (SelfHosted Other tests Start ARM Agent)
- GitHub Check: New pull request (Hosted Running tests on windows-other)
- GitHub Check: New pull request (Hosted Running tests on windows-pgwire)
- GitHub Check: New pull request (Hosted Running tests on windows-cairo)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz2)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz1)
- GitHub Check: New pull request (Hosted Running tests on windows-griffin)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-other)
- GitHub Check: New pull request (Hosted Running tests on mac-other)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-pgwire)
- GitHub Check: New pull request (Hosted Running tests on mac-pgwire)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo-fuzz)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-cairo)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-fuzz)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests Start ARM Agent)
- GitHub Check: New pull request (Hosted Running tests on mac-griffin)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests Start X64Zfs Agent)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-griffin)
- GitHub Check: New pull request (Rust Test and Lint on linux-jdk17)
- GitHub Check: New pull request (Check Changes Check changes)
🔇 Additional comments (33)
core/src/main/java/io/questdb/cutlass/pgwire/modern/PGWireServerModern.java (1)
122-125: Correct exception mapping to MessageProcessingException (LGTM).Catching MessageProcessingException here is consistent with the rename and ensures protocol violations disconnect cleanly. Logging keeps using flyweight message safely.
core/src/test/java/io/questdb/test/cutlass/pgwire/PGErrorHandlingTest.java (1)
55-60: De-parameterized setup (LGTM).Always using createDummyConfiguration() aligns with removing legacy mode. Setup remains clear and deterministic.
core/src/test/java/io/questdb/test/cutlass/pgwire/PgBootstrapTest.java (1)
46-46: LGTM: legacy-mode branching removed from setupUnifying on createDummyConfiguration() simplifies the test bootstrap and aligns with legacy removal.
core/src/main/java/io/questdb/cutlass/pgwire/modern/CleartextPasswordPgWireAuthenticatorModern.java (2)
33-33: Consistent exception renameImport updated to MessageProcessingException matches the refactor across the codebase.
376-412: LGTM: throws type updatedprocessInitMessage now throws MessageProcessingException and default case throws the new type. No functional changes otherwise.
core/src/test/java/io/questdb/test/cutlass/pgwire/Port0PGWireConfiguration.java (2)
36-36: LGTM: default ctor simplifiedDelegating to single-arg ctor keeps configuration lean post-legacy removal.
39-41: LGTM: legacy flag removedConstructor and fields pared back to connectionLimit only. Matches the consolidation to modern PGWire.
core/src/test/java/io/questdb/test/cutlass/pgwire/PGUpdateConcurrentTest.java (2)
218-223: WAL + explicit drain improves determinismAdding "WAL" to partitioned table DDL and draining the WAL queue before starting threads reduces flakiness in concurrent update checks.
246-247: LGTM: drop row-count assertion for WAL updatesWAL mode returning a transaction id instead of affected rows is acknowledged; executing without asserting the count is correct here.
core/src/test/java/io/questdb/test/cutlass/pgwire/PGMultiStatementMessageTest.java (6)
290-295: LGTM: unify on CONN_AWARE_ALLRemoving legacy conditionals simplifies coverage across modes.
324-345: LGTM: consistent mode maskUsing CONN_AWARE_ALL maintains parity across test branches.
864-868: LGTM: DISCARD followed by SELECT under all modesGood to validate behavior uniformly.
1054-1061: LGTM: RESET then SELECT under all modesUnified mask is appropriate post-legacy cleanup.
1142-1146: LGTM: ROLLBACK then SELECT under all modesConsistent with other transactional command tests.
1391-1397: LGTM: UNLISTEN then SELECT under all modesGood to exercise both specific channel name and wildcard.
core/src/test/java/io/questdb/test/cutlass/pgwire/BasePGTest.java (1)
577-577: LGTM!The removal of the legacy mode parameter from
Port0PGWireConfigurationconstructor aligns with the PR's objective to eliminate legacy PGWire server code.core/src/main/java/io/questdb/cutlass/pgwire/MessageProcessingException.java (1)
36-110: Good refactoring: More descriptive exception nameThe rename from
BadProtocolExceptiontoMessageProcessingExceptionprovides better semantic clarity. The new name accurately reflects that this exception handles various message processing errors beyond just protocol violations.core/src/main/java/io/questdb/cutlass/pgwire/modern/PGConnectionContextModern.java (4)
201-201: Good improvement: Making tasCache field finalMaking
tasCachefinal ensures thread-safety and prevents accidental reassignment. This aligns well with the removal of legacy code where this field might have been reassigned.
279-291: Consistent exception handling updateThe method signature and error handling have been correctly updated to use
MessageProcessingException. The error reporting logic remains intact while using the new exception type.
964-971: Proper error handling in msgKaput()The method correctly creates a pipeline entry if needed before creating the exception, ensuring error messages are properly captured and can be reported to the client.
1138-1142: Correct exception handling in msgSync()The catch block properly handles
MessageProcessingExceptionduring commit operations. The comment clearly explains that sync cannot be aborted and errors will be reported to the client.core/src/main/java/io/questdb/cutlass/pgwire/modern/PGPipelineEntry.java (12)
48-48: LGTM - Import statement correctly updated.The import has been properly updated from
BadProtocolExceptiontoMessageProcessingExceptionas part of the exception type refactoring.
340-340: LGTM - Method signature correctly updated.The method signature properly reflects the exception type change from
BadProtocolExceptiontoMessageProcessingExceptionwhile maintaining the same semantic behavior.
366-366: LGTM - Method signature correctly updated.The
compileNewSQLmethod signature has been properly updated to useMessageProcessingExceptioninstead ofBadProtocolException.
399-400: LGTM - Exception handling correctly updated.The catch block properly handles the new
MessageProcessingExceptiontype while maintaining the same exception propagation logic.
428-428: LGTM - Method signature correctly updated.The
getInthelper method signature has been properly updated to throwMessageProcessingExceptionfor message validation failures.
451-451: LGTM - Method signature correctly updated.The
getShorthelper method signature has been properly updated to useMessageProcessingException.
491-491: LGTM - Method signature correctly updated.The method signature for
msgBindCopyParameterFormatCodeshas been properly updated to throwMessageProcessingExceptionfor protocol message processing errors.
530-530: LGTM - Method signature and exception handling correctly updated.The method signature has been properly updated, and the exception throwing now uses
MessageProcessingException.INSTANCE, which suggests a singleton pattern for performance optimization.Also applies to: 552-552
587-587: LGTM - Method signature correctly updated.The
msgExecutemethod signature has been properly updated to throwMessageProcessingExceptionfor SQL execution and protocol processing errors.
677-677: LGTM - Exception handling correctly updated.The catch block properly handles
MessageProcessingExceptionby rethrowing it, maintaining the same exception propagation behavior.
927-927: LGTM - Method signature correctly updated.The
ofSimpleQuerymethod signature has been properly updated to useMessageProcessingExceptionfor query processing errors.
1062-1062: LGTM - Comprehensive exception type refactoring correctly implemented.All method signatures and exception handling have been consistently updated from
BadProtocolExceptiontoMessageProcessingException. Key observations:
- The
kaput()utility method now returnsMessageProcessingExceptioninstead ofBadProtocolException- Parameter binding methods, validation methods, and protocol handling methods all use the new exception type
- Exception catching and rethrowing logic maintains the same semantics
- The changes are comprehensive and consistent across the entire class
This refactoring successfully unifies exception handling under the
MessageProcessingExceptiontype while preserving all existing error handling behavior.Also applies to: 1132-1132, 1336-1336, 1349-1349, 1393-1394, 1397-1397, 1417-1417, 1451-1451, 1504-1504, 1557-1557, 1850-1850, 2250-2250, 2426-2426, 2527-2527, 2567-2567, 2579-2579, 2593-2593, 2607-2607, 2617-2617, 2627-2627, 2637-2637, 2647-2647, 2659-2659, 2692-2692, 2704-2704, 2714-2714, 2846-2846
| return new PGWireServerModern(configuration, cairoEngine, networkSharedPool, registry, executionContextFactory); | ||
| } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Unconditional modern server instantiation (LGTM).
Simplifying newInstance to always return PGWireServerModern matches the removal of legacy server code.
To be extra safe, run this script to confirm no lingering references to legacy classes/flags remain:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Scanning for legacy references..."
patterns=(
'BadProtocolException'
'\bPGWireServer\b(?!Modern)'
'\bPGConnectionContext\b(?!Modern)'
'CleartextPasswordPgWireAuthenticator(?!Modern)'
'DefaultPgWireAuthenticatorFactory'
'TypesAnd(Insert|Select|Update)\b'
'\bisLegacyModeEnabled\s*\('
)
for p in "${patterns[@]}"; do
echo "----- Pattern: $p"
rg -n --hidden -g '!.git' -e "$p" || true
doneLength of output: 4469
Remove remaining legacy PGWire configuration flags
While newInstance now always returns PGWireServerModern, there are still lingering references to the legacy mode flag in configuration classes. These can be removed to complete the cleanup:
- core/src/main/java/io/questdb/cutlass/pgwire/PGWireConfiguration.java
·boolean isLegacyModeEnabled(); - core/src/main/java/io/questdb/cutlass/pgwire/PGWireConfigurationWrapper.java
·public boolean isLegacyModeEnabled() { return getDelegate().isLegacyModeEnabled(); } - core/src/main/java/io/questdb/cutlass/pgwire/DefaultPGWireConfiguration.java
·public boolean isLegacyModeEnabled() { … } - core/src/main/java/io/questdb/PropServerConfiguration.java
· Generated delegate forisLegacyModeEnabled()
Please remove these methods and any associated fields, as they are no longer used now that only the modern server implementation remains.
🤖 Prompt for AI Agents
In core/src/main/java/io/questdb/cutlass/pgwire/PGWireConfiguration.java,
PGWireConfigurationWrapper.java, DefaultPGWireConfiguration.java, and
core/src/main/java/io/questdb/PropServerConfiguration.java, remove the
isLegacyModeEnabled() method and any related fields or delegate methods. These
legacy configuration flags are no longer needed since newInstance always returns
PGWireServerModern, so clean up all references to legacy mode to complete the
removal.
[PR Coverage check]😍 pass : 95 / 101 (94.06%) file detail
|
Over the course of several releases, the modern PGWire implementation has demonstrated strong reliability and performance. This PR streamlines the codebase by retiring the legacy PGWire server implementation, including its associated tests, configurations, and backward-compatibility shims.
I would also like to move code from "modern" package up a level and remove "modern" as the term. But it would be good to do that after code review.(done)