Skip to content

[backport] Backport sweep for 9.0#4226

Open
valkeyrie-ops[bot] wants to merge 4 commits into
9.0from
agent/backport/sweep/9.0
Open

[backport] Backport sweep for 9.0#4226
valkeyrie-ops[bot] wants to merge 4 commits into
9.0from
agent/backport/sweep/9.0

Conversation

@valkeyrie-ops

@valkeyrie-ops valkeyrie-ops Bot commented Jul 20, 2026

Copy link
Copy Markdown

Backport sweep for 9.0

Automated cherry-picks from PRs marked "To be backported".

Applied

Source PR Title Detail
#4104 Avoid offloading writes to IO threads for the slot migration export job while snapshotting. conflicts resolved by Claude Code
#4229 Validate slot import ranges when loading from RDB
#4210 Check and reject invalid slot import job names

AI resolution details are posted as comments on this PR when available.


Generated by valkey-ci-agent using Claude Code.

@valkeyrie-ops valkeyrie-ops Bot added ai-resolved-conflicts AI is used to resolve conflicts in automated backport PRs. backport Backport PR opened by valkey-ci-agent labels Jul 20, 2026
@valkeyrie-ops

valkeyrie-ops Bot commented Jul 20, 2026

Copy link
Copy Markdown
Author

AI conflict resolution: source PR #4104

Avoid offloading writes to IO threads for the slot migration export job while snapshotting.

2 conflicted files

Claude Summary

All conflicts are resolved. Here's a summary of what I did:

Source PR intent: Prevent IO-thread write offloading for slot migration export clients while snapshotting (to avoid query buffer desync during pipelining), plus a defensive early-return in killSlotMigrationChild and IO-state checks before snapshotting.

Resolutions:

  1. src/io_threads.c — The conflict was in the include block at the top of the file. Upstream's unstable branch has #include "queues.h" and #include <sys/resource.h> as pre-existing context, but neither exists on the 9.0 branch (I confirmed src/queues.h is absent). The PR itself only added #include "cluster_migrateslots.h", so I kept just that one include. The functional change — the guard if (c->slot_migration_job && !clusterSlotMigrationShouldInstallWriteHandler(c)) return C_ERR; in trySendWriteToIOThreads — auto-merged cleanly, and I verified both the slot_migration_job client field (server.h:1298) and clusterSlotMigrationShouldInstallWriteHandler (cluster_migrateslots.h:20) exist on 9.0.

  2. tests/unit/cluster/cluster-migrateslots.tcl — The conflict was at the end of the file, where the cherry-pick tried to append two start_cluster test blocks (remaining_repl_size and slot-migration-max-failover-repl-bytes -1) that exist on unstable but not on 9.0. The PR only modified their tag lines (adding network); it didn't introduce those tests. I dropped them rather than importing tests outside the PR's scope. The network tag additions to the 5 start_cluster blocks that do exist on 9.0 were auto-merged and are intact.

  3. src/cluster_migrateslots.c (auto-merged, staged) — Verified it matches the upstream diff: the exit-pipe early-return in killSlotMigrationChild and the io_write_state/io_read_state idle checks before snapshotting in proceedWithSlotMigration. server.slot_migration_child_exit_pipe, CLIENT_IDLE, and both IO-state fields all exist on 9.0. No adaptation was needed
    ... summary truncated.

AI-resolved conflicted files

  • src/io_threads.cview diff
  • tests/unit/cluster/cluster-migrateslots.tclview diff

Full backport commit diff: commit efe4f502181a.

Please review these AI resolutions for correctness before merging.

satheeshaGowda and others added 4 commits July 22, 2026 09:48
…ob while snapshotting. (#4104)

**Problem Description**

Atomic slot migration is failing when io-threads enabled and pipeline
requests are ongoing

```== CRITICAL == This slot-import-target is sending an error to its slot-import-source: 'Protocol error: invalid CRLF in request' after processing the command 'set'```

**Proposed Fix**
 Disable I/O threads offloading for slot migration jobs when snapshotting to prevent query buffer desynchronization during pipelining

Signed-off-by: Satheesha Gowda <satheesha.balaji@gmail.com>
When loading slot migration import jobs from the RDB, the start and
end slots of each range were not validated. A corrupted or truncated
RDB could produce out-of-range slot values or a reversed range
(start > end), which would then be used to build migration jobs and
slot ranges.

Reject any slot import range whose start or end slot is greater than
or equal to CLUSTER_SLOTS, or whose start slot is greater than the
end slot, logging a warning and aborting the load.

Fixes #4222.

Signed-off-by: Binbin <binloveplay1314@qq.com>
## Summary
- `clusterRDBLoadSlotImport()` accepted a variable-length `job_name`
from RDB, but `createSlotImportJob()` always `memcpy`'s
`CLUSTER_NAMELEN` (40) bytes. A crafted RDB with a shorter name caused a
heap out-of-bounds read during startup.
- Reject slot-import records whose `job_name` length is not exactly
`CLUSTER_NAMELEN`, matching the existing command-path check.
- Add an integration test that crafts a short `job_name` RDB and asserts
the server fails closed.

Fixes #4207

## Test plan
- [x] `./runtest --single tests/integration/rdb-slot-import.tcl`

---------

Signed-off-by: quanyeyang <quanyemostima@gmail.com>
@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/sweep/9.0 branch from d41fa59 to c1744a1 Compare July 22, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-resolved-conflicts AI is used to resolve conflicts in automated backport PRs. backport Backport PR opened by valkey-ci-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants