Skip to content

Commit 719e9ac

Browse files
milvus: collapse four-part hotfix versions for feature detection (#1058)
Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
1 parent 065e02c commit 719e9ac

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

internal/client/milvus/grpc.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,12 @@ func (g *GrpcClient) checkFeature(ctx context.Context) error {
471471
// "2.6-20260404-31fb3fc" as "2.6.0-20260404-31fb3fc" — a prerelease of 2.6.0 — which
472472
// compares LESS than 2.6.x and silently disables features on dev builds.
473473
func (g *GrpcClient) parseVersionForFeature(ver string) *semver.Version {
474-
sem, err := semver.StrictNewVersion(strings.TrimPrefix(ver, "v"))
474+
v := strings.TrimPrefix(ver, "v")
475+
// Collapse four-part hotfix versions to their release base, e.g. "2.3.22.6" -> "2.3.22".
476+
if parts := strings.SplitN(v, ".", 4); len(parts) == 4 {
477+
v = strings.Join(parts[:3], ".")
478+
}
479+
sem, err := semver.StrictNewVersion(v)
475480
if err != nil {
476481
g.logger.Warn("cannot parse server version as strict semver, treat as latest dev build",
477482
zap.String("version", ver), zap.Error(err))

internal/client/milvus/grpc_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ func TestGrpcClient_parseVersionForFeature(t *testing.T) {
208208
{"VPrefixV2.6.5_HasMultiL0", "v2.6.5", ">= 2.6.5-0", true},
209209
{"VPrefixV2.5.20_HasReplicateMessage", "v2.5.20", ">= 2.5.0-0, < 2.6.0-0", true},
210210

211+
// Four-part versions collapse to their release base. Without the collapse
212+
// these fail StrictNewVersion, fall back to _latestDevVersion, and wrongly
213+
// enable features the underlying release does not implement.
214+
// "v2.4.0.1-gpu-beta" and "v2.4.0.2-gpu-beta" are real milvusdb/milvus tags;
215+
// the trailing component (with its prerelease suffix) is dropped to "2.4.0".
216+
{"FourPartV2.4.0.1GpuBeta_NoMultiL0", "v2.4.0.1-gpu-beta", ">= 2.6.5-0", false},
217+
{"FourPartV2.4.0.1GpuBeta_NoDescribeDatabase", "v2.4.0.1-gpu-beta", ">= 2.4.3-0", false},
218+
{"FourPartV2.3.22.6_NoMultiL0", "v2.3.22.6", ">= 2.6.5-0", false},
219+
{"FourPartV2.6.5.3_HasMultiL0", "v2.6.5.3", ">= 2.6.5-0", true},
220+
211221
// Dev RC tag: must be treated as latest dev (and pass all >= constraints).
212222
// Without StrictNewVersion this regresses: lenient parser turns it into
213223
// 2.6.0-20260404-31fb3fc, which is LESS than 2.6.5-0 and disables features.

0 commit comments

Comments
 (0)