read and write path using different code to locate partition may add code repetition and bring risks #56095
Labels
component/tablepartition
This issue is related to Table Partition of TiDB.
sig/sql-infra
SIG: SQL Infra
type/enhancement
The issue or PR belongs to an enhancement.
Reproduce
The direct cause of this problem is #56094, which means this table should not be created successfully in the first place.
However, this problem exposes one issue: the read path and write path rely on different code to locate the partition for the given value, and they may produce different results.
In the example above, the read path thinks it's in
p1
but the write path writes it top5
. You can easily check this by usingEXPLAIN
andshow stats_meta
(after waiting for 1 min).The entry for the write path is
(*partitionedTable).locatePartition()
intable/tables/partition.go
and it handles a row of values. The entry point for the read path isPartitionPruning()
inplanner/core/partition_prune.go
and it handles a filter expression. They are not the same but I believe there are many overlaps.The text was updated successfully, but these errors were encountered: