[Bug][Cache] Version should not be considered when find the latest partition (#5408)

When a table has multiple partitions, each partition has it's own
version, the version doesn't represent whether it's newer or not. When a
partition has a large version, it may be considered as the largest one
currently, this will cause incorrect query result.
Suppose there are 2 partitions:
PartitionName | VisibleVersion |  VisibleVersionTime
p1            |            123 | 2021-02-17 23:31:32
p2            |             23 | 2021-02-22 11:39:19
Partition p1 will be considered as the lastest partition, and there is a
cache before p2's last update time, the cache will hit and return an
error result.
This commit is contained in:
Yingchun Lai
2021-02-24 11:23:19 +08:00
committed by GitHub
parent 13c7b18592
commit 73b89b58f3

View File

@ -416,8 +416,7 @@ public class CacheAnalyzer {
CacheTable table = new CacheTable();
table.olapTable = olapTable;
for (Partition partition : olapTable.getPartitions()) {
if (partition.getVisibleVersionTime() >= table.latestTime &&
partition.getVisibleVersion() > table.latestVersion) {
if (partition.getVisibleVersionTime() >= table.latestTime) {
table.latestPartitionId = partition.getId();
table.latestTime = partition.getVisibleVersionTime();
table.latestVersion = partition.getVisibleVersion();