restore v19 behavior: push LIMIT to each shard for non-scatter multi-shard DML - #838
Merged
Merged
Conversation
When enabled, multi-shard UPDATE/DELETE with LIMIT on non-scatter routes (e.g. WHERE id IN (...) on a vindex column) pushes the LIMIT to each shard directly instead of converting to DMLWithInput which requires schema tracking. Scatter routes are unaffected. This restores v19 behavior for targeted multi-shard DML with LIMIT behind an opt-in flag. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
|
Thanks for the contribution! Before we can merge this, we need @frouioui @vitess-bot @systay @harshit-gangal @dbussink to sign the Salesforce Inc. Contributor License Agreement. |
…PassthruEnabled Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## slack-22.0 #838 +/- ##
==============================================
+ Coverage 67.53% 69.53% +2.00%
==============================================
Files 1600 1606 +6
Lines 261782 214319 -47463
==============================================
- Hits 176786 149025 -27761
+ Misses 84996 65294 -19702 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The flag is only registered for vtgate and vtcombo, not vttestserver. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
Add one extra space to align the description column consistently with other flags in vtgate.txt and vtcombo.txt. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
The behavior is now always-on: non-scatter multi-shard DML with LIMIT pushes the LIMIT to each shard directly. Scatter DML with LIMIT still uses DMLWithInput as before. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
The user_extra table does not have a val column in the e2e schema. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
sbaker617
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's this?
In v19, multi-shard UPDATE/DELETE with LIMIT on non-scatter routes (e.g.
WHERE id IN (...)) worked by pushing the LIMIT to each shard directly.In v22, this behavior changed: all multi-shard DML with LIMIT now goes through
DMLWithInput, which requires schema tracking to be enabled, does a primary key lookup select first, and enforces a global limit across shards. This breaks queries that previously worked fine and adds overhead for cases where per-shard LIMIT is acceptable.This PR restores the v19 behavior for non-scatter routes by always pushing LIMIT to each shard. Scatter DML with LIMIT is unaffected -- it still uses
DMLWithInputwith global limit enforcement.Query examples
Real-world example from loadtest:
What changed
--scatter-update-limit-passthruflag from vtgate (was added as an opt-in, now always-on)IsScatterUpdateLimitPassthruEnabled()from VSchema interface and all implementationstryPushingDownLimitInRouteto always push LIMIT for non-scatter DMLdml_cases.json, deleted standalone test fileMost of this was written by Claude Code -- I just provided direction.