Skip to content

fix string partitioning edge case to avoid rabbit-holing into single-row partitions - #4617

Merged
jgao54 merged 2 commits into
mainfrom
arbitrary-string-follow-ups
Jul 24, 2026
Merged

fix string partitioning edge case to avoid rabbit-holing into single-row partitions#4617
jgao54 merged 2 commits into
mainfrom
arbitrary-string-follow-ups

Conversation

@jgao54

@jgao54 jgao54 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Follow up to #4522

Main thing to clean up is the edge case where if both start and end boundary string's first differing byte (the most significant byte for determining the midpoint) are below or above printable ascii, continuing with midpoint interpolation in the extreme case can result in generating a lot of single-row partitions, until we are left with one large final partition. Terminate early when this happens to avoid introducing unnecessary latency. It may still be a full table snapshot, but we don't want to generate a lot of meaningless partitions.

@jgao54
jgao54 force-pushed the arbitrary-string-follow-ups branch from 39784c6 to 82ee9cf Compare July 24, 2026 07:15
@jgao54 jgao54 changed the title follow up string partitioning edge case to avoid rabbit-holing into single-row partitions fix string partitioning edge case to avoid rabbit-holing into single-row partitions Jul 24, 2026
@jgao54
jgao54 force-pushed the arbitrary-string-follow-ups branch from 82ee9cf to 3f24f8a Compare July 24, 2026 07:23
@jgao54
jgao54 force-pushed the arbitrary-string-follow-ups branch from 3f24f8a to ddbe834 Compare July 24, 2026 07:26
}
}

func TestStringMidpointRemainsValidUTF8(t *testing.T) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapped this up into test above; since we are now checking ascii boundaries, most of these cases would no longer be hit, as they would be deemed unsplittable before then.

@jgao54
jgao54 marked this pull request as ready for review July 24, 2026 07:39
@jgao54
jgao54 requested a review from a team as a code owner July 24, 2026 07:39
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Flaky Test Detected

Analysis: The flow/e2e suite hit the 20-minute package timeout because an unrelated test (TestApiPg/TestDropMissing) stalled for 5m34s, and only one matrix combo (mysql-gtid) failed while all others passed on the same commit — indicating an environmental/flaky timeout rather than a real bug.
Confidence: 0.85

✅ Automatically retrying the workflow

View workflow run

@claude

claude Bot commented Jul 24, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Comment thread flow/connectors/mysql/qrep_partition.go Outdated
Co-authored-by: Ilia Demianenko <ilia.demianenko@clickhouse.com>
@jgao54
jgao54 enabled auto-merge (squash) July 24, 2026 21:19
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
3147 2 3145 415
View the top 2 failed test(s) by shortest run time
github.com/PeerDB-io/peerdb/flow/e2e::TestGenericBQ
Stack Traces | 0.01s run time
=== RUN   TestGenericBQ
=== PAUSE TestGenericBQ
=== CONT  TestGenericBQ
--- FAIL: TestGenericBQ (0.01s)
github.com/PeerDB-io/peerdb/flow/e2e::TestGenericBQ/Test_Simple_Flow
Stack Traces | 63.3s run time
=== RUN   TestGenericBQ/Test_Simple_Flow
=== PAUSE TestGenericBQ/Test_Simple_Flow
=== CONT  TestGenericBQ/Test_Simple_Flow
2026/07/24 21:25:17 INFO Executing and processing query x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id"
2026/07/24 21:25:17 INFO Executing and processing query stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id"
2026/07/24 21:25:17 INFO [pg_query_executor] declared cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursorQuery="DECLARE peerdb_cursor_9700098224048205552 CURSOR FOR SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id" args=[]
2026/07/24 21:25:17 INFO [pg_query_executor] fetching rows start x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id" channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] fetching from cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_9700098224048205552
2026/07/24 21:25:17 INFO processed row stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_9700098224048205552 records=8 bytes=168 channelLen=7
2026/07/24 21:25:17 INFO [pg_query_executor] fetched rows x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id" rows=8 bytes=168 channelLen=7
2026/07/24 21:25:17 INFO [pg_query_executor] fetching from cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_9700098224048205552
2026/07/24 21:25:17 INFO processed row stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_9700098224048205552 records=0 bytes=0 channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] fetched rows x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id" rows=0 bytes=0 channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] committing transaction x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart
2026/07/24 21:25:17 INFO [pg_query_executor] committed transaction for query x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf\" ORDER BY id" rows=8 bytes=168 channelLen=0
2026/07/24 21:25:17 INFO Executing and processing query x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id"
2026/07/24 21:25:17 INFO Executing and processing query stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id"
2026/07/24 21:25:17 INFO [pg_query_executor] declared cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursorQuery="DECLARE peerdb_cursor_15961657269615954898 CURSOR FOR SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id" args=[]
2026/07/24 21:25:17 INFO [pg_query_executor] fetching rows start x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id" channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] fetching from cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_15961657269615954898
2026/07/24 21:25:17 INFO processed row stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_15961657269615954898 records=3 bytes=63 channelLen=2
2026/07/24 21:25:17 INFO [pg_query_executor] fetched rows x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id" rows=3 bytes=63 channelLen=2
2026/07/24 21:25:17 INFO [pg_query_executor] fetching from cursor x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_15961657269615954898
2026/07/24 21:25:17 INFO processed row stream x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart cursor=peerdb_cursor_15961657269615954898 records=0 bytes=0 channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] fetched rows x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id" rows=0 bytes=0 channelLen=0
2026/07/24 21:25:17 INFO [pg_query_executor] committing transaction x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart
2026/07/24 21:25:17 INFO [pg_query_executor] committed transaction for query x-peerdb-additional-metadata={Operation:FLOW_OPERATION_UNKNOWN} partitionId=testpart query="SELECT id,name,created_at FROM e2e_test_pg_rllmvw7x.\"test_inheritance_dynconf_dst\" ORDER BY id" rows=3 bytes=63 channelLen=0
    generic_test.go:143: UNEXPECTED STATUS TIMEOUT STATUS_SNAPSHOT
    bigquery.go:86: begin tearing down postgres schema bq_4tdduqmn_20260724212517
--- FAIL: TestGenericBQ/Test_Simple_Flow (63.28s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Flaky Test Detected

Analysis: Both failed jobs timed out identically waiting for BigQuery's initial snapshot (TestGenericBQ/Test_Simple_Flow, "UNEXPECTED STATUS TIMEOUT STATUS_SNAPSHOT") — a timeout in an external-service e2e test unrelated to the PR's QRep string-partitioning change, indicating transient BigQuery slowness rather than a real bug.
Confidence: 0.85

✅ Automatically retrying the workflow

View workflow run

@jgao54
jgao54 merged commit d8ea462 into main Jul 24, 2026
19 of 21 checks passed
@jgao54
jgao54 deleted the arbitrary-string-follow-ups branch July 24, 2026 22:03
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.

2 participants