Repository navigation
Serialize row policy filter on ReadFromTableStep - #107745
devcrafter wants to merge 1 commit into
Conversation
Add `row_policy_filter` to `ReadFromTableStep` so the row-level filter attached by the planner survives across plan serialization. Wire it through `PlannerJoinTree.cpp` (pass `table_expression_query_info.row_level_filter` into the step) and `resolveStorages.cpp` (re-attach to `select_query_info.row_level_filter` when reconstructing the read on the deserialization side). Without this, queries serialized via `serialize_query_plan = 1` lose their row policy on the remote node — the row policy is enforced on the initiator only, breaking RLS for parallel-replicas / distributed plans. Regression test: `04049_pr_row_policy_and_trivial_count`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Workflow [PR], commit [8233470] Summary: ❌
AI ReviewSummaryThis PR propagates the row-policy Missing context / blind spots
Findings
Tests
Final VerdictStatus: ❌ Block Minimum required action: version-gate the new serialized |
| writeIntBinary(use_parallel_replicas, ctx.out); | ||
|
|
||
| if (row_policy_filter) | ||
| row_policy_filter->serialize(ctx); |
There was a problem hiding this comment.
This extends the version-1 ReadFromTableStep payload, but the outer QueryPlan version stays DBMS_QUERY_PLAN_SERIALIZATION_VERSION = 1 and deserialize does not reject unknown bits here. In a mixed-version cluster, a new initiator can serialize flag 16 plus a FilterDAGInfo; an old replica's ReadFromTableStep::deserialize ignores bit 16 and returns without consuming those bytes, so the rest of the plan/set stream is parsed from the wrong offset instead of producing a clean unsupported-version exception. Please bump/version-gate query-plan serialization for this field, and pass the negotiated plan version into step serialization/deserialization or fail before sending a row-policy plan to a version-1 receiver.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 35/41 (85.37%) | Lost baseline coverage: none · Uncovered code |
|
Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Changelog category (leave one):
ReadFromTableStepdid not carry the row-policyFilterDAGInfoacross serialization. Withserialize_query_plan = 1and parallel-replicas / distributed plans, the row policy was set ontable_expression_query_info.row_level_filteron the initiator but never propagated to the remote node — so the remote-sidestorage->readwas called withoutselect_query_info.row_level_filterand RLS was bypassed.Wire it through:
ReadFromTableStepgains aFilterDAGInfoPtr row_policy_filterfield, ctor argument,getRowPolicyFilter()accessor, andserialize/deserialize/cloneplumbing (flag bit16).PlannerJoinTree.cpppassestable_expression_query_info.row_level_filterto the step.resolveStorages.cpp(replaceReadingFromTable) reads it back viareading_from_table->getRowPolicyFilter()and setsselect_query_info.row_level_filterbefore callingstorage->read.Regression test:
04049_pr_row_policy_and_trivial_count(parallel replicas + plan serialization + row policy + trivial-count).