104 Commits
Author SHA1 Message Date
6648d9371b enhance: unify membership filter expressions into one chain with membership_match syntax (#52778)
## Overview

Adds a unified membership-filter surface syntax and merges the
previously separate `bloom_match` / `roaring_match` chains into one
parameterized execution path.

issue: #52777

## What's in this PR

### 1. Unified surface syntax

```
membership_match(<field>, {<blob-bytes-template>})
membership_match(<field>, {<blob-bytes-template>}, type=bloom|roaring)
not membership_match(<field>, {<blob-bytes-template>})
```

The filter kind is derived from the blob's self-describing magic header
— `MBF1` lowers to the existing `BloomFilterExpr` plan node, `MRB1` to
`RoaringFilterExpr`, and unknown headers fail closed. The optional
`type=` argument is a readability aid and a consistency pin (it must
agree with the magic). The unreleased `bloom_match` / `roaring_match`
surface names are intentionally not retained — neither has shipped in a
release. The wire plan bytes are unchanged from the two predecessor
implementations, so the plan proto stays frozen and rolling-upgrade
behavior for clients using `membership_match` matches what the
predecessor docs specified.

### 2. One control flow, per-kind data planes

- **Go parser/proxy**: one visitor/fill skeleton (`visitMembershipCall`
/ `fillMembershipMatchExpressionValue`), one spec table for behavior
switches (delete safety), and unified tree walkers serving delete
guards, element-level guards, plan-size accounting, and log redaction.
- **segcore**: a single `PhyMembershipFilterExpr<LogicalExpr,
ProbePolicy>` template carries the shared control flow;
`BloomMembershipProbe` (zero-copy SBBF view) and
`RoaringMembershipProbe` (decode-once Roaring64) remain separate data
planes. Historical class names remain aliases, so factory construction
and logs are unchanged.
- Kind-specific admission gates (MBF1 envelope + domain check, MRB1 body
walk + decoded-memory estimate) remain in their own files.
- Client builders move under `client/membership/` (`sbbf`,
`roaringfilter`); `bloom_match`/`roaring_match` builder packages are
removed with the surface names.

### 3. Preserve existing mask/null semantics

The unified executor preserves current `master` behavior on both
raw-data and index-only paths: candidate-mask-excluded rows are left at
their initialized `(false, valid)` value, including excluded NULL rows;
probed NULL rows produce `(false, invalid)`. This PR does not change the
framework reverse-lookup helper.

### 4. Two independent proxy budgets

- `proxy.maxMembershipFilterSize` (default 64 MiB) limits one MBF1 or
MRB1 body. It falls back to the released `proxy.maxBloomFilterSize` key
and the development-only `proxy.maxRoaringFilterSize` key.
- `proxy.maxMembershipFilterPlanSize` (default 128 MiB) remains the
separate request-wide aggregate serialized-plan limit. It falls back to
`proxy.maxBloomFilterPlanSize`.
- Main predicates, scorer filters, and HybridSearch sub-requests share
the same preflight budget. The preflight charges body bytes, matching
the per-blob gate that allows the fixed 32-byte envelope header on top;
final `proto.Size` accounting remains authoritative. Keeping the plan
budget (128 MiB) well above the per-body limit (64 MiB) means a
maximum-size body plus its 32-byte envelope and plan overhead always
fits — no silent halving of the usable tier.

## Deliberate behavior changes

1. Adds `membership_match` with magic-based MBF1/MRB1 dispatch, an
optional `type=` consistency pin, and fail-closed handling for unknown
headers.
2. Removes the unreleased `bloom_match`/`roaring_match` surface names
(and their client builder packages); the wire plan bytes for equivalent
inputs are unchanged.
3. Updates error wording in bytes-template, element-level, MATCH_* and
delete guards.
4. MATCH_* element-predicate guards now reject every membership-filter
surface name.
5. Preflight aggregate accounting charges blob bodies rather than whole
envelopes, matching the per-blob admission rule.

## Non-goals

- No change to MBF1/MRB1 formats, golden vectors, or SDK builders.
- No change to the plan proto or rolling-upgrade contract: fields 22/23
remain frozen.
- No repo-wide NULL/candidate-mask semantic change.

## Design document


[20260822-membership-match-expression.md](https://github.com/xiaofan-luan/milvus/blob/unify-membership-match/docs/design-docs/design_docs/20260822-membership-match-expression.md)

## Test plan

- [x] `internal/parser/planparserv2`: full suite green, including magic
dispatch, alias byte identity, fail-closed cases, delete safety,
redaction, and shared preflight budgeting.
- [x] `pkg/util/paramtable`: fallback-key precedence tests.
- [x] `internal/proxy`: membership size/error/search/query focused tests
green; the full local suite is green except `TestProxy`, which requires
unavailable integration infrastructure and fails identically on clean
HEAD.
- [x] segcore: all 73 bloom/roaring/membership expression tests green;
full `all_tests` has only failures reproduced on clean HEAD (6
ConjunctExprTest + 1 ExprJsonIndexTest abort).
- [x] Local segcore build and unit-test binary link with llvm@19.

---------

Signed-off-by: xiaofanluan <[email protected]>
Signed-off-by: xiaofanluan <[email protected]>
Co-authored-by: xiaofanluan <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-08-30 22:47:34 +08:00
Li LiuandClaude Opus 5 0d7e6c2216 enhance: cut the duplicate halves of the MRB1 roaring codec (#52586)
issue: #52094

Review follow-up to #51968. No behaviour change: the MRB1 wire format,
the validation rules and the limits are all unchanged, and every
surviving production function -- `Build`, `Validate`,
`scanPortableRoaring64Body`, `validateEnvelope` -- is byte-identical to
master. The segcore edits are comments only. The Go production changes
are deletions, plus one behaviour-preserving refactor:
`PlanContainsBloomFilter` and `PlanContainsRoaringFilter` now share
`planContainsFilter` (see "Two smaller items").

## The duplicate halves of the codec

`client/v3/roaringfilter` and `pkg/v3/util/roaringfilter` each exported
the whole codec — `Build`, `Validate`, `Parse`, `Filter` — while
production reached half of each:

| | production entry point | reachable only from tests |
| --- | --- | --- |
| `client/v3/roaringfilter` | `NewRoaringBitmapBlob` → `Build` |
`Validate`, `Parse`, `Filter`, and all 284 lines of
`portable_roaring64.go` |
| `pkg/v3/util/roaringfilter` | `validateRoaringBitmapBlob` → `Validate`
| `Build`, `Parse`, `Filter` |

The two `portable_roaring64.go` files were 2 lines apart, because one
was copied from the other. The two test files were 19 lines apart out of
~985. `pkg`'s copy even carried a wrapper,
`validatePortableRoaring64Body`, that nothing called at all.

Neither package appears in any release tag — `client/v3.0.0-beta`
(2026-07-18), `pkg/v3.0-beta`, `pkg/v3.0.0` and `v3.0.0` (2026-07-29)
all predate #51968, which merged 2026-08-17 — so trimming the two
package APIs breaks no published surface. `git ls-tree` on each of those
tags finds neither directory. The only residual exposure is a consumer
pinned to a master pseudo-version inside a two-day window on an
unreleased package.

Each package now owns one job: **the client builds, pkg validates,
segcore decodes.** The builder and decoder pieces pkg's own tests still
need moved to `fixtures_test.go`, so the validator suite is unchanged
and the package's API is `Validate` alone. That fixture builder is
trimmed to an encoder: the SDK additionally pre-rejects member sets the
proxy would reject, and none of the `buildFixture` call sites assert a
rejection, so reproducing that admission logic there would be a second
copy of it that nothing checks. The bytes are the same either way — a
Roaring bitmap is a set, so insertion order cannot change the encoding.

One side effect worth naming. `pkg` is linked into every server
component, and it was the only non-test importer of
`RoaringBitmap/roaring` outside the SDK, so after this change no
production Go code outside `client/` imports the library. `go.mod` moves
it from the indirect block to a direct require in the **root** module,
because a root-module test file now imports `roaring64` directly;
`pkg/go.mod` keeps it as a direct require for the same reason. So the
module graph is unchanged for anyone depending on `pkg/v3` — what
changed is the production import graph, not the dependency list.

`TestClientAndServerRoaringBuildAgree` existed to compare two builders.
With one builder there is nothing to compare, so it becomes
`TestClientBuiltBlobsPassProxyValidation`: the contract that still spans
two implementations is "a blob the SDK builds is one the proxy accepts".
It keeps the same distribution shapes and sizes, adds a shape that
reaches the bitmap-container and offset-table branches with bytes a real
builder produced, and grades the validator's structural scan against
counts recomputed a third time from the key set, so neither side is
graded against itself.

## The C++ copy of the limits

The nine MRB1 envelope and admission constants exist in three places.
The Go pair was already pinned to each other. segcore consumes its own
copy — `RoaringMembership.cpp` reads all nine — but **nothing pinned
them to the Go values**, so editing `kMaxHighContainerCount` there alone
compiled and passed CI, and the symptom only showed up in production as
the proxy admitting a blob every querynode refuses, or the SDK refusing
to build one the cluster would take.

segcore's copy is now **generated** from the Go one rather than checked
against it. `cmd/tools/genmrb1limits` writes
`internal/core/src/common/MRB1Limits.generated.h` from
`pkg/util/roaringfilter`'s constants, and `RoaringMembership.h` aliases
the names in it:

```cpp
static constexpr auto kHeaderSize = mrb1::kHeaderSize;
```

There is one definition, in Go, and segcore resolves it.
`RoaringMembership.cpp` is untouched: `RoaringMembership::kFoo` still
names the same value at the same width.

An earlier revision did this the other way — a Go test opened the two
segcore sources and parsed the declarations out of them. It worked, and
fault injection said so, but it was 623 lines, and the reason it needed
them is that every way of being shown the wrong declaration is a way to
pass over a diverged constant: comments carrying an old value,
non-literal initializers, a declared type that silently truncates
(`uint16_t kX = uint64_t{1} << 18` is 0), a name mentioned rather than
declared, an enum member or `#ifdef` pair hiding the live declaration
behind a readable decoy, and a macro defeating the check that catches
those. The cost landed on C++: those two files had to stay macro-free,
one-declarator-per-statement, and evaluable, enforced by a Go test in
another directory that takes the whole `internal` UT job down with it —
in a tree that has 172 `#define` and five headers using include guards.
Generating removes the need for all of it; segcore may spell its
constants however it likes now, because nothing reads them.

### What each half guarantees

- **Values and types reach segcore intact.** A standalone TU reproducing
the class, the aliases and the call-site shapes from
`RoaringMembership.cpp` compiles under `clang++ -std=c++20 -Wall
-Wextra` and `static_assert`s that every constant still equals the
literal it replaced and still has its old declared type (`const
std::string_view` / `uint16_t` / `size_t` / `uint64_t`), so no
comparison in the `.cpp` changes width.
- **The header cannot go stale.** `TestGeneratedHeaderIsCurrent` fails
when the file on disk is not what the generator would write. Injected
both directions — a Go constant changed without regenerating, and a
hand-edited generated header — and both fail with the regenerate
instruction.
- **A wrong type in the generator's table is a compile error, not a
truncation.** The values are brace-initialised for exactly this,
measured rather than assumed: clang accepts `constexpr uint16_t kX =
262144` without a word and gives it 0, while `constexpr uint16_t
kX{262144}` is `-Wc++11-narrowing`, an error by default. Injected:
narrowing one row fails at the generated header and again at every
`static_assert` downstream.

It also lands somewhere better to run. `internal/parser` is covered by
the codecov job only; `cmd/tools` is named by both it and
`scripts/run_go_unittest.sh`, so `make test-go` now covers this where it
did not cover the pin.

### What this gives up

- **The completeness direction.** The scan required every `k`-prefixed
constant in those two files to be classified as pinned or deliberately
unpinned, so a limit added to segcore alone was caught. Nothing replaces
that: a new MRB1 limit has to be added to the generator's table, and
adding one only to C++ is now caught by review rather than by CI.
- **Use sites, which neither approach ever covered.** Changing `/
kPortableRoaring64MinEntryBytes` to `/ 16`, or a `>=` to a `>`, diverges
segcore from the Go validator exactly as a changed constant would, and
passes.

The seven portable-Roaring wire constants in `RoaringMembership.cpp`
remain deliberately **not** pinned by value. They are RoaringFormatSpec
values rather than a Milvus contract, and two of them are derived rather
than chosen. Each side is held to them behaviourally, at the boundary,
by fixtures written independently on each side. That catches something a
value check cannot — a value check reads declarations, so flipping a `>`
to a `>=` passes it while the fixtures fail — but it is not strictly
stronger, and injection says so: `kPortableRoaring64MinEntryBytes` 12 →
16 fails on both sides, 12 → 8 fails on neither. Loosening is benign
here, since the bound is a pre-filter and the full scan behind it
rejects the same input, but the two sides really can drift in that
direction unnoticed. That reasoning now lives next to the constants in
`RoaringMembership.cpp` rather than in a test file.


## Two smaller items

- `PlanContainsBloomFilter` and `PlanContainsRoaringFilter` were
line-for-line copies of each other, and both re-implemented the switch
`planPredicates` already does — three copies of one switch in one
package. They share `planContainsFilter` now. Its nil check is gone with
them: the generated getters are nil-safe and `walkExpr` reports false
for a nil expression, and both nil cases are covered by existing tests.
- `PhyRoaringFilterExpr` passes a `nullptr` `skip_func`, so no chunk is
ever skipped. Bloom has no choice — an SBBF exposes no range — but a
Roaring bitmap has `Minimum()`/`Maximum()` in O(1). Left as a TODO
against this issue, carrying the two's-complement caveat, so it doesn't
read as "roaring can't".

## Verification

Coverage of the deleted client-side tests was checked rather than
assumed: all 18 `Test*` functions removed from
`client/roaringfilter/roaring_filter_test.go` have a counterpart in
`pkg/util/roaringfilter/roaring_filter_test.go`, which is where the
validator they exercise now lives. 4 keep their name outright; the other
14 are `TestParse*`/`TestBuildParse*` names renamed to `TestValidate*`
because the package no longer exports `Build` or `Parse`. The
differential oracle the old cross-module test provided is not lost:
`TestBuildMatchesLegacyByteForByte` pins the SDK's output byte-for-byte
against a naive builder, which is a better oracle than comparing two
copies of the same wrapper.

`FuzzParse` becomes `FuzzValidate`. One direction of its equivalence
became trivially true, because `parseFixture` calls `Validate` first;
the comment says so rather than implying otherwise. The load-bearing
comparison survives: the cardinality the hand-rolled scanner computes is
cross-checked against what `roaring64.ReadFrom` decodes, so the grader
is the upstream library, not the implementation under test.

Passed in this checkout:

- `client/v3/roaringfilter`, `client/v3/milvusclient`
- `pkg/v3/util/roaringfilter` — the full validator suite, plus
`FuzzValidate`
- `internal/parser/planparserv2` — the whole package, including the
rewritten `TestClientBuiltBlobsPassProxyValidation`
- `cmd/tools/genmrb1limits` — `TestGeneratedHeaderIsCurrent` and its two
table guards; the generator is idempotent
- `go vet` on all three modules; `gofmt -l` clean; `clang-format-15`,
the version `internal/core` pins, reports all four touched C++ files
clean

Running `internal/parser/planparserv2` locally needs `LOCALSTORAGEPATH`
pointed somewhere writable: paramtable's `LOCAL_STORAGE_SIZE` formatter
mkdirs `/var/lib/milvus/data/` and `mlog.Fatal`s if it cannot, which on
a stock macOS checkout takes the package down before any assertion runs.
That reproduces identically on `upstream/master`.

Two things I could not check locally and am not claiming:
`internal/proxy` and `internal/distributed/proxy/httpserver` need a
built `milvus_core`/`rocksdb`, so the one external caller of the trimmed
API — `internal/proxy/task_delete_test.go`, which uses the client's
`Build`, still exported — is grep-verified only. segcore was not
rebuilt: the standalone TU above is the strongest check I could run
without it, and CI is the first real segcore build. Its non-comment edit
is nine one-line aliases and one `#include`. `golangci-lint` crashes
locally on a Go toolchain mismatch, so CI is the first real lint run.

Where the new guard runs: `cmd/tools`, which both `make
codecov-go-without-build` → `scripts/run_go_codecov.sh` and
`scripts/run_go_unittest.sh` → `make test-go` cover. The test's own doc
comment says this.

## Follow-ups

- `client/sbbf` is in the same shape this PR fixes for roaring: it
exports `Parse`, `Filter` and six accessors with no non-test caller, it
is likewise absent from every release tag, and MBF1 has the same
three-way limit contract with no guard. Left alone deliberately to keep
this diff to one format; adding it now means one more table in
`cmd/tools/genmrb1limits`, not a second mechanism.
- `redactExprParams`' doc comment is attached to `hasExprParams` in
`internal/distributed/proxy/httpserver/handler_v2.go`, leaving
`redactExprParams` undocumented in godoc. That fix was in an earlier
revision of this PR and was taken out: it is another subsystem, and it
belongs in its own `doc:` PR.

---------

Signed-off-by: Li Liu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-08-20 16:33:19 +08:00
Zhen Ye b07c62d53c enhance: replace log package with context-aware mlog (#50094)
issue: #35917

- mlog package: move logger initialization, zap core, async buffered
writes, field helpers, and scoped logger binding into pkg/mlog while
removing pkg/log.
- logging callsites: migrate Milvus logging usage to context-aware mlog
APIs and simplify redundant With chains across components, utilities,
tests, and tools.
- trace propagation: replace logutil trace interceptors with mlog/tracer
integration and add client_request_id fallback propagation for server
stats handlers.

---------

Signed-off-by: chyezh <[email protected]>
2026-06-24 00:58:28 +08:00
congqixia 7311d450a0 enhance: bump Go dependencies to v3 modules (#49485)
Related to #49398

Bump Go module references from pkg/v2 and milvus-proto/go-api/v2 to
pkg/v3 and milvus-proto/go-api/v3 so the client tracks the Milvus 3.x
release line.

This prepares the repository for the upcoming 3.x.y release by aligning
imports, module dependencies, and proto API references with the new
major-version module paths.

---------

Signed-off-by: Congqi Xia <[email protected]>
2026-05-01 10:30:13 +08:00
Li LiuandClaude Opus 4.6 87b04e8a63 fix: remove golangci-lint v2 exclusion rules and fix ~1500 lint violations (#48586)
## Summary
Remove all temporary exclusion rules added during the golangci-lint
v1→v2 upgrade (PR #48286), fixing ~1500 lint violations:

- **QF series (~1080)**: auto-fixed with `--fix` (embedded field
selectors, if/else→switch, De Morgan's law)
- **ST1005 (148)**: lowercase error strings per Go conventions
- **gosec (116)**: fix G118 context cancel leaks, G306 file permissions;
nolint for G602/G120/G705 false positives
- **revive (41)**: `Json`→`JSON`, `Url`→`URL` naming conventions
- **ineffassign (14)**: remove unused assignments
- **unconvert (13)**: remove unnecessary type conversions
- **depguard (9)**: replace banned `errors` import with
`cockroachdb/errors`
- **gocritic (14)**: fix ruleguard violations
- **Other staticcheck (12)**: S1034, S1008, SA3001 etc.

Kept disabled: govet `printf` analyzer (known Go 1.25 + golangci-lint v2
panic bug)

issue: #48574
pr: #48286

## Test plan
- [x] `golangci-lint run` passes with 0 issues locally
- [ ] CI passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Li Liu <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-17 02:11:44 +08:00
e0873a65d4 enhance: remove SuffixSnapshot mechanism from RootCoord metadata storage (#47960)
## Summary

Remove the entire SuffixSnapshot time-travel layer from RootCoord
metadata storage, replacing it with plain KV operations.

Replace SnapShotKV with TxnKV in Catalog (~30 call sites)
Delete suffix_snapshot.go (~750 lines) and tests (~917 lines)
Remove SnapShotKV interface from pkg/kv/kv.go
Remove snapshot GC config params (ttl, reserveTime)
Keep IsTombstone/ComposeSnapshotKey constants for migration tool
compatibility
Why: Investigation confirmed snapshot keys are write-only artifacts that
nobody reads:

No client/proxy sends non-zero timestamp for time-travel metadata
queries
Tombstone sweeper calls RemoveCollection(ts=0), bypassing snapshot
tombstone writes entirely
Snapshot keys accumulate as orphans — the old GC couldn't fully clean
them because ts=0 deletion path never wrote tombstone markers
Net reduction: -2180 lines

related: #48697

## Test plan
- [x] Unit tests for GC batch logic (expiry, cursor progress,
latest-per-group protection, tombstone cleanup)
- [x] Unit tests for Save/Load with time-travel verification
- [x] `go vet` passes on all changed packages
- [ ] CI passes

Signed-off-by: MrPresent-Han <[email protected]>
Co-authored-by: MrPresent-Han <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-10 14:33:39 +08:00
XiaofanandClaude Opus 4.6 d8f0811af1 fix: remove IsTriggerKill SIGINT from datacoord and querycoord session watchers (#48252)
## Summary

Removes the `IsTriggerKill` / SIGINT block from
`datacoord.stopServiceWatch()` and `querycoordv2.watchNodes()`.

### Root Cause

In MixCoord mode all three coordinators share the same etcd `Session`
object. During shutdown, when any coordinator calls `session.Stop()` it
cancels the shared context, closing the other coordinators' etcd watches
— triggering `stopServiceWatch()` / `watchNodes()` which sent SIGINT to
the process during a normal, coordinated teardown.

### Why remove SIGINT?

- `go s.Stop()` already handles unexpected session loss — SIGINT was
just a backstop in case `Stop()` hangs
- No other component (rootcoord, proxy, datanode, querynode) has this
logic
- The false-positive risk (killing the process during normal shutdown)
outweighs the marginal benefit

issue: #48242

---------

Signed-off-by: xiaofanluan <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-19 22:29:28 +08:00
congqixia fdaebc4127 enhance: skip remote and env config sources in yaml generation (#48358)
The config gen-yaml tool initialized BaseTable with default options,
which connected to etcd and loaded environment variables. This caused
runtime config values (e.g. mq.type=pulsar from etcd) to override
code-defined defaults, producing incorrect generated yaml files.

Signed-off-by: Congqi Xia <[email protected]>
2026-03-19 12:33:26 +08:00
Li LiuandClaude Opus 4.6 ff5b6d0a64 enhance: remove spf13/viper dependency (#47944)
## Summary
- Replace spf13/viper with yaml.v3 in the only 2 files that used it
(printer.go, server_test.go)
- Remove viper + 7 transitive deps from go.mod (8 packages total)
- C++ ghost dep removal (libsodium, simde) deferred to separate PR to
avoid CI conan issues

### Removed packages
spf13/viper, fsnotify/fsnotify, hashicorp/hcl, mitchellh/mapstructure,
pelletier/go-toml, spf13/afero, spf13/jwalterweatherman, subosito/gotenv

## Test plan
- [ ] CI passes (Go build + code-check)
- [ ] `go mod tidy` produces no diff
- [ ] querynodev2 TestInit_QueryHook passes with new yamlConfigWriter

issue: https://github.com/milvus-io/milvus/issues/47919

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Li Liu <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-03-16 15:13:31 +08:00
XiaofanandClaude Opus 4.6 d69bdd288c fix: fix macOS 15 ARM64 compilation issues (#7437) (#47810)
issue: #47809

---------

Signed-off-by: xiaofanluan <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-03-06 23:19:21 +08:00
Li LiuandClaude Opus 4.6 72918439ef enhance: remove unused Go dependencies (ansi, fastjson, grpc/examples, sizedwaitgroup) (#47852)
Related to #46199

## Summary

Remove 5 unused or misused Go dependencies to reduce module bloat and
consolidate overlapping libraries:

- **`mgutz/ansi`** → replaced with inline ANSI escape codes (only used
for 3 color constants in migration console)
- **`valyala/fastjson`** → replaced with `tidwall/gjson` (only 1 file
used fastjson; gjson is already used in 22+ files)
- **`google.golang.org/grpc/examples`** → replaced with existing
`rootcoordpb` (test file pulled in entire grpc examples repo for a mock
server)
- **`remeh/sizedwaitgroup`** → replaced with `chan` semaphore +
`sync.WaitGroup` (only 2 files, trivial pattern)
- **`pkg/errors`** → replaced with `cockroachdb/errors` (the project
standard; `pkg/errors` was used in 1 file)

## Behavior change: DeleteLog.Parse() fail-fast on missing fields

The `fastjson` → `gjson` migration adds explicit `Exists()` validation
for `ts`, `pk`, and `pkType` fields in the JSON parsing branch.
Previously, both fastjson and gjson would silently return zero values
for missing fields, causing `dl.Pk` to remain nil and panicking
downstream. The new code fails fast with a descriptive error at parse
time. This is a defensive improvement (the original code had identical
silent-failure behavior).

## Performance impact

| Change | Path type | Perf delta | Matters? |
|--------|-----------|------------|----------|
| `pkg/errors` → `cockroachdb/errors` | Cold (offline CLI tool
`config-docs-generator`) | Negligible | No |
| `mgutz/ansi` → inline ANSI codes | Cold (offline CLI tool
`migration/console`) | Marginally faster (eliminates map lookup) | No |
| `fastjson` → `gjson` (`DeleteLog.Parse`) | Warm — old-format deltalog
deserialization only | **~2.5x slower** per JSON parse (143ns→361ns) |
**No** — see below |
| `grpc/examples` → `rootcoordpb` | Test only (`client_test.go`) | None
| No |
| `sizedwaitgroup` → chan+WaitGroup | Test only (`wal_test.go`,
`test_framework.go`) | None | No |

### fastjson → gjson regression detail

`DeleteLog.Parse()` is called per-row during deltalog deserialization,
but **only for the legacy single-field format**. The new multi-field
parquet format (`newDeltalogMultiFieldReader`) reads pk/ts as separate
Arrow columns and bypasses `Parse()` entirely. Legacy deltalogs are
rewritten to parquet format during compaction, so this is a dying code
path. Additionally, deltalog loading is I/O-bound — the JSON parse cost
(~361ns/row) is negligible compared to disk read and Arrow
deserialization overhead.

Benchmark (Go 1.24, arm64):
```
BenchmarkFastjsonSmall-4       8,315,624    143.1 ns/op    0 B/op   0 allocs/op
BenchmarkGjsonOptimized-4      3,321,613    361.4 ns/op   96 B/op   1 allocs/op
```

## Test plan

- [x] CI build passes
- [x] CI code-check passes
- [ ] CI ut-go passes
- [ ] CI e2e passes
- [x] Boundary test cases added (bare number, missing pkType/ts/pk)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Li Liu <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-02-27 00:49:27 +08:00
Buqian Zheng 1a7ca339a5 feat: expose the Go expr parser to C++ and embed into libmilvus-core.so (#45703)
generated a library that wraps the go expr parser, and embedded that
into libmilvus-core.so

issue: https://github.com/milvus-io/milvus/issues/45702

see `internal/core/src/plan/milvus_plan_parser.h` for the exposed
interface

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced C++ API for plan parsing with schema registration and
expression parsing capabilities.
* Plan parser now available as shared libraries instead of a standalone
binary tool.

* **Refactor**
* Reorganized build system to produce shared library artifacts instead
of executable binaries.
* Build outputs relocated to standardized library and include
directories.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Buqian Zheng <[email protected]>
2025-12-22 23:59:18 +08:00
Zhen Ye 459425ac84 fix: wrong context using by session of grpc client (#46183)
issue: #46182

Signed-off-by: chyezh <[email protected]>
2025-12-08 21:47:12 +08:00
Zhen Ye 2ef18c5b4f enhance: remove watch at session liveness check (#45968)
issue: #45724

---------

Signed-off-by: chyezh <[email protected]>
2025-12-01 17:55:10 +08:00
congqixia f51fcc09ae fix: resolve SessionWatcher goroutine leak and unstable UT in querycoordv2 (#45627)
Related to #44620
Related to unstable ut "internal/querycoordv2 TestServer/TestNodeUp"

Introduce SessionWatcher interface to fix race condition and goroutine
leak that caused unstable unit test TestServer/TestNodeUp.

Changes:
- Add SessionWatcher interface with EventChannel() and Stop() methods
- Refactor WatchServices() to return SessionWatcher instead of raw
channel
- Fix cleanup order in QueryCoordV2: stop watcher before session
- Update DataCoord, ConnectionManager to use SessionWatcher
- Add MockSessionWatcher for testing

Fixes race condition between session context cancellation and internal
loop exit. Eliminates goroutine leak by providing explicit lifecycle
management.

---------

Signed-off-by: Congqi Xia <[email protected]>
2025-11-21 18:33:06 +08:00
Xiaofan a9895bb904 enhance: add robust handle etcd servercrash (#45304)
related to #45303
fix milvus pod may restart when etcd pod start

Signed-off-by: xiaofanluan <[email protected]>
2025-11-13 10:23:36 +08:00
Zhen Ye 576084fe86 enhance: support alter collection/database with WAL-based DDL framework (#45266)
issue: #43897

- Alter collection/database is implemented by WAL-based DDL framework
now.
- Support AlterCollection/AlterDatabase in wal now.
- Alter operation can be synced by new CDC now.
- Refactor some UT for alter DDL.

---------

Signed-off-by: chyezh <[email protected]>
2025-11-04 09:59:33 +08:00
Buqian Zheng c284e8c4a8 enhance: some minor code cleanup, prepare for scalar benchmark (#45008)
issue: https://github.com/milvus-io/milvus/issues/44452

---------

Signed-off-by: Buqian Zheng <[email protected]>
2025-10-24 14:22:05 +08:00
sthuangandnico 43c3c160ff feat: [StorageV2] cmd binlog tool (#43648)
related: #39173 

Core Features
* Parquet File Analysis: Analyze Milvus binlog Parquet files with
metadata extraction
* MinIO Integration: Direct connection to MinIO storage for remote file
analysis
* Vector Data Deserialization: Specialized handling of Milvus vector
data in binlog files
* Interactive CLI: Command-line interface with interactive exploration

Analysis Capabilities
* Metadata & Vector Analysis: Extract schema info, row counts, and
vector statistics
* Data Export: Export data to JSON format with configurable limits
* Query Functionality: Search for specific records by ID
* Batch Processing: Analyze multiple Parquet files simultaneously

User Experience
* Verbose Output: Detailed logging for debugging
* Error Handling: Robust error handling for file access and parsing
* Flexible Output: Support for single file and batch analysis formats

---------

Signed-off-by: shaoting-huang <[email protected]>
Co-authored-by: nico <[email protected]>
2025-07-31 15:05:37 +08:00
Xiaofan bd31b32167 fix: hybridsearch should support offset param in restful api (#43586)
Add support of offset param for reqeustful. api and refine some constant
usage related #43556

Signed-off-by: xiaofanluan <[email protected]>
2025-07-28 22:15:36 +08:00
Spade A faeb7fd410 feat: impl StructArray -- create schema, insert, and retrieve data (#42855)
Ref https://github.com/milvus-io/milvus/issues/42148

https://github.com/milvus-io/milvus/pull/42406 impls the segcore part of
storage for handling with VectorArray.
This PR:
1. impls the go part of storage for VectorArray
2. impls the collection creation with StructArrayField and VectorArray
3. insert and retrieve data from the collection.

---------

Signed-off-by: SpadeA <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
2025-07-27 01:30:55 +08:00
cai.zhang 59b003adac enhance: Skip modify field meta when rename collection or rename dbName (#42875)
issue: #42873

---------

Signed-off-by: Cai Zhang <[email protected]>
2025-06-23 17:04:41 +08:00
tinswzy 754ca58469 enhance: improve WP parameters according to performance testing (#42666) 2025-06-13 20:33:41 +08:00
Zhen Ye 9cb5271027 enhance: remove support of embeded nats mq (#41565)
issue: #41564

Signed-off-by: chyezh <[email protected]>
2025-04-28 23:06:49 +08:00
junjiejiangjjj e56adc121b enhance: refactor embedding credentials manager (#41442)
https://github.com/milvus-io/milvus/issues/35856

Signed-off-by: junjie.jiang <[email protected]>
2025-04-24 14:34:38 +08:00
SimFGandgithub-actions[bot] 91d40fa558 fix: Update logging context and upgrade dependencies (#41318)
- issue: #41291

---------

Signed-off-by: SimFG <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-23 10:52:38 +08:00
tinswzy 6fa68c1f16 enhance: Support Woodpecker as a WAL storage option for Milvus (#41095)
#40916 Support Woodpecker as a WAL storage option for Milvus

Signed-off-by: tinswzy <[email protected]>
2025-04-20 22:22:42 +08:00
Xianhui Lin 5318f3085c feat: Add configuration for mixCoord (#41246)
Add configuration for mixCoord
relate-pr:https://github.com/milvus-io/milvus/pull/41006
issue : https://github.com/milvus-io/milvus/issues/37764

Signed-off-by: Xianhui.Lin <[email protected]>
2025-04-11 18:04:49 +08:00
Xianhui Lin f9febe3bae enhance: Merge RootCoord, DataCoord And QueryCoord into MixCoord (#41006)
Merge RootCoord, DataCoord And QueryCoord into MixCoord
Make Session into one
issue : https://github.com/milvus-io/milvus/issues/37764

---------

Signed-off-by: Xianhui.Lin <[email protected]>
2025-04-11 16:36:30 +08:00
junjiejiangjjj fe81c7baae feat: Add function config (#40534)
#35856 
1. Add function-related configuration in milvus.yaml
2. Add null and empty value check to TextEmbeddingFunction

Signed-off-by: junjie.jiang <[email protected]>
2025-03-25 10:06:24 +08:00
congqixia cb7f2fa6fd enhance: Use v2 package name for pkg module (#39990)
Related to #39095

https://go.dev/doc/modules/version-numbers

Update pkg version according to golang dep version convention

---------

Signed-off-by: Congqi Xia <[email protected]>
2025-02-22 23:15:58 +08:00
yihao.dai 38f813bed3 enhance: Read metadata concurrently to accelerate recovery (#38403)
Read metadata such as segments, binlogs, and partitions concurrently at
the collection level.

issue: https://github.com/milvus-io/milvus/issues/37630

---------

Signed-off-by: bigsheeper <[email protected]>
2025-01-23 14:27:27 +08:00
Zhen Ye 3e788f0fbd enhance: record memory size (uncompressed) item for index (#38770)
issue: #38715

- Current milvus use a serialized index size(compressed) for estimate
resource for loading.
- Add a new field `MemSize` (before compressing) for index to estimate
resource.

---------

Signed-off-by: chyezh <[email protected]>
2025-01-14 10:33:06 +08:00
Zhen Ye bb8d1ab3bf enhance: make new go package to manage proto (#39114)
issue: #39095

---------

Signed-off-by: chyezh <[email protected]>
2025-01-10 10:49:01 +08:00
tinswzy 27229f7907 enhance: refine exists log print with ctx (#38080)
issue: #35917 
Refines exists log print with ctx

Signed-off-by: tinswzy <[email protected]>
2024-12-14 22:36:44 +08:00
tinswzy 7944538ade enhance: Add ctx param to KV operation interfaces (#38154)
issue: #35917 
Refine KV operation interfaces by adding a ctx param

Signed-off-by: tinswzy <[email protected]>
2024-12-05 15:16:41 +08:00
shaoyue 1f66b9ebfb feat: add config field to set internal tls sni (#38124)
/cc @xiaofan-luan @jaime0815 @nish112022

part of https://github.com/milvus-io/milvus/issues/36864

Signed-off-by: haorenfsa <[email protected]>
2024-12-04 14:56:47 +08:00
SimFG 2208b7c2ef fix: the too long default root password does not take effect (#37983)
- issue: #36987

Signed-off-by: SimFG <[email protected]>
2024-11-26 17:24:35 +08:00
nish112022 484c6b5c44 feat: Added code for Internal-tls (#36865)
issue : https://github.com/milvus-io/milvus/issues/36864

I have a few questions regarding my approach.I will consolidate them
here for feedback and review.Thanks

---------

Signed-off-by: Nischay Yadav <[email protected]>
Signed-off-by: Nischay <[email protected]>
2024-11-20 06:00:32 +08:00
jaime 1d06d4324b fix: Int64 overflow in JSON encoding (#37657)
issue: ##36621

- For simple types in a struct, add "string" to the JSON tag for
automatic string conversion during JSON encoding.
- For complex types in a struct, replace "int64" with "string."

Signed-off-by: jaime <[email protected]>
2024-11-14 22:52:30 +08:00
Ted Xu a9538f6e96 fix: config file validator missed the file tail validation (#37608)
See: #32168

Signed-off-by: Ted Xu <[email protected]>
2024-11-13 15:14:30 +08:00
foxspy 3de57ec4fa enhance: add vector index mgr to remove vector index type dependency (#36843)
issue: #34298

Signed-off-by: xianliang.li <[email protected]>
2024-10-17 22:15:25 +08:00
Zhen Ye a6545b2e29 fix: refactor milvus config and change default txn timeout (#36522)
issue: #36498

Signed-off-by: chyezh <[email protected]>
2024-09-29 11:01:15 +08:00
Zhen Ye 99dff06391 enhance: using streaming service in insert/upsert/flush/delete/querynode (#35406)
issue: #33285

- using streaming service in insert/upsert/flush/delete/querynode
- fixup flusher bugs and refactor the flush operation
- enable streaming service for dml and ddl
- pass the e2e when enabling streaming service
- pass the integration tst when enabling streaming service

---------

Signed-off-by: chyezh <[email protected]>
Signed-off-by: bigsheeper <[email protected]>
2024-08-29 10:03:08 +08:00
SimFG 731d45abbe enhance: provide more general configuration to control mmap behavior (#35359)
- issue: #35273

Signed-off-by: SimFG <[email protected]>
2024-08-21 00:22:54 +08:00
Ted Xu c6ae7d4d56 enhance: adding the msgchannel section in generated yaml (#35466)
See #32168

Signed-off-by: Ted Xu <[email protected]>
2024-08-14 18:32:53 +08:00
Ted Xu b4d0f4df0a enhance: update param documents (#35152)
See: #35161

---------

Signed-off-by: Ted Xu <[email protected]>
2024-08-01 12:38:13 +08:00
wei liu c45f38aa61 enhance: Update protobuf-go to protobuf-go v2 (#34394)
issue: #34252

Signed-off-by: Wei Liu <[email protected]>
2024-07-29 11:31:51 +08:00
Ted Xu 63f0154dfb fix: enable milvus.yaml check (#34567)
See #32168

---------

Signed-off-by: Ted Xu <[email protected]>
2024-07-25 18:05:46 +08:00
jaime 9630974fbb enhance: move rocksmq from internal to pkg module (#33881)
issue: #33956

Signed-off-by: jaime <[email protected]>
2024-06-25 21:18:15 +08:00