Skip to content

Commit d624372

Browse files
committed
MB-70924 More plan version clean up
When reading from remote node, the planVersion is of type float64, not the int expected by current code. More backport from totoro to properly check the type and obtain the planVersion. Change-Id: I58e751b409404b43aa2d465885c4faeecb558bc8 Reviewed-on: https://review.couchbase.org/c/query/+/241726 Tested-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com> Well-Formed: Restriction Checker Reviewed-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>
1 parent f99edff commit d624372

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

datastore/system/system_keyspace_prepareds.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,19 @@ func (b *preparedsKeyspace) Fetch(keys []string, keysMap map[string]value.Annota
119119
m["keyspace"] = b.fullName
120120
m["plan"] = doc["plan"]
121121
m["txPlans"] = doc["txPlans"]
122+
planVersion := int(-1)
122123
if planVer, ok := doc["planVersion"]; ok {
123-
if planVersion, ok := planVer.(int); ok {
124+
switch planVer := planVer.(type) {
125+
case int:
126+
planVersion = planVer
127+
case int64:
128+
planVersion = int(planVer)
129+
case float64:
130+
if value.IsInt(planVer) {
131+
planVersion = int(planVer)
132+
}
133+
}
134+
if planVersion >= util.MIN_PLAN_VERSION {
124135
m["planVersion"] = int32(planVersion)
125136
}
126137
remoteValue.UnsetField("planVersion")
@@ -160,6 +171,8 @@ func (b *preparedsKeyspace) Fetch(keys []string, keysMap map[string]value.Annota
160171
planVersion := entry.Prepared.PlanVersion()
161172
if planVersion >= util.MIN_PLAN_VERSION {
162173
m["planVersion"] = int32(planVersion)
174+
} else {
175+
planVersion = -1
163176
}
164177

165178
// Subquery plans

0 commit comments

Comments
 (0)