You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2026/08/11 07:33:06 UTC

(skywalking-banyandb) branch main updated: Bound the trace merge drop-set with a retain-instead-of-drop ceiling (#1277)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new 0ea574327 Bound the trace merge drop-set with a retain-instead-of-drop ceiling (#1277)
0ea574327 is described below

commit 0ea574327a262d1d0cde3df408f2ba8224356bfa
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Tue Aug 11 15:33:01 2026 +0800

    Bound the trace merge drop-set with a retain-instead-of-drop ceiling (#1277)
---
 CHANGES.md                                         |   1 +
 .../internal/benchmark/tracebaseline/html_test.go  |   2 +-
 .../internal/benchmark/tracebaseline/readiness.go  |  40 +-
 .../benchmark/tracebaseline/readiness_test.go      |  28 +-
 banyand/internal/benchmark/tracefixture/sampler.go |  39 +-
 .../tracefixture/sampler_seed_bench_test.go        | 404 +++++++++++
 .../benchmark/tracefixture/sampler_test.go         |  33 +
 banyand/internal/sidx/block_writer.go              |   1 +
 banyand/trace/benchmark_merge_receiver_test.go     |   1 +
 banyand/trace/block_writer.go                      |   1 +
 banyand/trace/drop_set.go                          | 290 ++++++++
 banyand/trace/drop_set_budget_test.go              | 148 ++++
 banyand/trace/drop_set_observability_test.go       | 238 +++++++
 banyand/trace/drop_set_test.go                     | 315 +++++++++
 banyand/trace/finalize_scanner.go                  |  32 +-
 banyand/trace/finalizer.go                         |  13 +-
 .../trace/fragment_guard_implementation_test.go    |  14 +-
 banyand/trace/merge_benchmark_observer.go          |  32 +-
 banyand/trace/merger.go                            | 385 +++++++++--
 banyand/trace/merger_drop_set_ceiling_test.go      | 744 +++++++++++++++++++++
 banyand/trace/metrics.go                           |  79 +++
 banyand/trace/pipeline_chain.go                    | 216 ++++--
 banyand/trace/pipeline_chain_filter_test.go        |   3 +-
 banyand/trace/pipeline_chain_test.go               | 209 +++++-
 banyand/trace/pipeline_metrics.go                  |  28 +
 banyand/trace/tag.go                               |  18 +-
 docs/design/post-trace-pipeline.md                 |  24 +-
 docs/design/trace-drop-set-bounding-plan.md        | 391 +++++++++++
 docs/design/trace-drop-set-bounding.md             | 579 ++++++++++++++++
 .../trace-pipeline-merge-optimization-plan.md      | 313 +++++++--
 .../trace-pipeline-merge-performance-test.md       |  50 ++
 pkg/fs/local_file_system.go                        |  67 +-
 pkg/fs/local_file_system_test.go                   |  29 +
 pkg/pipeline/sdk/decode.go                         |  66 +-
 pkg/pipeline/sdk/sdk_test.go                       |  23 +
 .../skywalking/internal/tracesampler/sampler.go    |  44 +-
 36 files changed, 4579 insertions(+), 321 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index beb090ba2..ad8413596 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Release Notes.
 
 ### Features
 - Add trace **finalization sampling** (`PIPELINE_EVENT_FINALIZE`), a best-effort background backstop for the in-merge trace retention filter. A single node-wide, concurrency-1 scanner periodically sweeps cooled segments (`segEnd < now − finalize_grace`, reopening idle-closed segments via `SelectSegments(reopenClosed=true)`) and force-merges each shard's un-finalized parts through the group's registered sampler chain, reusing the hot merge path (`mergeParts` + per-sidx `Merge` + the shard [...]
+- Bound the trace merge **drop-set** so a large sampled merge cannot exhaust the heap. The merge-wide dropped-trace-ID collector was unbounded: because a shard's first finalize round selects every cooled part into one merge, an 18M-drop set reaches ~1.3 GiB live and ~2.6 GiB reserved heap (append doubling plus a single contiguous lookup index), inside a process also serving queries. The bound is applied to the sampling **decision**, not to the pruning predicate: once a merge's drop set i [...]
 - Add two catalogs to the queue batch-write metrics so traffic is comparable on both ends: a per-batch-stream **batch catalog** (`total_batch_started`/`total_batch_finished`/`total_batch_latency`, buckets to ~300s) on `queue_pub`/`queue_sub` and the `lifecycle_migration` mirror, and a per-message **message catalog** (`total_message_started`/`total_message_finished`) on `queue_sub` (the publisher's existing `total_*` already counts per message). All existing `total_*` series are unchanged [...]
 - Redesign the queue (`queue_pub`/`queue_sub`) metrics around a uniform model: keep only `total_started`, `total_finished`, `total_latency` (now a histogram) and `total_err`, plus file-sync-only `sent_bytes` (pub) / `received_bytes` (sub). Replace the `topic` label with `operation` (`batch-write`/`file-sync`/`query`/`control`) and `group`, add an `error_type` label on `total_err`, and add remote-endpoint labels (`remote_node`/`remote_role`/`remote_tier`) so the liaison↔data (hot/warm/col [...]
 - Stamp the lifecycle's tier-migration publisher's identity onto the wire so the receiving data node records a non-empty `remote_node`/`remote_role`/`remote_tier` on its `banyandb_queue_sub_total_finished` series. The lifecycle's `parseGroup` resolves the lifecycle's self identity by matching the lifecycle pod's hostname (POD_NAME via the K8s downward API, falling back to `os.Hostname()` — same precedence as `nativeNodeContext` at `banyand/backup/lifecycle/service.go`) against the data-n [...]
diff --git a/banyand/internal/benchmark/tracebaseline/html_test.go b/banyand/internal/benchmark/tracebaseline/html_test.go
index 18d2ed6d7..cc0a1f19d 100644
--- a/banyand/internal/benchmark/tracebaseline/html_test.go
+++ b/banyand/internal/benchmark/tracebaseline/html_test.go
@@ -52,7 +52,7 @@ func TestRenderHTMLUsesDiagramsAsPrimaryReportSurface(t *testing.T) {
 	require.Contains(t, html, "disabledEnabledAlternating")
 	require.Contains(t, html, "SAME TEST BOUNDARY")
 	require.Contains(t, html, "CORRECT OUTPUT")
-	require.Contains(t, html, "MATURE MERGE ROUNDS")
+	require.Contains(t, html, "CONTROLLED MATURE MERGE")
 	require.Contains(t, html, "SUSTAINABLE EXECUTION")
 	require.Contains(t, html, "production write intensity")
 	require.Contains(t, html, "Mixed selections may appear in both hot and mature counts")
diff --git a/banyand/internal/benchmark/tracebaseline/readiness.go b/banyand/internal/benchmark/tracebaseline/readiness.go
index 34e6a9326..3caa08556 100644
--- a/banyand/internal/benchmark/tracebaseline/readiness.go
+++ b/banyand/internal/benchmark/tracebaseline/readiness.go
@@ -21,7 +21,6 @@ import (
 )
 
 const (
-	minimumMatureMergeRounds = 10
 	minimumSerialRepetitions = 5
 	minimumAlternatingRuns   = 10
 	minimumRunsPerVariant    = 5
@@ -37,6 +36,8 @@ const (
 	// 9.87% for the disabled mode; 10% allows for legitimate variance while
 	// still rejecting dispersion that would mask any real speedup signal.
 	maximumAlternatingWallNanosCV = 0.10
+	canonicalGOMAXPROCS           = 2
+	canonicalMemoryMax            = "4294967296"
 )
 
 // BaselineGate is one report readiness decision.
@@ -56,14 +57,15 @@ type BaselineReadiness struct {
 func EvaluateBaselineReadiness(suite SuiteReport) BaselineReadiness {
 	medianWA := serialRunMedianLogicalWriteAmplification(suite.SerialRuns)
 	sameBoundary, correctOutput, referenceEnvironment := evaluateSerialRuns(suite)
-	matureRounds, sustainable := evaluateSerialMergeLifecycle(suite.SerialRuns)
+	sustainable := evaluateSerialMergeLifecycle(suite.SerialRuns)
+	controlledMature := evaluateControlledMatureMerge(suite.DisabledEnabledAlternating)
 	logicalWAGate := evaluateLogicalWriteAmplification(suite, medianWA)
 	stability := controlledSeriesStability(suite.DisabledEnabledAlternating)
 	alternating := evaluateControlledSeries(suite.DisabledEnabledAlternating, referenceEnvironment, stability)
 	readiness := BaselineReadiness{Gates: []BaselineGate{
 		{
 			Name: "SAME TEST BOUNDARY", Passed: sameBoundary,
-			Detail: "Commit, GoVersion, Kernel, GOMAXPROCS=4, MemoryMax, PIDsMax, OneShardOnly, " +
+			Detail: "Commit, GoVersion, Kernel, GOMAXPROCS=2, MemoryMax=4 GiB, PIDsMax, OneShardOnly, " +
 				"distinct data/controller cgroups, CPUSet, Filesystem, StorageDevice, ImageDigest, " +
 				"CloneMethod, BinarySHA256, fixture and schedule SHA, and serial mode agree across five serial runs",
 		},
@@ -73,9 +75,9 @@ func EvaluateBaselineReadiness(suite SuiteReport) BaselineReadiness {
 			Detail: "Core and secondary-index ledgers reconcile with expected sampling behavior",
 		},
 		{
-			Name:   "MATURE MERGE ROUNDS",
-			Passed: matureRounds,
-			Detail: "At least ten mature merge rounds complete in every serialized run",
+			Name:   "CONTROLLED MATURE MERGE",
+			Passed: controlledMature,
+			Detail: "Every frozen controlled run selects the same all-mature production-picker input and completes both secondary-index children",
 		},
 		{
 			Name:   "SUSTAINABLE EXECUTION",
@@ -124,15 +126,27 @@ func evaluateSerialRuns(suite SuiteReport) (sameBoundary, correctOutput bool, re
 	return sameBoundary, correctOutput, referenceEnvironment
 }
 
-func evaluateSerialMergeLifecycle(runs []RunReport) (matureRounds, sustainable bool) {
-	matureRounds = len(runs) >= minimumSerialRepetitions
-	sustainable = len(runs) >= minimumSerialRepetitions
+func evaluateSerialMergeLifecycle(runs []RunReport) bool {
+	sustainable := len(runs) >= minimumSerialRepetitions
 	for runIdx := range runs {
 		run := &runs[runIdx]
-		matureRounds = matureRounds && run.MatureMerges >= minimumMatureMergeRounds
 		sustainable = sustainable && runIsSerialSustainable(run)
 	}
-	return matureRounds, sustainable
+	return sustainable
+}
+
+func evaluateControlledMatureMerge(runs []ControlledMergeRunReport) bool {
+	if len(runs) < minimumAlternatingRuns {
+		return false
+	}
+	for runIdx := range runs {
+		run := &runs[runIdx]
+		if !run.Correct || len(run.Event.InputPartIDs) < 2 || run.Event.HotInputParts != 0 ||
+			int(run.Event.MatureInputParts) != len(run.Event.InputPartIDs) || len(run.Event.Children) != 2 {
+			return false
+		}
+	}
+	return true
 }
 
 func evaluateLogicalWriteAmplification(suite SuiteReport, medianWA float64) bool {
@@ -150,7 +164,7 @@ func evaluateControlledSeries(runs []ControlledMergeRunReport, referenceEnvironm
 }
 
 func serialEnvironmentComplete(environment Environment) bool {
-	return environment.GOMAXPROCS == 4 && environment.MemoryMax == "8589934592" && environment.MemorySwapMax == "0" &&
+	return environment.GOMAXPROCS == canonicalGOMAXPROCS && environment.MemoryMax == canonicalMemoryMax && environment.MemorySwapMax == "0" &&
 		environment.PIDsMax == "512" && environment.OneShardOnly && environment.DataNodeCgroup != "" &&
 		environment.ControllerCgroup != "" && environment.DataNodeCgroup != environment.ControllerCgroup &&
 		environment.CPUSet != "" && environment.GoVersion != "" && environment.Kernel != "" && environment.Commit != "" &&
@@ -159,7 +173,7 @@ func serialEnvironmentComplete(environment Environment) bool {
 }
 
 func controlledEnvironmentComplete(environment Environment) bool {
-	return environment.GOMAXPROCS == 4 && environment.MemoryMax == "8589934592" && environment.MemorySwapMax == "0" &&
+	return environment.GOMAXPROCS == canonicalGOMAXPROCS && environment.MemoryMax == canonicalMemoryMax && environment.MemorySwapMax == "0" &&
 		environment.PIDsMax == "512" && environment.OneShardOnly && environment.DataNodeCgroup != "" && environment.CPUSet != "" &&
 		environment.GoVersion != "" && environment.Kernel != "" && environment.Commit != "" && environment.Filesystem != "" &&
 		environment.StorageDevice != "" && environment.ImageDigest != "" && environment.CloneMethod != "" && environment.BinarySHA256 != ""
diff --git a/banyand/internal/benchmark/tracebaseline/readiness_test.go b/banyand/internal/benchmark/tracebaseline/readiness_test.go
index 54ab12264..50988d1f4 100644
--- a/banyand/internal/benchmark/tracebaseline/readiness_test.go
+++ b/banyand/internal/benchmark/tracebaseline/readiness_test.go
@@ -25,17 +25,24 @@ import (
 	"github.com/apache/skywalking-banyandb/banyand/trace"
 )
 
-func TestEvaluateBaselineReadinessUsesMatureMergeRounds(t *testing.T) {
+func TestEvaluateBaselineReadinessUsesFrozenControlledMatureMerge(t *testing.T) {
 	suite := readyTestSuite()
 	readiness := EvaluateBaselineReadiness(suite)
 	require.True(t, readiness.Ready)
 	require.Len(t, readiness.Gates, 6)
-	require.True(t, gateByName(t, readiness, "MATURE MERGE ROUNDS").Passed)
+	require.True(t, gateByName(t, readiness, "CONTROLLED MATURE MERGE").Passed)
 
-	suite.SerialRuns[2].MatureMerges = minimumMatureMergeRounds - 1
+	for runIdx := range suite.SerialRuns {
+		suite.SerialRuns[runIdx].MatureMerges = 0
+	}
+	readiness = EvaluateBaselineReadiness(suite)
+	require.True(t, readiness.Ready, "serialized maturity count is diagnostic after the frozen mature seed replaces it")
+
+	suite.DisabledEnabledAlternating[2].Event.HotInputParts = 1
+	suite.DisabledEnabledAlternating[2].Event.MatureInputParts = 1
 	readiness = EvaluateBaselineReadiness(suite)
 	require.False(t, readiness.Ready)
-	require.False(t, gateByName(t, readiness, "MATURE MERGE ROUNDS").Passed)
+	require.False(t, gateByName(t, readiness, "CONTROLLED MATURE MERGE").Passed)
 }
 
 func TestEvaluateBaselineReadinessRequiresLogicalWriteAmplification(t *testing.T) {
@@ -223,7 +230,7 @@ func TestEvaluateBaselineReadinessRequiresControlledAttribution(t *testing.T) {
 
 func TestEvaluateBaselineReadinessRequiresContainerDerivedStagingLimit(t *testing.T) {
 	suite := readyTestSuite()
-	suite.DisabledEnabledAlternating[0].StagingLimits.MemoryLimit = 4 << 30
+	suite.DisabledEnabledAlternating[0].StagingLimits.MemoryLimit = 8 << 30
 
 	require.False(t, gateByName(t, readinessFixture(t, suite), "DISABLED/ENABLED SERIES STABILITY").Passed)
 }
@@ -283,13 +290,13 @@ func readyTestSuite() SuiteReport {
 	for runIdx := range runs {
 		run := RunReport{
 			RunID: fmt.Sprintf("run-%d", runIdx), Mode: ModeSerial, FixtureSHA256: fixtureHash, ScheduleSHA256: scheduleHash,
-			ExpectedRows: 100, LedgerVerified: true, Correct: true, MatureMerges: minimumMatureMergeRounds,
+			ExpectedRows: 100, LedgerVerified: true, Correct: true,
 			LogicalWriteAmplification: 1.0009,
 			Primary:                   PhaseResult{InputBytes: 100, DrainNanos: int64(100 * time.Millisecond)},
 			Environment: Environment{
 				Commit: "abc123", GoVersion: "go1.25.12", Kernel: "5.15.0",
-				GOMAXPROCS: 4, MemoryMax: "8589934592", MemorySwapMax: "0", PIDsMax: "512", OneShardOnly: true,
-				DataNodeCgroup: "/data", ControllerCgroup: "/controller", CPUSet: "0-3",
+				GOMAXPROCS: 2, MemoryMax: "4294967296", MemorySwapMax: "0", PIDsMax: "512", OneShardOnly: true,
+				DataNodeCgroup: "/data", ControllerCgroup: "/controller", CPUSet: "0-1",
 				Filesystem: "ext4", StorageDevice: "/dev/sda1", ImageDigest: "sha256:image",
 				CloneMethod: "os.CopyFS", BinarySHA256: "sha256:bin",
 			},
@@ -316,10 +323,11 @@ func readyTestSuite() SuiteReport {
 			Correct: true, PipelineMode: mode, PluginSHA256: pluginSHA256,
 			SeedSnapshotSHA256: "seed", SelectionSHA256: "selection", MatureLogicalNow: time.Unix(100, 0), Environment: runEnvironment,
 			StagingLimits: trace.BenchmarkMergeStagingLimits{
-				MemoryLimit: 8 << 30, StageBytes: 64 << 20, TraceBytes: 64 << 20, MaxTraceCount: 64 * 1024,
+				MemoryLimit: 4 << 30, StageBytes: 64 << 20, TraceBytes: 64 << 20, MaxTraceCount: 64 * 1024,
 			},
 			Event: trace.BenchmarkMergeEvent{
-				SelectionSHA256: "selection",
+				SelectionSHA256: "selection", InputPartIDs: []uint64{1, 2}, MatureInputParts: 2,
+				Children: []trace.BenchmarkMergeChild{{}, {}},
 				Resources: trace.BenchmarkMergeResources{
 					AttributionValid: true, ElapsedNanos: int64(time.Second), CPUNanos: int64(500 * time.Millisecond),
 				},
diff --git a/banyand/internal/benchmark/tracefixture/sampler.go b/banyand/internal/benchmark/tracefixture/sampler.go
index 29a16f061..0b5b33b1c 100644
--- a/banyand/internal/benchmark/tracefixture/sampler.go
+++ b/banyand/internal/benchmark/tracefixture/sampler.go
@@ -62,6 +62,32 @@ type samplerVerdict struct {
 	keep    bool
 }
 
+// SamplerBatchBuilder assembles complete logical traces for offline sampler evaluation.
+type SamplerBatchBuilder struct {
+	lookup sourceLookup
+}
+
+// NewSamplerBatchBuilder creates a complete-trace batch builder over an immutable source.
+func NewSamplerBatchBuilder(source Source) *SamplerBatchBuilder {
+	return &SamplerBatchBuilder{lookup: buildSourceLookup(source)}
+}
+
+// Build assembles instances in input order and materializes only the requested projection.
+func (builder *SamplerBatchBuilder) Build(ctx context.Context, instances []Instance, projection sdk.Projection) (sdk.TraceBatch, error) {
+	batch := sdk.TraceBatch{Traces: make([]sdk.TraceBlock, 0, len(instances))}
+	for instanceIdx := range instances {
+		if contextErr := ctx.Err(); contextErr != nil {
+			return sdk.TraceBatch{}, fmt.Errorf("sampler batch build canceled: %w", contextErr)
+		}
+		block, blockErr := buildSamplerBlock(instances[instanceIdx], builder.lookup, projection)
+		if blockErr != nil {
+			return sdk.TraceBatch{}, fmt.Errorf("cannot build sampler trace %d (%q): %w", instanceIdx, instances[instanceIdx].GeneratedID, blockErr)
+		}
+		batch.Traces = append(batch.Traces, block)
+	}
+	return batch, nil
+}
+
 // EvaluateSampler runs a sampler over complete generated logical traces and enforces the production ratio gate.
 func EvaluateSampler(ctx context.Context, source Source, plan Plan, sampler sdk.Sampler, pluginPath string,
 	config []byte,
@@ -69,7 +95,8 @@ func EvaluateSampler(ctx context.Context, source Source, plan Plan, sampler sdk.
 	if sampler == nil {
 		return SamplerArtifact{}, fmt.Errorf("sampler is required")
 	}
-	lookup := buildSourceLookup(source)
+	builder := NewSamplerBatchBuilder(source)
+	lookup := builder.lookup
 	projection := sampler.Project()
 	verdicts := make([]samplerVerdict, 0, len(plan.Instances))
 	for batchStart := 0; batchStart < len(plan.Instances); batchStart += samplerBatchSize {
@@ -77,13 +104,9 @@ func EvaluateSampler(ctx context.Context, source Source, plan Plan, sampler sdk.
 			return SamplerArtifact{}, fmt.Errorf("sampler evaluation canceled: %w", contextErr)
 		}
 		batchEnd := min(batchStart+samplerBatchSize, len(plan.Instances))
-		batch := sdk.TraceBatch{Traces: make([]sdk.TraceBlock, 0, batchEnd-batchStart)}
-		for instanceIdx := batchStart; instanceIdx < batchEnd; instanceIdx++ {
-			block, blockErr := buildSamplerBlock(plan.Instances[instanceIdx], lookup, projection)
-			if blockErr != nil {
-				return SamplerArtifact{}, blockErr
-			}
-			batch.Traces = append(batch.Traces, block)
+		batch, buildErr := builder.Build(ctx, plan.Instances[batchStart:batchEnd], projection)
+		if buildErr != nil {
+			return SamplerArtifact{}, fmt.Errorf("cannot build sampler batch starting at trace %d: %w", batchStart, buildErr)
 		}
 		verdict, decideErr := sampler.Decide(&batch)
 		if decideErr != nil {
diff --git a/banyand/internal/benchmark/tracefixture/sampler_seed_bench_test.go b/banyand/internal/benchmark/tracefixture/sampler_seed_bench_test.go
new file mode 100644
index 000000000..205ca0158
--- /dev/null
+++ b/banyand/internal/benchmark/tracefixture/sampler_seed_bench_test.go
@@ -0,0 +1,404 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership. The ASF licenses this
+// file to you under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+
+package tracefixture
+
+import (
+	"context"
+	"crypto/sha256"
+	"encoding/hex"
+	"encoding/json"
+	"fmt"
+	"hash"
+	"os"
+	"sort"
+	"strings"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+
+	dumptrace "github.com/apache/skywalking-banyandb/banyand/internal/dump/trace"
+	"github.com/apache/skywalking-banyandb/pkg/pipeline/sdk"
+	"github.com/apache/skywalking-banyandb/pkg/pipeline/sdk/sdktest"
+)
+
+const (
+	seedSourceEnv   = "TRACE_SAMPLER_BENCH_SOURCE"
+	seedCatalogEnv  = "TRACE_SAMPLER_BENCH_CATALOG"
+	seedScheduleEnv = "TRACE_SAMPLER_BENCH_SCHEDULE"
+	seedExpectedEnv = "TRACE_SAMPLER_BENCH_EXPECTED"
+	seedPluginEnv   = "TRACE_SAMPLER_BENCH_PLUGIN"
+)
+
+type seedSamplerInputs struct {
+	plugin   string
+	plan     Plan
+	source   Source
+	expected SamplerArtifact
+}
+
+type seedSamplerCase struct {
+	name      string
+	config    []byte
+	batchSize int
+}
+
+type seedTestSampler struct {
+	decide     func(*sdk.TraceBatch) (sdk.Verdict, error)
+	projection sdk.Projection
+}
+
+func (sampler *seedTestSampler) Kind() sdk.Kind          { return sdk.KindSampler }
+func (sampler *seedTestSampler) Project() sdk.Projection { return sampler.projection }
+func (sampler *seedTestSampler) Close() error            { return nil }
+func (sampler *seedTestSampler) Decide(batch *sdk.TraceBatch) (sdk.Verdict, error) {
+	return sampler.decide(batch)
+}
+
+func loadSeedSamplerInputs() (seedSamplerInputs, error) {
+	sourcePath := os.Getenv(seedSourceEnv)
+	catalogPath := os.Getenv(seedCatalogEnv)
+	schedulePath := os.Getenv(seedScheduleEnv)
+	expectedPath := os.Getenv(seedExpectedEnv)
+	pluginPath := os.Getenv(seedPluginEnv)
+	if sourcePath == "" || catalogPath == "" || schedulePath == "" || expectedPath == "" || pluginPath == "" {
+		return seedSamplerInputs{}, fmt.Errorf("set %s, %s, %s, %s, and %s", seedSourceEnv, seedCatalogEnv, seedScheduleEnv, seedExpectedEnv, seedPluginEnv)
+	}
+	source, sourceErr := LoadSource(context.Background(), LoadOptions{
+		SourcePath: sourcePath, CatalogPath: catalogPath, Format: dumptrace.PartFormatLegacy,
+	})
+	if sourceErr != nil {
+		return seedSamplerInputs{}, sourceErr
+	}
+	var plan Plan
+	if readErr := readJSONFile(schedulePath, &plan); readErr != nil {
+		return seedSamplerInputs{}, readErr
+	}
+	var expected SamplerArtifact
+	if readErr := readJSONFile(expectedPath, &expected); readErr != nil {
+		return seedSamplerInputs{}, readErr
+	}
+	return seedSamplerInputs{source: source, plan: plan, expected: expected, plugin: pluginPath}, nil
+}
+
+func readJSONFile(path string, target any) error {
+	data, readErr := os.ReadFile(path)
+	if readErr != nil {
+		return fmt.Errorf("cannot read %q: %w", path, readErr)
+	}
+	if decodeErr := json.Unmarshal(data, target); decodeErr != nil {
+		return fmt.Errorf("cannot decode %q: %w", path, decodeErr)
+	}
+	return nil
+}
+
+func buildSeedBatches(ctx context.Context, builder *SamplerBatchBuilder, instances []Instance, projection sdk.Projection,
+	batchSize int,
+) ([]sdk.TraceBatch, error) {
+	if batchSize <= 0 {
+		return nil, fmt.Errorf("batch size must be positive")
+	}
+	batches := make([]sdk.TraceBatch, 0, (len(instances)+batchSize-1)/batchSize)
+	for batchStart := 0; batchStart < len(instances); batchStart += batchSize {
+		batchEnd := min(batchStart+batchSize, len(instances))
+		batch, buildErr := builder.Build(ctx, instances[batchStart:batchEnd], projection)
+		if buildErr != nil {
+			return nil, buildErr
+		}
+		batches = append(batches, batch)
+	}
+	return batches, nil
+}
+
+func decideSeedBatches(sampler sdk.Sampler, batches []sdk.TraceBatch) ([]samplerVerdict, error) {
+	verdicts := make([]samplerVerdict, 0)
+	for batchIdx := range batches {
+		verdict, decideErr := decideSeedBatch(sampler, &batches[batchIdx], batchIdx)
+		if decideErr != nil {
+			return nil, decideErr
+		}
+		for traceIdx := range verdict.Keep {
+			verdicts = append(verdicts, samplerVerdict{traceID: batches[batchIdx].Traces[traceIdx].TraceID, keep: verdict.Keep[traceIdx]})
+		}
+	}
+	return verdicts, nil
+}
+
+func decideSeedBatch(sampler sdk.Sampler, batch *sdk.TraceBatch, batchIdx int) (sdk.Verdict, error) {
+	verdict, decideErr := sampler.Decide(batch)
+	if decideErr != nil {
+		return sdk.Verdict{}, decideErr
+	}
+	if len(verdict.Keep) != len(batch.Traces) {
+		return sdk.Verdict{}, fmt.Errorf("batch %d returned %d verdicts for %d traces", batchIdx, len(verdict.Keep), len(batch.Traces))
+	}
+	return verdict, nil
+}
+
+func seedVerdictDigest(verdicts []samplerVerdict) string {
+	ordered := append([]samplerVerdict(nil), verdicts...)
+	sort.Slice(ordered, func(leftIdx, rightIdx int) bool { return ordered[leftIdx].traceID < ordered[rightIdx].traceID })
+	digest := sha256.New()
+	for verdictIdx := range ordered {
+		mustWriteHashString(digest, fmt.Sprintf("%s\t%t\n", ordered[verdictIdx].traceID, ordered[verdictIdx].keep))
+	}
+	return hex.EncodeToString(digest.Sum(nil))
+}
+
+func seedBatchDigest(batches []sdk.TraceBatch) string {
+	digest := sha256.New()
+	for batchIdx := range batches {
+		for traceIdx := range batches[batchIdx].Traces {
+			traceBlock := &batches[batchIdx].Traces[traceIdx]
+			writeSeedDigestField(digest, []byte(traceBlock.TraceID))
+			for columnIdx := range traceBlock.Tags {
+				column := &traceBlock.Tags[columnIdx]
+				writeSeedDigestField(digest, []byte(column.Name))
+				for _, value := range column.Values {
+					writeSeedDigestField(digest, value)
+				}
+			}
+			for _, spanID := range traceBlock.SpanIDs {
+				writeSeedDigestField(digest, []byte(spanID))
+			}
+			for _, span := range traceBlock.Spans {
+				writeSeedDigestField(digest, span)
+			}
+		}
+	}
+	return hex.EncodeToString(digest.Sum(nil))
+}
+
+func writeSeedDigestField(digest hash.Hash, value []byte) {
+	mustWriteHashString(digest, fmt.Sprintf("%d:", len(value)))
+	_, _ = digest.Write(value)
+}
+
+func preflightSeedSampler(sampler sdk.Sampler, batches []sdk.TraceBatch) ([]samplerVerdict, error) {
+	beforeDigest := seedBatchDigest(batches)
+	first, firstErr := decideSeedBatches(sampler, batches)
+	if firstErr != nil {
+		return nil, firstErr
+	}
+	second, secondErr := decideSeedBatches(sampler, batches)
+	if secondErr != nil {
+		return nil, secondErr
+	}
+	if seedVerdictDigest(first) != seedVerdictDigest(second) {
+		return nil, fmt.Errorf("sampler verdict changed across identical decisions")
+	}
+	if afterDigest := seedBatchDigest(batches); afterDigest != beforeDigest {
+		return nil, fmt.Errorf("sampler mutated its read-only input: got %s, want %s", afterDigest, beforeDigest)
+	}
+	return first, nil
+}
+
+func benchmarkSeedDecisions(sampler sdk.Sampler, batches []sdk.TraceBatch) (uint64, error) {
+	var kept uint64
+	for batchIdx := range batches {
+		verdict, decideErr := decideSeedBatch(sampler, &batches[batchIdx], batchIdx)
+		if decideErr != nil {
+			return 0, decideErr
+		}
+		for _, keep := range verdict.Keep {
+			if keep {
+				kept++
+			}
+		}
+	}
+	return kept, nil
+}
+
+var (
+	seedBenchmarkKeepSink    uint64
+	seedBenchmarkPayloadSink uint64
+)
+
+func benchmarkSeedSamplerCase(b *testing.B, sampler sdk.Sampler, builder *SamplerBatchBuilder, instances []Instance, batchSize int,
+	expectedDigest string,
+) {
+	b.Helper()
+	batches, buildErr := buildSeedBatches(context.Background(), builder, instances, sampler.Project(), batchSize)
+	if buildErr != nil {
+		b.Fatalf("build batches: %v", buildErr)
+	}
+	preflight, preflightErr := preflightSeedSampler(sampler, batches)
+	if preflightErr != nil {
+		b.Fatalf("preflight: %v", preflightErr)
+	}
+	if expectedDigest != "" && seedVerdictDigest(preflight) != expectedDigest {
+		b.Fatalf("verdict drift: got %s, want %s", seedVerdictDigest(preflight), expectedDigest)
+	}
+	b.ReportAllocs()
+	b.ResetTimer()
+	for iteration := 0; iteration < b.N; iteration++ {
+		kept, decideErr := benchmarkSeedDecisions(sampler, batches)
+		if decideErr != nil {
+			b.Fatal(decideErr)
+		}
+		seedBenchmarkKeepSink = kept
+	}
+	b.StopTimer()
+	traceOperations := float64(b.N * len(instances))
+	b.ReportMetric(float64(b.Elapsed().Nanoseconds())/traceOperations, "ns/trace")
+	b.ReportMetric(float64(len(instances)), "traces/op")
+}
+
+func TestSeedSamplerArtifact(t *testing.T) {
+	inputs, inputErr := loadSeedSamplerInputs()
+	if inputErr != nil {
+		t.Skipf("real mature seed is opt-in: %v", inputErr)
+	}
+	sampler, loadErr := sdktest.LoadSO(inputs.plugin, "NewSampler", DefaultSkyWalkingSamplerConfig)
+	if loadErr != nil {
+		t.Fatalf("load sampler: %v", loadErr)
+	}
+	defer func() { _ = sampler.Close() }()
+	artifact, evaluateErr := EvaluateSampler(context.Background(), inputs.source, inputs.plan, sampler, inputs.plugin,
+		DefaultSkyWalkingSamplerConfig)
+	if evaluateErr != nil {
+		t.Fatalf("evaluate sampler: %v", evaluateErr)
+	}
+	if artifact.Evaluated != inputs.expected.Evaluated || artifact.Dropped != inputs.expected.Dropped ||
+		artifact.VerdictSHA256 != inputs.expected.VerdictSHA256 || artifact.DeletionRatio != inputs.expected.DeletionRatio {
+		t.Fatalf("seed verdict drift: got %+v, expected evaluated=%d dropped=%d ratio=%f verdict=%s", artifact,
+			inputs.expected.Evaluated, inputs.expected.Dropped, inputs.expected.DeletionRatio, inputs.expected.VerdictSHA256)
+	}
+}
+
+func TestSeedBatchPartitionAndPreflight(t *testing.T) {
+	source := Source{Mature: []LoadedTrace{{
+		SourceID: "source", Fragments: []LoadedFragment{{Fragment: Fragment{MinTimestamp: 1, MaxTimestamp: 2}, Rows: []Row{{}}}},
+	}}}
+	instances := make([]Instance, 5)
+	for instanceIdx := range instances {
+		instances[instanceIdx] = Instance{SourceID: "source", GeneratedID: fmt.Sprintf("trace-%d", instanceIdx)}
+	}
+	batches, buildErr := buildSeedBatches(context.Background(), NewSamplerBatchBuilder(source), instances, sdk.Projection{}, 2)
+	if buildErr != nil {
+		t.Fatal(buildErr)
+	}
+	if len(batches) != 3 || len(batches[0].Traces) != 2 || len(batches[1].Traces) != 2 || len(batches[2].Traces) != 1 {
+		t.Fatalf("unexpected partition: %#v", batches)
+	}
+	var flattened []string
+	for batchIdx := range batches {
+		for traceIdx := range batches[batchIdx].Traces {
+			flattened = append(flattened, batches[batchIdx].Traces[traceIdx].TraceID)
+		}
+	}
+	require.Equal(t, []string{"trace-0", "trace-1", "trace-2", "trace-3", "trace-4"}, flattened)
+	keepsAll := &seedTestSampler{decide: func(batch *sdk.TraceBatch) (sdk.Verdict, error) {
+		keep := make([]bool, len(batch.Traces))
+		for traceIdx := range keep {
+			keep[traceIdx] = true
+		}
+		return sdk.Verdict{Keep: keep}, nil
+	}}
+	verdicts, preflightErr := preflightSeedSampler(keepsAll, batches)
+	if preflightErr != nil || len(verdicts) != len(instances) {
+		t.Fatalf("preflight failed: verdicts=%d err=%v", len(verdicts), preflightErr)
+	}
+
+	wrongSize := &seedTestSampler{decide: func(*sdk.TraceBatch) (sdk.Verdict, error) { return sdk.Verdict{}, nil }}
+	if _, wrongSizeErr := preflightSeedSampler(wrongSize, batches); wrongSizeErr == nil {
+		t.Fatal("preflight accepted a malformed verdict length")
+	}
+	mutated := false
+	mutating := &seedTestSampler{decide: func(batch *sdk.TraceBatch) (sdk.Verdict, error) {
+		if !mutated {
+			batch.Traces[0].TraceID = "mutated"
+			mutated = true
+		}
+		return sdk.Verdict{Keep: make([]bool, len(batch.Traces))}, nil
+	}}
+	if _, mutationErr := preflightSeedSampler(mutating, batches); mutationErr == nil {
+		t.Fatal("preflight accepted input mutation")
+	}
+}
+
+func BenchmarkSeedSampler(b *testing.B) {
+	inputs, inputErr := loadSeedSamplerInputs()
+	if inputErr != nil {
+		b.Skipf("real mature seed is opt-in: %v", inputErr)
+	}
+	cases := []seedSamplerCase{
+		{name: "duration", config: []byte(`{"durationThresholdMs":500}`), batchSize: 512},
+		{name: "error", config: []byte(`{"keepErrors":true}`), batchSize: 512},
+		{name: "hash", config: []byte(`{"healthySampleRate":"0.1"}`), batchSize: 512},
+		{name: "tag-equals", config: []byte(`{"keepTagRules":[{"tagKey":"db.type","equals":"PostgreSQL"}]}`), batchSize: 512},
+		{name: "tag-regex", config: []byte(`{"keepTagRules":[{"tagKey":"db.type","regex":"Postgre.*"}]}`), batchSize: 512},
+		{name: "status-regex", config: []byte(`{"keepTagRules":[{"tagKey":"http.status_code","regex":"5\\d{2}"}]}`), batchSize: 512},
+		{name: "default", config: DefaultSkyWalkingSamplerConfig, batchSize: 512},
+	}
+	for _, batchSize := range []int{1, 16, 64, 256, 512, 4096, 8192, 16384} {
+		cases = append(cases,
+			seedSamplerCase{name: fmt.Sprintf("default-batch-%d", batchSize), config: DefaultSkyWalkingSamplerConfig, batchSize: batchSize},
+			seedSamplerCase{name: fmt.Sprintf("verdict-batch-%d", batchSize), config: []byte(`{"healthySampleRate":0}`), batchSize: batchSize},
+		)
+	}
+	builder := NewSamplerBatchBuilder(inputs.source)
+	for caseIdx := range cases {
+		benchmarkCase := cases[caseIdx]
+		b.Run(benchmarkCase.name, func(b *testing.B) {
+			sampler, loadErr := sdktest.LoadSO(inputs.plugin, "NewSampler", benchmarkCase.config)
+			if loadErr != nil {
+				b.Fatalf("load sampler: %v", loadErr)
+			}
+			b.Cleanup(func() { _ = sampler.Close() })
+			expectedDigest := ""
+			if strings.HasPrefix(benchmarkCase.name, "default") {
+				expectedDigest = inputs.expected.VerdictSHA256
+			}
+			benchmarkSeedSamplerCase(b, sampler, builder, inputs.plan.Instances, benchmarkCase.batchSize, expectedDigest)
+		})
+	}
+	projectionCases := []struct {
+		consume    func(*sdk.TraceBlock) uint64
+		name       string
+		projection sdk.Projection
+	}{
+		{name: "span-bodies", projection: sdk.Projection{Spans: true}, consume: func(trace *sdk.TraceBlock) uint64 {
+			var bytesRead uint64
+			for _, span := range trace.Spans {
+				bytesRead += uint64(len(span))
+			}
+			return bytesRead
+		}},
+		{name: "span-ids", projection: sdk.Projection{SpanIDs: true}, consume: func(trace *sdk.TraceBlock) uint64 {
+			var bytesRead uint64
+			for _, spanID := range trace.SpanIDs {
+				bytesRead += uint64(len(spanID))
+			}
+			return bytesRead
+		}},
+	}
+	for caseIdx := range projectionCases {
+		projectionCase := projectionCases[caseIdx]
+		b.Run(projectionCase.name, func(b *testing.B) {
+			sampler := &seedTestSampler{projection: projectionCase.projection, decide: func(batch *sdk.TraceBatch) (sdk.Verdict, error) {
+				keep := make([]bool, len(batch.Traces))
+				var payloadBytes uint64
+				for traceIdx := range batch.Traces {
+					keep[traceIdx] = true
+					payloadBytes += projectionCase.consume(&batch.Traces[traceIdx])
+				}
+				seedBenchmarkPayloadSink = payloadBytes
+				return sdk.Verdict{Keep: keep}, nil
+			}}
+			benchmarkSeedSamplerCase(b, sampler, builder, inputs.plan.Instances, 512, "")
+		})
+	}
+}
diff --git a/banyand/internal/benchmark/tracefixture/sampler_test.go b/banyand/internal/benchmark/tracefixture/sampler_test.go
index aefd328b7..91a41e532 100644
--- a/banyand/internal/benchmark/tracefixture/sampler_test.go
+++ b/banyand/internal/benchmark/tracefixture/sampler_test.go
@@ -16,6 +16,7 @@
 package tracefixture
 
 import (
+	"context"
 	"fmt"
 	"testing"
 
@@ -63,6 +64,38 @@ func TestBuildSamplerBlockUsesCompleteTrace(t *testing.T) {
 	require.Equal(t, [][]byte{{1}, {2}}, block.Tags[0].Values)
 }
 
+func TestSamplerBatchBuilderBuildsCompleteProjectedTraces(t *testing.T) {
+	source := Source{Mature: []LoadedTrace{{
+		SourceID: "source",
+		Fragments: []LoadedFragment{
+			{Fragment: Fragment{MinTimestamp: 10, MaxTimestamp: 20}, Rows: []Row{{
+				SpanID: "one", Span: []byte("span-one"), Tags: map[string][]byte{"latency": {1}},
+				TagTypes: map[string]pbv1.ValueType{"latency": pbv1.ValueTypeInt64},
+			}}},
+			{Fragment: Fragment{MinTimestamp: 30, MaxTimestamp: 40}, Rows: []Row{{
+				SpanID: "two", Span: []byte("span-two"), Tags: map[string][]byte{}, TagTypes: map[string]pbv1.ValueType{},
+			}}},
+		},
+	}}}
+	builder := NewSamplerBatchBuilder(source)
+	batch, buildErr := builder.Build(context.Background(), []Instance{
+		{SourceID: "source", GeneratedID: "generated-a"},
+		{SourceID: "source", GeneratedID: "generated-b"},
+	}, sdk.Projection{Tags: []string{"latency"}, SpanIDs: true, Spans: true})
+	require.NoError(t, buildErr)
+	require.Equal(t, []string{"generated-a", "generated-b"}, []string{batch.Traces[0].TraceID, batch.Traces[1].TraceID})
+	require.Equal(t, [][]byte{{1}, nil}, batch.Traces[0].Tags[0].Values)
+	require.Equal(t, []string{"one", "two"}, batch.Traces[0].SpanIDs)
+	require.Equal(t, [][]byte{[]byte("span-one"), []byte("span-two")}, batch.Traces[0].Spans)
+
+	_, missingErr := builder.Build(context.Background(), []Instance{{SourceID: "missing", GeneratedID: "generated"}}, sdk.Projection{})
+	require.ErrorContains(t, missingErr, `source trace "missing" is missing`)
+	canceledCtx, cancel := context.WithCancel(context.Background())
+	cancel()
+	_, canceledErr := builder.Build(canceledCtx, []Instance{{SourceID: "source", GeneratedID: "generated"}}, sdk.Projection{})
+	require.ErrorIs(t, canceledErr, context.Canceled)
+}
+
 func TestValidateDefaultSamplerVerdict(t *testing.T) {
 	require.NoError(t, validateDefaultSamplerVerdict(samplerVerdict{traceID: "slow", reason: "duration", keep: true}))
 	require.ErrorContains(t, validateDefaultSamplerVerdict(samplerVerdict{traceID: "slow", reason: "duration"}), "dropped sure-keep")
diff --git a/banyand/internal/sidx/block_writer.go b/banyand/internal/sidx/block_writer.go
index 607844eea..9ae8b62e1 100644
--- a/banyand/internal/sidx/block_writer.go
+++ b/banyand/internal/sidx/block_writer.go
@@ -63,6 +63,7 @@ func (w *writer) MustWrite(data []byte) {
 // MustClose closes the sequential writer.
 func (w *writer) MustClose() {
 	fs.MustClose(w.sw)
+	fs.MustClose(w.w)
 	w.reset()
 }
 
diff --git a/banyand/trace/benchmark_merge_receiver_test.go b/banyand/trace/benchmark_merge_receiver_test.go
index 814506371..19e1806ff 100644
--- a/banyand/trace/benchmark_merge_receiver_test.go
+++ b/banyand/trace/benchmark_merge_receiver_test.go
@@ -202,6 +202,7 @@ func TestBenchmarkMergeReceiverRunsExactlyOneMatureProductionSelection(t *testin
 	require.Zero(t, event.HotInputParts)
 	require.Equal(t, event.InputRows, event.MatureInputRows)
 	require.Len(t, event.Children, 2)
+	require.Greater(t, event.CoreElapsedNanos, int64(0), "core filtering time must be reported separately from SIDX children")
 
 	report, reportErr := receiver.MergeRecordingReport()
 	require.NoError(t, reportErr)
diff --git a/banyand/trace/block_writer.go b/banyand/trace/block_writer.go
index c14ec5d1e..179d15deb 100644
--- a/banyand/trace/block_writer.go
+++ b/banyand/trace/block_writer.go
@@ -55,6 +55,7 @@ func (w *writer) MustWrite(data []byte) {
 
 func (w *writer) MustClose() {
 	fs.MustClose(w.sw)
+	fs.MustClose(w.w)
 	w.reset()
 }
 
diff --git a/banyand/trace/drop_set.go b/banyand/trace/drop_set.go
new file mode 100644
index 000000000..be983b6a3
--- /dev/null
+++ b/banyand/trace/drop_set.go
@@ -0,0 +1,290 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership. The ASF licenses this
+// file to you under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+
+package trace
+
+import (
+	"bytes"
+	"unsafe"
+
+	"github.com/apache/skywalking-banyandb/pkg/convert"
+	pkgpool "github.com/apache/skywalking-banyandb/pkg/pool"
+)
+
+const maxPooledDroppedTraceIDBytes = 4 << 20
+
+type droppedTraceIDs struct {
+	ids   []string
+	slots []uint64
+}
+
+var droppedTraceIDPool = pkgpool.RegisterBounded("trace-dropped-ids", maxPooledDroppedTraceIDBytes, func() *droppedTraceIDs {
+	return &droppedTraceIDs{}
+}, func(dropped *droppedTraceIDs) int64 {
+	return int64(cap(dropped.ids))*int64(unsafe.Sizeof("")) + int64(cap(dropped.slots))*int64(unsafe.Sizeof(uint64(0)))
+})
+
+func acquireDroppedTraceIDs() *droppedTraceIDs {
+	return droppedTraceIDPool.Get()
+}
+
+func recordDroppedTraceID(droppedSet **droppedTraceIDs, traceID string) {
+	if *droppedSet == nil {
+		*droppedSet = acquireDroppedTraceIDs()
+	}
+	(*droppedSet).add(traceID)
+}
+
+func releaseDroppedTraceIDs(dropped *droppedTraceIDs) {
+	if dropped == nil {
+		return
+	}
+	clear(dropped.ids)
+	clear(dropped.slots)
+	dropped.ids = dropped.ids[:0]
+	dropped.slots = dropped.slots[:0]
+	droppedTraceIDPool.Put(dropped)
+}
+
+func (dropped *droppedTraceIDs) len() int {
+	if dropped == nil {
+		return 0
+	}
+	return len(dropped.ids)
+}
+
+func (dropped *droppedTraceIDs) add(traceID string) {
+	if len(dropped.slots) > 0 {
+		panic("cannot add a dropped trace ID after building the lookup index")
+	}
+	if len(dropped.ids) > 0 {
+		lastTraceID := dropped.ids[len(dropped.ids)-1]
+		if traceID == lastTraceID {
+			return
+		}
+		if traceID < lastTraceID {
+			panic("dropped trace IDs must be added in ascending order")
+		}
+	}
+	dropped.ids = append(dropped.ids, traceID)
+}
+
+func (dropped *droppedTraceIDs) keepEncoded(data []byte) bool {
+	if len(data) == 0 || idFormat(data[0]) != idFormatV1 || dropped == nil || len(dropped.ids) == 0 {
+		return true
+	}
+	dropped.buildIndex()
+	traceID := data[1:]
+	mask := uint64(len(dropped.slots) - 1)
+	traceHash := convert.Hash(traceID)
+	slotIdx := traceHash & mask
+	for {
+		stored := dropped.slots[slotIdx]
+		if stored == 0 {
+			return true
+		}
+		storedIdx := uint32(stored)
+		if uint32(stored>>32) == uint32(traceHash>>32) && bytes.Equal(convert.StringToBytes(dropped.ids[storedIdx-1]), traceID) {
+			return false
+		}
+		slotIdx = (slotIdx + 1) & mask
+	}
+}
+
+func (dropped *droppedTraceIDs) buildIndex() {
+	if len(dropped.slots) > 0 {
+		return
+	}
+	slotCount := indexSlotCount(len(dropped.ids))
+	if cap(dropped.slots) < slotCount {
+		dropped.slots = make([]uint64, slotCount)
+	} else {
+		dropped.slots = dropped.slots[:slotCount]
+		clear(dropped.slots)
+	}
+	mask := uint64(slotCount - 1)
+	for traceIdx, traceID := range dropped.ids {
+		traceHash := convert.HashStr(traceID)
+		slotIdx := traceHash & mask
+		for dropped.slots[slotIdx] != 0 {
+			slotIdx = (slotIdx + 1) & mask
+		}
+		dropped.slots[slotIdx] = uint64(uint32(traceHash>>32))<<32 | uint64(uint32(traceIdx+1))
+	}
+}
+
+// indexSlotCount returns the slot count buildIndex allocates for n entries:
+// the smallest power of two at or above max(2, 2n).
+func indexSlotCount(n int) int {
+	slotCount := 2
+	for slotCount < n*2 {
+		slotCount *= 2
+	}
+	return slotCount
+}
+
+const (
+	// dropSetEntryHeaderBytes prices one entry's string header (16 bytes) plus the
+	// append-growth slack the ID vector carries (25%).
+	dropSetEntryHeaderBytes = 20
+	// dropSetEntrySlotBytes prices one entry's worst-case index-slot share: four
+	// slots of eight bytes, since indexSlotCount rounds 2N up to a power of two and
+	// so can leave up to 4N slots live for N entries.
+	dropSetEntrySlotBytes = 32
+	// allocClassGranularity and allocClassGranularityAbove are the size-class
+	// strides Go's allocator uses below and above allocClassLargeThreshold.
+	allocClassGranularity      = 16
+	allocClassGranularityAbove = 32
+	allocClassLargeThreshold   = 256
+)
+
+// allocClassBytes returns an upper bound on the heap bytes the allocator commits
+// for an n-byte allocation. Go's small size classes are multiples of 16 up to 256
+// bytes and of 32 above, so rounding up to that stride is at or above the real
+// class for every length a trace ID occupies. It is an upper bound rather than
+// the exact class because a ceiling must never under-count residency.
+func allocClassBytes(n int) int64 {
+	stride := allocClassGranularity
+	if n > allocClassLargeThreshold {
+		stride = allocClassGranularityAbove
+	}
+	return int64((n + stride - 1) / stride * stride)
+}
+
+// dropSetBytesPerEntry prices one dropped trace ID of idLen bytes: its header and
+// append slack, its size-classed body, and its worst-case index-slot share. A
+// 42-byte service-prefixed ID — spec section 1.1's measured case — prices at
+// exactly 100 bytes, so deriving this from a real length generalizes the previous
+// fixed constant instead of re-tuning it.
+func dropSetBytesPerEntry(idLen int) int64 {
+	return dropSetEntryHeaderBytes + allocClassBytes(idLen) + dropSetEntrySlotBytes
+}
+
+// dropTracker bounds one merge's droppedTraceIDs residency. The ceiling
+// applies to the sampling decision, never to the pruning predicate (spec
+// section 3.1): once full, every subsequent proposed drop is retained instead
+// of recorded, so the underlying exact set stays complete with respect to the
+// drops it actually performs.
+//
+// maxIDs is derived from the first recorded ID's length rather than from a fixed
+// bytes/entry constant, because trace-ID length is a deployment property: a
+// service-prefixed ID can be far longer than the 42 bytes spec section 1.1
+// measured, and a fixed constant would then let residency overshoot the budget
+// proportionally. ID length is uniform within a shard, so one observation prices
+// the whole merge; record re-derives anyway if a longer ID ever appears, so the
+// uniformity is self-correcting rather than assumed.
+type dropTracker struct {
+	exact        *droppedTraceIDs // never released early; lives to SIDX publication as today
+	budget       uint64           // resolved ceiling in bytes; 0 means unlimited
+	maxIDs       int              // derived on the first record; 0 means not yet derived
+	sampledIDLen int              // the ID length maxIDs was derived from
+	full         bool             // one-way within a merge
+}
+
+// canAccept reports whether one more dropped trace ID can be recorded without
+// exceeding the tracker's budget. Once it returns false, it never returns true
+// again for the lifetime of this tracker: full is one-way within a merge.
+//
+// A zero budget is unlimited. A non-zero budget whose maxIDs is not yet derived
+// admits the entry that will derive it, so the first proposed drop of a merge is
+// always recorded.
+func (dt *dropTracker) canAccept() bool {
+	if dt.full {
+		return false
+	}
+	if dt.budget == 0 {
+		return true
+	}
+	if dt.maxIDs > 0 && dt.exact.len() >= dt.maxIDs {
+		dt.full = true
+		return false
+	}
+	return true
+}
+
+// record adds a dropped trace ID to the exact set and keeps maxIDs priced
+// against the longest ID seen. Re-deriving on a longer ID can only lower maxIDs,
+// so the next canAccept may report full immediately — which is the point: the
+// ceiling tracks real residency instead of the length it first happened to see.
+func (dt *dropTracker) record(traceID string) {
+	recordDroppedTraceID(&dt.exact, traceID)
+	if dt.budget == 0 || len(traceID) <= dt.sampledIDLen {
+		return
+	}
+	dt.sampledIDLen = len(traceID)
+	dt.maxIDs = maxIDsForBudget(dt.budget, len(traceID))
+}
+
+// liveBytes returns the drop set's accumulation residency: the ID-vector
+// headers plus the ID bodies. The lookup index is deliberately excluded so
+// that liveBytes()+projectedIndexBytes() is the accumulation-phase ceiling
+// predicate without double-counting slots. For residency after buildIndex has
+// run, or for a tracker reusing a pooled set that still carries slot capacity,
+// use residentBytes.
+func (dt *dropTracker) liveBytes() int64 {
+	if dt.exact == nil {
+		return 0
+	}
+	live := int64(cap(dt.exact.ids)) * int64(unsafe.Sizeof(""))
+	for _, id := range dt.exact.ids {
+		live += allocClassBytes(len(id))
+	}
+	return live
+}
+
+// residentBytes returns every byte the drop set currently holds: liveBytes
+// plus the slot capacity, which is non-zero once buildIndex has run and can
+// also be non-zero on a freshly acquired set that carries capacity over from
+// the reuse pool. It mirrors droppedTraceIDPool's sizing function plus the ID
+// bodies that accounting omits.
+func (dt *dropTracker) residentBytes() int64 {
+	if dt.exact == nil {
+		return 0
+	}
+	return dt.liveBytes() + int64(cap(dt.exact.slots))*int64(unsafe.Sizeof(uint64(0)))
+}
+
+// projectedIndexBytes returns the slot bytes an index over n entries requires:
+// the next power of two at or above max(2, 2n) slots, eight bytes each. It
+// mirrors buildIndex's own sizing (via indexSlotCount), so it describes the
+// index's residency whether buildIndex allocates it fresh or satisfies it from
+// capacity a pooled set carried in.
+func projectedIndexBytes(n int) int64 {
+	return int64(indexSlotCount(n)) * 8
+}
+
+// maxIDsForBudget converts a byte budget and an observed trace-ID length into the
+// maximum number of dropped trace IDs a dropTracker may record before it starts
+// retaining instead. A budget of zero means unlimited: production merges resolve a
+// non-zero ceiling, but a filter constructed without one (tests, and any future
+// caller that opts out) must not be bounded, so maxIDsForBudget(0, n) is zero.
+//
+// The conversion runs once per merge (or again only if a longer ID appears), so
+// the enforcement hot path (dropTracker.canAccept) stays a single integer
+// comparison instead of a byte computation on every proposed drop. Because
+// dropSetBytesPerEntry prices an entry at or above its real residency,
+// liveBytes()+projectedIndexBytes() at the point canAccept first returns false is
+// at or below the budget it was derived from, for any ID length.
+//
+// A non-zero budget always yields a ceiling of at least one: without the clamp, a
+// budget below one entry's price would divide to zero and be read back as the
+// unlimited sentinel, so the tightest possible budget would disable the ceiling
+// instead of enforcing it.
+func maxIDsForBudget(budget uint64, idLen int) int {
+	if budget == 0 {
+		return 0
+	}
+	return max(1, int(budget/uint64(dropSetBytesPerEntry(idLen))))
+}
diff --git a/banyand/trace/drop_set_budget_test.go b/banyand/trace/drop_set_budget_test.go
new file mode 100644
index 000000000..c857f9696
--- /dev/null
+++ b/banyand/trace/drop_set_budget_test.go
@@ -0,0 +1,148 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership. The ASF licenses this
+// file to you under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+
+package trace
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+
+	"github.com/apache/skywalking-banyandb/banyand/protector"
+)
+
+// fixedLimitProtector reports a fixed, test-chosen memory limit so
+// resolveDropSetBudget's limit-derived path can be exercised without a real
+// cgroup.
+type fixedLimitProtector struct {
+	protector.Nop
+	limit uint64
+}
+
+func (p fixedLimitProtector) GetLimit() uint64 { return p.limit }
+
+// TestResolveDropSetBudget tables (limit, CPUs) across the values spec section
+// 3.4's table is built from, and asserts the exact resulting budget: the
+// zero-limit fallback, the per-CPU division, and the minimum clamp.
+func TestResolveDropSetBudget(t *testing.T) {
+	tests := []struct {
+		name   string
+		limit  uint64
+		cpus   int
+		expect uint64
+	}{
+		{name: "zero limit, 1 cpu", limit: 0, cpus: 1, expect: defaultDropSetBudget},
+		{name: "zero limit, 16 cpus", limit: 0, cpus: 16, expect: defaultDropSetBudget},
+		{name: "512MiB, 1 cpu", limit: 512 << 20, cpus: 1, expect: (512 << 20) / dropSetAggregateDivisor},
+		{name: "512MiB, 4 cpus", limit: 512 << 20, cpus: 4, expect: (512 << 20) / (dropSetAggregateDivisor * 4)},
+		{name: "512MiB, 8 cpus", limit: 512 << 20, cpus: 8, expect: (512 << 20) / (dropSetAggregateDivisor * 8)},
+		{name: "512MiB, 16 cpus", limit: 512 << 20, cpus: 16, expect: (512 << 20) / (dropSetAggregateDivisor * 16)},
+		{name: "4GiB, 1 cpu", limit: 4 << 30, cpus: 1, expect: (4 << 30) / dropSetAggregateDivisor},
+		{name: "4GiB, 4 cpus", limit: 4 << 30, cpus: 4, expect: (4 << 30) / (dropSetAggregateDivisor * 4)},
+		{name: "4GiB, 8 cpus", limit: 4 << 30, cpus: 8, expect: (4 << 30) / (dropSetAggregateDivisor * 8)},
+		{name: "4GiB, 16 cpus", limit: 4 << 30, cpus: 16, expect: (4 << 30) / (dropSetAggregateDivisor * 16)},
+		{name: "16GiB, 1 cpu", limit: 16 << 30, cpus: 1, expect: (16 << 30) / dropSetAggregateDivisor},
+		{name: "16GiB, 4 cpus", limit: 16 << 30, cpus: 4, expect: (16 << 30) / (dropSetAggregateDivisor * 4)},
+		{name: "16GiB, 8 cpus", limit: 16 << 30, cpus: 8, expect: (16 << 30) / (dropSetAggregateDivisor * 8)},
+		{name: "16GiB, 16 cpus", limit: 16 << 30, cpus: 16, expect: (16 << 30) / (dropSetAggregateDivisor * 16)},
+		// A known but tiny limit still clamps up to the minimum floor.
+		{name: "tiny limit, 16 cpus", limit: 1 << 10, cpus: 16, expect: minimumDropSetBudget},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			require.Equal(t, tt.expect, dropSetBudgetFromLimit(tt.limit, tt.cpus))
+		})
+	}
+}
+
+// TestDropSetAggregateBoundHolds asserts the aggregate invariant from spec
+// section 3.4, assuming CPUs/2+2 concurrent merges (the hot lanes plus the
+// finalize round) all simultaneously at the ceiling:
+//
+//   - budget*(CPUs/2+2) never exceeds the hard outer bound limit/8.
+//   - At CPUs>=4 it stays within the nominal bound limit/dropSetAggregateDivisor
+//     (limit/16) that the divisor is chosen for.
+//   - Below four CPUs the CPUs divisor is smaller than CPUs/2+2, so the
+//     aggregate exceeds the nominal limit/16 bound — asserted explicitly so
+//     that documented small-node overshoot doesn't look like a regression.
+func TestDropSetAggregateBoundHolds(t *testing.T) {
+	limits := []uint64{512 << 20, 4 << 30, 16 << 30}
+	cpuCounts := []int{1, 2, 4, 8, 16}
+	for _, limit := range limits {
+		for _, cpus := range cpuCounts {
+			t.Run(fmt.Sprintf("limit=%d/cpus=%d", limit, cpus), func(t *testing.T) {
+				budget := dropSetBudgetFromLimit(limit, cpus)
+				concurrentMerges := uint64(cpus/2 + 2)
+				aggregate := budget * concurrentMerges
+				outerBound := limit / 8
+				nominalBound := limit / dropSetAggregateDivisor
+				require.LessOrEqual(t, aggregate, outerBound, "the aggregate must never exceed the hard outer bound")
+				if cpus < 4 {
+					require.Greater(t, aggregate, nominalBound,
+						"cpus=%d is documented to overshoot the nominal limit/%d bound", cpus, dropSetAggregateDivisor)
+					return
+				}
+				require.LessOrEqual(t, aggregate, nominalBound)
+			})
+		}
+	}
+}
+
+// TestDropSetFloorBoundRegime pins what minimumDropSetBudget does when it binds,
+// which the limits in TestDropSetAggregateBoundHolds are all too large to reach.
+// The floor binds when limit < 16MB*CPUs. Above a plausible smallest data-node
+// limit the aggregate bound still holds; below it the floor dominates, which is
+// accepted rather than silently true.
+func TestDropSetFloorBoundRegime(t *testing.T) {
+	const plausibleSmallestLimit = 128 << 20
+	for _, tt := range []struct {
+		limit uint64
+		cpus  int
+	}{
+		{limit: 128 << 20, cpus: 8},
+		{limit: 128 << 20, cpus: 16},
+		{limit: 32 << 20, cpus: 16},
+		{limit: 16 << 20, cpus: 16},
+	} {
+		t.Run(fmt.Sprintf("limit=%d/cpus=%d", tt.limit, tt.cpus), func(t *testing.T) {
+			budget := dropSetBudgetFromLimit(tt.limit, tt.cpus)
+			require.Equal(t, uint64(minimumDropSetBudget), budget, "the floor is expected to bind at this limit and CPU count")
+			aggregate := budget * uint64(tt.cpus/2+2)
+			if tt.limit >= plausibleSmallestLimit {
+				require.LessOrEqual(t, aggregate, tt.limit/8)
+				return
+			}
+			// Documented and accepted: on an implausibly small limit the floor, not
+			// the divisor, governs, so the aggregate is a large share of the limit.
+			// The floor stays because a sub-megabyte ceiling would make sampling
+			// useless; see minimumDropSetBudget's comment.
+			require.Greater(t, aggregate, tt.limit/8)
+		})
+	}
+}
+
+// TestDropSetBudgetOverrideWins asserts the test-only override short-circuits
+// resolveDropSetBudget regardless of the protector limit.
+func TestDropSetBudgetOverrideWins(t *testing.T) {
+	testDropSetBudgetOverride = 12345
+	t.Cleanup(func() { testDropSetBudgetOverride = 0 })
+
+	opt := option{protector: fixedLimitProtector{limit: 4 << 30}}
+	require.Equal(t, uint64(12345), resolveDropSetBudget(opt))
+
+	opt = option{protector: protector.Nop{}}
+	require.Equal(t, uint64(12345), resolveDropSetBudget(opt))
+}
diff --git a/banyand/trace/drop_set_observability_test.go b/banyand/trace/drop_set_observability_test.go
new file mode 100644
index 000000000..106ae0f09
--- /dev/null
+++ b/banyand/trace/drop_set_observability_test.go
@@ -0,0 +1,238 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package trace
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/prometheus/client_golang/prometheus"
+	dto "github.com/prometheus/client_model/go"
+	"github.com/stretchr/testify/require"
+
+	"github.com/apache/skywalking-banyandb/api/common"
+	"github.com/apache/skywalking-banyandb/banyand/observability/services"
+	"github.com/apache/skywalking-banyandb/pkg/fs"
+	"github.com/apache/skywalking-banyandb/pkg/meter/prom"
+	"github.com/apache/skywalking-banyandb/pkg/test"
+)
+
+// gatherMetric returns the collected families whose name ends in suffix, so a
+// test does not have to hard-code the scope prefix the provider prepends.
+func gatherMetric(t *testing.T, reg *prometheus.Registry, suffix string) []*dto.Metric {
+	t.Helper()
+	families, gatherErr := reg.Gather()
+	require.NoError(t, gatherErr)
+	for _, family := range families {
+		if len(family.GetName()) >= len(suffix) && family.GetName()[len(family.GetName())-len(suffix):] == suffix {
+			return family.GetMetric()
+		}
+	}
+	return nil
+}
+
+// metricLabelValue returns the value of the named label on a collected metric.
+func metricLabelValue(m *dto.Metric, name string) string {
+	for _, pair := range m.GetLabel() {
+		if pair.GetName() == name {
+			return pair.GetValue()
+		}
+	}
+	return ""
+}
+
+// TestFinalizeStateGaugesReportTerminalShards asserts the scan pre-filter
+// publishes every cooled shard's finalize state, including shards it then skips.
+// A terminal shard is precisely the one an operator needs to see — it can never
+// delete another trace (spec section 5.2) — and it is also the one no later stage
+// of the scan visits, so this pre-filter is the only place it stays visible.
+func TestFinalizeStateGaugesReportTerminalShards(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	lfs := fs.NewLocalFileSystem()
+
+	cfg := finalizeConfig{floorBytes: 1, ratio: 0.1, maxRounds: 8}
+	// shard-0 is mid-life and still warrants; shard-1 has exhausted its rounds and
+	// is therefore terminal even though its Terminal flag was never written.
+	shardPaths := []string{filepath.Join(tmpPath, "shard-0"), filepath.Join(tmpPath, "shard-1")}
+	lfs.MkdirIfNotExist(shardPaths[0], 0o755)
+	lfs.MkdirIfNotExist(shardPaths[1], 0o755)
+	require.NoError(t, writeFinalizeState(lfs, shardPaths[0], finalizeState{FinalizeRounds: 2}))
+	require.NoError(t, writeFinalizeState(lfs, shardPaths[1], finalizeState{FinalizeRounds: cfg.maxRounds}))
+
+	reg := prometheus.NewRegistry()
+	factory := services.NewFactory(prom.NewProvider(pipelineScope, reg), nil, nil)
+	sr := &schemaRepo{samplerMeter: newSamplerMetrics(factory)}
+
+	require.True(t, sr.segmentMayWarrantObserved("g1", lfs, shardPaths, cfg),
+		"shard-0 still warrants, so the segment must be reopened")
+
+	rounds := gatherMetric(t, reg, "finalize_rounds")
+	require.Len(t, rounds, 2, "every shard must report, not only the warranting one")
+	byShard := map[string]float64{}
+	for _, m := range rounds {
+		byShard[metricLabelValue(m, "shard")] = m.GetGauge().GetValue()
+	}
+	require.Equal(t, float64(2), byShard["0"])
+	require.Equal(t, float64(cfg.maxRounds), byShard["1"])
+
+	terminal := gatherMetric(t, reg, "finalize_terminal")
+	require.Len(t, terminal, 2)
+	byShardTerminal := map[string]float64{}
+	for _, m := range terminal {
+		byShardTerminal[metricLabelValue(m, "shard")] = m.GetGauge().GetValue()
+	}
+	require.Equal(t, float64(0), byShardTerminal["0"])
+	require.Equal(t, float64(1), byShardTerminal["1"],
+		"a shard at max_finalize_rounds is terminal and must report as such")
+}
+
+// TestSegmentMayWarrantObservedMatchesUnobserved asserts adding telemetry did not
+// change the pre-filter's decision, which is the one thing it must not do: it is a
+// conservative superset of warrantsFinalize and skipping a warranting segment
+// would silently stop finalization.
+func TestSegmentMayWarrantObservedMatchesUnobserved(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	lfs := fs.NewLocalFileSystem()
+	cfg := finalizeConfig{floorBytes: 1, ratio: 0.1, maxRounds: 8}
+
+	for _, tt := range []struct {
+		name   string
+		states []finalizeState
+	}{
+		{name: "all-terminal", states: []finalizeState{{Terminal: true}, {FinalizeRounds: cfg.maxRounds}}},
+		{name: "one-warrants", states: []finalizeState{{Terminal: true}, {FinalizeRounds: 1}}},
+		{name: "never-finalized", states: []finalizeState{{}, {}}},
+	} {
+		t.Run(tt.name, func(t *testing.T) {
+			base := filepath.Join(tmpPath, tt.name)
+			shardPaths := make([]string, len(tt.states))
+			for idx, st := range tt.states {
+				shardPaths[idx] = filepath.Join(base, "shard-"+string(rune('0'+idx)))
+				lfs.MkdirIfNotExist(shardPaths[idx], 0o755)
+				require.NoError(t, writeFinalizeState(lfs, shardPaths[idx], st))
+			}
+			sr := &schemaRepo{samplerMeter: newSamplerMetrics(nil)}
+			require.Equal(t, segmentMayWarrant(lfs, shardPaths, cfg),
+				sr.segmentMayWarrantObserved("g1", lfs, shardPaths, cfg))
+		})
+	}
+}
+
+// newDropSetMetricsForTest builds a metrics value carrying only the drop-set
+// instruments, backed by a real Prometheus provider. The rest of the struct stays
+// zero: the helpers under test touch nothing else, and using real instruments is
+// the point — the meter panics on a label-count mismatch, which a bypass registry
+// would silently accept.
+func newDropSetMetricsForTest(reg *prometheus.Registry) *metrics {
+	factory := services.NewFactory(prom.NewProvider(tbScope, reg), nil, nil)
+	return &metrics{
+		pipelineTracesRetainedByCeiling: factory.NewCounter("pipeline_traces_retained_by_ceiling", common.ShardLabelNames()...),
+		pipelineMergesCeilingReached:    factory.NewCounter("pipeline_merges_ceiling_reached", append(common.ShardLabelNames(), "lane")...),
+		pipelineDropSetBudgetBytes:      factory.NewGauge("pipeline_drop_set_budget_bytes"),
+		pipelineDropSetEntries: factory.NewHistogram("pipeline_drop_set_entries", dropSetEntryBuckets,
+			append(common.ShardLabelNames(), "lane")...),
+	}
+}
+
+// TestDropSetInstrumentsCarryShardAndLane asserts the four drop-set instruments
+// emit with the label arity they were declared with, and that the ceiling counters
+// carry seg/shard. A wrong label count panics inside the meter, so this test is the
+// guard for that; the existing ceiling tests run with nil metrics and cannot catch
+// it.
+func TestDropSetInstrumentsCarryShardAndLane(t *testing.T) {
+	reg := prometheus.NewRegistry()
+	tst := &tsTable{
+		metrics: newDropSetMetricsForTest(reg),
+		p:       common.Position{Database: "g1", Segment: "seg-1", Shard: "3"},
+	}
+
+	tst.observeDropSetUsage(32<<20, 1234, mergeLaneFinalize)
+	tst.incPipelineTracesRetainedByCeiling(7)
+	tst.incPipelineMergesCeilingReached(mergeLaneFinalize)
+
+	budget := gatherMetric(t, reg, "pipeline_drop_set_budget_bytes")
+	require.Len(t, budget, 1)
+	require.Equal(t, float64(32<<20), budget[0].GetGauge().GetValue())
+
+	entries := gatherMetric(t, reg, "pipeline_drop_set_entries")
+	require.Len(t, entries, 1)
+	require.Equal(t, uint64(1), entries[0].GetHistogram().GetSampleCount())
+	require.Equal(t, float64(1234), entries[0].GetHistogram().GetSampleSum())
+	require.Equal(t, "3", metricLabelValue(entries[0], "shard"))
+	require.Equal(t, mergeLaneFinalize, metricLabelValue(entries[0], "lane"))
+
+	retained := gatherMetric(t, reg, "pipeline_traces_retained_by_ceiling")
+	require.Len(t, retained, 1)
+	require.Equal(t, float64(7), retained[0].GetCounter().GetValue())
+	require.Equal(t, "3", metricLabelValue(retained[0], "shard"),
+		"the ceiling counter must localize which shard is under-deleting")
+	require.Equal(t, "seg-1", metricLabelValue(retained[0], "seg"))
+
+	merges := gatherMetric(t, reg, "pipeline_merges_ceiling_reached")
+	require.Len(t, merges, 1)
+	require.Equal(t, float64(1), merges[0].GetCounter().GetValue())
+	require.Equal(t, "3", metricLabelValue(merges[0], "shard"))
+	require.Equal(t, mergeLaneFinalize, metricLabelValue(merges[0], "lane"))
+}
+
+// TestDropSetUsageObservedWhenUncapped asserts an uncapped merge still reports its
+// drop-set size. This is the whole point of the histogram: the ceiling counters are
+// a lagging indicator that only fire after deletion has been lost, so headroom has
+// to be visible on merges that did not cap.
+func TestDropSetUsageObservedWhenUncapped(t *testing.T) {
+	reg := prometheus.NewRegistry()
+	tst := &tsTable{
+		metrics: newDropSetMetricsForTest(reg),
+		p:       common.Position{Database: "g1", Segment: "seg-1", Shard: "0"},
+	}
+
+	tst.observeDropSetUsage(32<<20, 10, mergeLaneFast)
+
+	entries := gatherMetric(t, reg, "pipeline_drop_set_entries")
+	require.Len(t, entries, 1, "an uncapped merge must still report its drop-set size")
+	require.Equal(t, uint64(1), entries[0].GetHistogram().GetSampleCount())
+	require.Nil(t, gatherMetric(t, reg, "pipeline_merges_ceiling_reached"),
+		"no ceiling was reached, so the lagging counter must stay silent")
+}
+
+// TestDropSetUsageSkippedWhenUnlimited asserts a filter with no budget emits
+// nothing: a zero gauge would read as "the ceiling is zero bytes" on a dashboard
+// rather than "there is no ceiling".
+func TestDropSetUsageSkippedWhenUnlimited(t *testing.T) {
+	reg := prometheus.NewRegistry()
+	tst := &tsTable{
+		metrics: newDropSetMetricsForTest(reg),
+		p:       common.Position{Database: "g1", Segment: "seg-1", Shard: "0"},
+	}
+
+	tst.observeDropSetUsage(0, 500, mergeLaneFast)
+
+	require.Nil(t, gatherMetric(t, reg, "pipeline_drop_set_budget_bytes"))
+	require.Nil(t, gatherMetric(t, reg, "pipeline_drop_set_entries"))
+}
+
+// TestShardLabelFromPath pins the label derivation, including the fallback for an
+// unexpected directory layout: an empty label would silently merge every shard's
+// series into one.
+func TestShardLabelFromPath(t *testing.T) {
+	require.Equal(t, "0", shardLabelFromPath("/data/measure-default/seg-20240101/shard-0"))
+	require.Equal(t, "17", shardLabelFromPath("shard-17"))
+	require.Equal(t, "unexpected", shardLabelFromPath("/data/unexpected"))
+}
diff --git a/banyand/trace/drop_set_test.go b/banyand/trace/drop_set_test.go
new file mode 100644
index 000000000..bb79ada58
--- /dev/null
+++ b/banyand/trace/drop_set_test.go
@@ -0,0 +1,315 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership. The ASF licenses this
+// file to you under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+
+package trace
+
+import (
+	"fmt"
+	"sort"
+	"testing"
+
+	"github.com/stretchr/testify/require"
+
+	"github.com/apache/skywalking-banyandb/pkg/convert"
+)
+
+const dropSetBenchmarkTraceCount = 33353
+
+func TestDroppedTraceIDsKeepsEncodedValuesByExactID(t *testing.T) {
+	dropped := acquireDroppedTraceIDs()
+	t.Cleanup(func() { releaseDroppedTraceIDs(dropped) })
+
+	dropped.add("trace-a")
+	dropped.add("trace-b")
+	dropped.add("trace-b")
+	dropped.add("trace-c")
+
+	require.Equal(t, 3, dropped.len())
+	require.False(t, dropped.keepEncoded(append([]byte{byte(idFormatV1)}, []byte("trace-b")...)))
+	require.True(t, dropped.keepEncoded(append([]byte{byte(idFormatV1)}, []byte("trace")...)), "prefixes must not match")
+	require.True(t, dropped.keepEncoded(append([]byte{byte(idFormatV1)}, []byte("trace-b-tail")...)), "extensions must not match")
+	require.True(t, dropped.keepEncoded(nil), "malformed values must fail open")
+	require.True(t, dropped.keepEncoded([]byte{0xff, 't'}), "unknown encodings must fail open")
+}
+
+func BenchmarkDroppedTraceIDLookup(b *testing.B) {
+	traceIDs := make([]string, dropSetBenchmarkTraceCount)
+	encoded := make([][]byte, dropSetBenchmarkTraceCount)
+	for traceIdx := range traceIDs {
+		traceIDs[traceIdx] = fmt.Sprintf("service-a-%032x", traceIdx)
+	}
+	for traceIdx := range encoded {
+		queryIdx := traceIdx * 7919 % len(traceIDs)
+		encoded[traceIdx] = append([]byte{byte(idFormatV1)}, traceIDs[queryIdx]...)
+	}
+	for _, ratio := range []int{1, 35, 99} {
+		droppedTraceIDs := make([]string, 0, len(traceIDs)*ratio/100)
+		for traceIdx, traceID := range traceIDs {
+			if traceIdx%100 < ratio {
+				droppedTraceIDs = append(droppedTraceIDs, traceID)
+			}
+		}
+		b.Run(fmt.Sprintf("ratio-%d/compact-hash", ratio), func(b *testing.B) {
+			dropped := acquireDroppedTraceIDs()
+			for _, traceID := range droppedTraceIDs {
+				dropped.add(traceID)
+			}
+			defer releaseDroppedTraceIDs(dropped)
+			benchmarkDropSetLookup(b, encoded, dropped.keepEncoded)
+		})
+		b.Run(fmt.Sprintf("ratio-%d/sorted-slice", ratio), func(b *testing.B) {
+			dropped := droppedTraceIDs
+			benchmarkDropSetLookup(b, encoded, func(data []byte) bool {
+				traceID := convert.BytesToString(data[1:])
+				matchIdx := sort.SearchStrings(dropped, traceID)
+				return matchIdx == len(dropped) || dropped[matchIdx] != traceID
+			})
+		})
+		b.Run(fmt.Sprintf("ratio-%d/go-map", ratio), func(b *testing.B) {
+			dropped := make(map[string]struct{}, len(droppedTraceIDs))
+			for _, traceID := range droppedTraceIDs {
+				dropped[traceID] = struct{}{}
+			}
+			benchmarkDropSetLookup(b, encoded, func(data []byte) bool {
+				_, exists := dropped[string(data[1:])]
+				return !exists
+			})
+		})
+	}
+}
+
+// TestProjectedIndexBytesMatchesBuildIndex asserts projectedIndexBytes is
+// exact, not conservative, at every tested n including the power-of-two
+// boundaries where nextPow2(2n) is discontinuous.
+func TestProjectedIndexBytesMatchesBuildIndex(t *testing.T) {
+	for _, n := range []int{0, 1, 2, 3, 4, 5, 7, 8, 9, 1023, 1024, 1025, 65535, 65536, 65537} {
+		n := n
+		t.Run(fmt.Sprintf("n=%d", n), func(t *testing.T) {
+			// A fresh set, not acquireDroppedTraceIDs: on a pooled object buildIndex
+			// reuses carried capacity, so cap(slots) would exceed the projection and
+			// the allocation-exactness assertion below would depend on which tests
+			// ran first. That reuse case is covered by
+			// TestProjectedIndexBytesCoversPooledReuse.
+			dropped := &droppedTraceIDs{}
+			for traceIdx := range n {
+				dropped.add(fmt.Sprintf("service-a-%032x", traceIdx))
+			}
+			dropped.buildIndex()
+			require.Equal(t, int64(len(dropped.slots))*8, projectedIndexBytes(n))
+			require.Equal(t, int64(cap(dropped.slots))*8, projectedIndexBytes(n),
+				"on a fresh set the projection must equal exactly what buildIndex allocated")
+		})
+	}
+}
+
+// TestProjectedIndexBytesCoversPooledReuse asserts the projection still
+// describes the index's residency when buildIndex satisfies its slot count from
+// capacity a pooled set carried in and so allocates nothing. Asserting on len
+// alone would pass while the resident capacity silently exceeded it.
+func TestProjectedIndexBytesCoversPooledReuse(t *testing.T) {
+	dropped := &droppedTraceIDs{slots: make([]uint64, 0, 1<<16)}
+	for traceIdx := range 8 {
+		dropped.add(fmt.Sprintf("service-a-%032x", traceIdx))
+	}
+	carriedCap := cap(dropped.slots)
+	dropped.buildIndex()
+	require.Equal(t, carriedCap, cap(dropped.slots), "buildIndex must reuse the carried capacity")
+	require.Equal(t, int64(len(dropped.slots))*8, projectedIndexBytes(8))
+
+	// The carried capacity is resident regardless of what the index needs, so
+	// residentBytes — not the projection — is what a budget must be judged against.
+	tracker := dropTracker{exact: dropped}
+	require.Greater(t, tracker.residentBytes(), tracker.liveBytes()+projectedIndexBytes(8))
+}
+
+// TestCanAcceptStopsAtBudget forces a dropTracker to its ceiling at three
+// budgets and asserts (a) canAccept never returns true again once it returns
+// false, (b) the exact residency at the stop point is at or below the budget
+// maxIDs was derived from, and (c) building the index afterward does not push
+// measured residency above the budget.
+func TestCanAcceptStopsAtBudget(t *testing.T) {
+	for _, budget := range []uint64{1 << 20, 8 << 20, 32 << 20} {
+		budget := budget
+		t.Run(fmt.Sprintf("budget=%d", budget), func(t *testing.T) {
+			// A fresh, non-pooled set: acquireDroppedTraceIDs draws from the shared
+			// reuse pool, whose objects may carry over capacity from unrelated
+			// earlier tests, which would make the exact residency assertions below
+			// depend on test execution order instead of on n and budget alone.
+			dropped := &droppedTraceIDs{}
+			tracker := dropTracker{exact: dropped, budget: budget}
+
+			traceIdx := 0
+			for tracker.canAccept() {
+				tracker.record(fmt.Sprintf("service-a-%032x", traceIdx))
+				traceIdx++
+			}
+			require.True(t, tracker.full)
+			require.Positive(t, tracker.maxIDs, "maxIDs must be derived from the first recorded ID")
+			stoppedLen := dropped.len()
+
+			// (a) canAccept never returns true again.
+			for probe := range 3 {
+				require.False(t, tracker.canAccept(), "probe %d", probe)
+			}
+
+			// (b) the exact residency at the stop point, including the index the
+			// next attempted drop would have built, is at or below the budget.
+			projected := tracker.liveBytes() + projectedIndexBytes(stoppedLen+1)
+			require.LessOrEqual(t, projected, int64(budget))
+
+			// (c) building the index for real leaves measured residency at or
+			// below the budget too. residentBytes folds in cap(slots), so it is
+			// the post-build residency; liveBytes alone would omit the index.
+			dropped.buildIndex()
+			require.LessOrEqual(t, tracker.residentBytes(), int64(budget))
+		})
+	}
+}
+
+// TestZeroBudgetIsUnlimited asserts a zero budget never bounds a dropTracker and
+// never derives a ceiling. Production merges resolve a non-zero ceiling, so this
+// pins the opt-out path: a filter built without a budget must behave exactly as
+// the unbounded collector did before the ceiling existed.
+func TestZeroBudgetIsUnlimited(t *testing.T) {
+	dropped := acquireDroppedTraceIDs()
+	t.Cleanup(func() { releaseDroppedTraceIDs(dropped) })
+	tracker := dropTracker{exact: dropped}
+	require.Zero(t, maxIDsForBudget(0, 42))
+
+	for traceIdx := range 500_000 {
+		require.True(t, tracker.canAccept(), "traceIdx=%d", traceIdx)
+		tracker.record(fmt.Sprintf("service-a-%032x", traceIdx))
+	}
+	require.False(t, tracker.full)
+	require.Zero(t, tracker.maxIDs, "an unlimited tracker must not derive a ceiling")
+}
+
+// TestTinyBudgetStillBounds asserts a budget too small to hold even one entry
+// resolves to a ceiling of one rather than dividing to zero and being read back
+// as the unlimited sentinel. Without the clamp in maxIDsForBudget, the tightest
+// budget would disable the ceiling entirely.
+func TestTinyBudgetStillBounds(t *testing.T) {
+	const idLen = len("service-a-0")
+	entryBytes := uint64(dropSetBytesPerEntry(idLen))
+	for _, budget := range []uint64{1, entryBytes - 1, entryBytes} {
+		budget := budget
+		t.Run(fmt.Sprintf("budget=%d", budget), func(t *testing.T) {
+			require.Equal(t, 1, maxIDsForBudget(budget, idLen))
+			dropped := &droppedTraceIDs{}
+			tracker := dropTracker{exact: dropped, budget: budget}
+			require.True(t, tracker.canAccept())
+			tracker.record("service-a-0")
+			require.False(t, tracker.canAccept())
+			require.True(t, tracker.full)
+		})
+	}
+}
+
+// TestBytesPerEntryTracksIDLength is the DS-1b regression test: with a fixed
+// bytes/entry constant priced for a 42-byte ID, longer trace IDs overshot the
+// budget proportionally (about 1.4x at 96 bytes, 3x at 256), so the ceiling was
+// not a ceiling. Deriving the price from the recorded length must keep measured
+// residency at or below the budget at every length.
+func TestBytesPerEntryTracksIDLength(t *testing.T) {
+	const budget = 1 << 20
+	for _, idLen := range []int{42, 64, 96, 128, 256} {
+		idLen := idLen
+		t.Run(fmt.Sprintf("idLen=%d", idLen), func(t *testing.T) {
+			dropped := &droppedTraceIDs{}
+			tracker := dropTracker{exact: dropped, budget: budget}
+			traceIdx := 0
+			for tracker.canAccept() {
+				tracker.record(fmt.Sprintf("%0*x", idLen, traceIdx))
+				traceIdx++
+			}
+			require.Equal(t, idLen, tracker.sampledIDLen)
+			dropped.buildIndex()
+			require.LessOrEqual(t, tracker.residentBytes(), int64(budget))
+			// Longer IDs must yield a strictly smaller ceiling, or the price is not
+			// tracking length at all.
+			require.Equal(t, maxIDsForBudget(budget, idLen), tracker.maxIDs)
+		})
+	}
+	require.Greater(t, maxIDsForBudget(budget, 42), maxIDsForBudget(budget, 256))
+}
+
+// TestTrackerRederivesOnLongerID asserts the derived ceiling is self-correcting:
+// a shard is expected to have one trace-ID length, but if a longer ID does appear
+// the price is recomputed rather than left at the first length observed, so the
+// uniformity is not a load-bearing assumption.
+func TestTrackerRederivesOnLongerID(t *testing.T) {
+	const budget = 4 << 10
+	dropped := &droppedTraceIDs{}
+	tracker := dropTracker{exact: dropped, budget: budget}
+
+	tracker.record(fmt.Sprintf("%040x", 0))
+	shortCeiling := tracker.maxIDs
+	require.Equal(t, maxIDsForBudget(budget, 40), shortCeiling)
+
+	tracker.record(fmt.Sprintf("%0400x", 1))
+	require.Equal(t, 400, tracker.sampledIDLen)
+	require.Equal(t, maxIDsForBudget(budget, 400), tracker.maxIDs)
+	require.Less(t, tracker.maxIDs, shortCeiling, "a longer ID must lower the ceiling")
+
+	// A subsequent shorter ID must not raise the ceiling back up.
+	tracker.record(fmt.Sprintf("%041x", 2))
+	require.Equal(t, 400, tracker.sampledIDLen)
+	require.Equal(t, maxIDsForBudget(budget, 400), tracker.maxIDs)
+}
+
+// BenchmarkDropSetResidency reports bytes/entry for a fully-built drop set at
+// two scales, so DS-9's arena-backed IDs have a baseline to improve on.
+func BenchmarkDropSetResidency(b *testing.B) {
+	for _, entryCount := range []int{100_000, 1_000_000} {
+		b.Run(fmt.Sprintf("entries-%d", entryCount), func(b *testing.B) {
+			// A fresh set rather than acquireDroppedTraceIDs: a pooled object can
+			// carry slot capacity over from an unrelated earlier run, which would
+			// make the reported bytes/entry depend on execution order and so be
+			// useless as DS-9's baseline.
+			dropped := &droppedTraceIDs{}
+			for traceIdx := range entryCount {
+				dropped.add(fmt.Sprintf("service-a-%032x", traceIdx))
+			}
+			tracker := dropTracker{exact: dropped}
+			bytesPerEntry := float64(tracker.liveBytes()+projectedIndexBytes(entryCount)) / float64(entryCount)
+			// ResetTimer clears any metric reported before it, so report after.
+			b.ResetTimer()
+			b.ReportMetric(bytesPerEntry, "bytes/entry")
+			for range b.N {
+				_ = tracker.canAccept()
+			}
+			// Deliberately not returned to the pool: seeding it with this set's
+			// capacity is the ordering dependency the fresh set above avoids.
+		})
+	}
+}
+
+func benchmarkDropSetLookup(b *testing.B, encoded [][]byte, keep func([]byte) bool) {
+	b.Helper()
+	b.ReportMetric(float64(len(encoded)), "lookups/op")
+	b.ReportAllocs()
+	b.ResetTimer()
+	var retained int
+	for range b.N {
+		for _, data := range encoded {
+			if keep(data) {
+				retained++
+			}
+		}
+	}
+	if retained == 0 {
+		b.Fatal("lookup result was not consumed")
+	}
+}
diff --git a/banyand/trace/finalize_scanner.go b/banyand/trace/finalize_scanner.go
index 9f9c30ff0..03ee2529f 100644
--- a/banyand/trace/finalize_scanner.go
+++ b/banyand/trace/finalize_scanner.go
@@ -18,6 +18,8 @@
 package trace
 
 import (
+	"path/filepath"
+	"strings"
 	"time"
 
 	"github.com/apache/skywalking-banyandb/banyand/internal/storage"
@@ -110,7 +112,7 @@ func (sr *schemaRepo) scanGroup(group string, samplers []sdk.Sampler, graceNs, m
 		}
 		// Only fully-mature segments; and skip (without reopening) any whose shards are
 		// all terminal / in-cooldown / max-rounds per their on-disk finalize state.
-		if peek.End.UnixNano() > coolEnd || !segmentMayWarrant(lfs, peek.ShardPaths, cfg) {
+		if peek.End.UnixNano() > coolEnd || !sr.segmentMayWarrantObserved(group, lfs, peek.ShardPaths, cfg) {
 			continue
 		}
 		// This segment may warrant work: reopen just its range and finalize warranting
@@ -164,6 +166,34 @@ func segmentMayWarrant(lfs fs.FileSystem, shardPaths []string, cfg finalizeConfi
 	return false
 }
 
+// segmentMayWarrantObserved is segmentMayWarrant plus per-shard finalize-state
+// telemetry. The decision is unchanged — it still returns true as soon as one
+// shard warrants — but every shard's state is read and published first, because
+// this pre-filter is the only place a *terminal* shard is still visited: once a
+// segment is skipped, warrantsFinalize never runs for it again, so metrics emitted
+// deeper in the scan would go silent on exactly the shards that can no longer
+// delete anything (spec section 5.2).
+func (sr *schemaRepo) segmentMayWarrantObserved(group string, lfs fs.FileSystem, shardPaths []string, cfg finalizeConfig) bool {
+	warrants := false
+	for _, shardPath := range shardPaths {
+		st := readFinalizeState(lfs, shardPath)
+		sr.samplerMeter.observeFinalizeState(group, shardLabelFromPath(shardPath), st.FinalizeRounds,
+			st.Terminal || st.FinalizeRounds >= cfg.maxRounds)
+		if shardMayWarrant(st, cfg) {
+			warrants = true
+		}
+	}
+	return warrants
+}
+
+// shardLabelFromPath extracts the shard-id label from an on-disk shard directory
+// path (storage writes them as "shard-<id>"). An unrecognized layout yields the
+// raw base name rather than an empty label, so a series is still emitted.
+func shardLabelFromPath(shardPath string) string {
+	base := filepath.Base(shardPath)
+	return strings.TrimPrefix(base, "shard-")
+}
+
 // shardMayWarrant is the reopen pre-filter for one shard. It skips only the cases that
 // are authoritative from on-disk state regardless of whether the shard is open: terminal,
 // the hard round cap, and an un-elapsed cooldown. A never-finalized shard always warrants;
diff --git a/banyand/trace/finalizer.go b/banyand/trace/finalizer.go
index fc854913c..4f87a7669 100644
--- a/banyand/trace/finalizer.go
+++ b/banyand/trace/finalizer.go
@@ -165,7 +165,9 @@ func (tst *tsTable) runFinalizeRound(samplers []sdk.Sampler, graceNs int64) (boo
 		plannedStagingBatches: stagingPlan.PlannedBatches,
 		traceBudget:           resolveTraceBudget(tst.option),
 		maxTraceCount:         maxStagedTraceCountFromBudget(stagingPlan.BatchLimit),
-		forceSlow:             projectionRequiresSlowPath(chain.projection),
+		// Same budget as the hot filter (spec section 3.4: finalize is not
+		// special-cased). A finalize round is treated as one more merge.
+		budget: resolveDropSetBudget(tst.option),
 	}
 
 	merged := make(map[uint64]struct{}, len(parts))
@@ -181,6 +183,15 @@ func (tst *tsTable) runFinalizeRound(samplers []sdk.Sampler, graceNs int64) (boo
 		// Fail-open: leave the segment intact; the scanner retries on a later tick.
 		return false, err
 	}
+	// A capped round is the one condition an operator can act on (raise memory),
+	// so it gets exactly one warning here — not per batch, not per trace.
+	if retainedByCeiling := filter.retainedByCeiling.Load(); retainedByCeiling > 0 {
+		tst.l.Warn().
+			Str("group", tst.group).
+			Uint32("shard", uint32(tst.shardID)).
+			Uint64("retainedByCeiling", retainedByCeiling).
+			Msg("finalize round reached the drop-set ceiling; some traces were retained instead of dropped")
+	}
 
 	// Commit the per-shard finalize state AFTER the introduction (DD6 ordering). The
 	// in-memory cache and counter are mutated ONLY after the state file is durably
diff --git a/banyand/trace/fragment_guard_implementation_test.go b/banyand/trace/fragment_guard_implementation_test.go
index f66d2ecea..1e97790ff 100644
--- a/banyand/trace/fragment_guard_implementation_test.go
+++ b/banyand/trace/fragment_guard_implementation_test.go
@@ -104,6 +104,14 @@ func (s *implementationDropSampler) Decide(batch *sdk.TraceBatch) (sdk.Verdict,
 	return sdk.Verdict{Keep: keep}, nil
 }
 
+func assembleStagedTraceBlockForTest(t *testing.T, group stagedTraceGroup, staged []stagedTrace, projection sdk.Projection) (sdk.TraceBlock, bool) {
+	t.Helper()
+	vectors := acquireStagedEvaluationVectors(1, false)
+	prepareStagedProjectionVectors(vectors, staged, []stagedTraceGroup{group}, projection)
+	t.Cleanup(func() { releaseStagedEvaluationVectors(vectors, true) })
+	return assembleStagedTraceBlockInto(vectors, group, staged, projection)
+}
+
 func TestAssembleStagedTraceBlockAggregatesMetadataOnlyBlocks(t *testing.T) {
 	staged := []stagedTrace{
 		{
@@ -125,7 +133,7 @@ func TestAssembleStagedTraceBlockAggregatesMetadataOnlyBlocks(t *testing.T) {
 	}
 
 	group := stagedTraceGroup{traceID: "trace-a", start: 0, end: 2, minTS: 100, maxTS: 210, validMetadata: true}
-	assembled, complete := assembleStagedTraceBlock(group, staged, sdk.Projection{})
+	assembled, complete := assembleStagedTraceBlockForTest(t, group, staged, sdk.Projection{})
 
 	require.True(t, complete)
 	assert.Equal(t, "trace-a", assembled.TraceID)
@@ -177,7 +185,7 @@ func TestAssembleStagedTraceBlockAggregatesEveryProjectedRow(t *testing.T) {
 	}
 
 	group := stagedTraceGroup{traceID: "trace-a", start: 0, end: 2, minTS: 100, maxTS: 210, validMetadata: true}
-	assembled, complete := assembleStagedTraceBlock(group, staged, sdk.Projection{
+	assembled, complete := assembleStagedTraceBlockForTest(t, group, staged, sdk.Projection{
 		Tags:    []string{"service", "status"},
 		SpanIDs: true,
 		Spans:   true,
@@ -206,7 +214,7 @@ func TestAssembleStagedTraceBlockFailsOpenForUnknownBounds(t *testing.T) {
 	}}
 
 	group := stagedTraceGroup{traceID: "trace-a", start: 0, end: 1, minTS: 100, maxTS: 110}
-	_, complete := assembleStagedTraceBlock(group, staged, sdk.Projection{})
+	_, complete := assembleStagedTraceBlockForTest(t, group, staged, sdk.Projection{})
 
 	assert.False(t, complete)
 }
diff --git a/banyand/trace/merge_benchmark_observer.go b/banyand/trace/merge_benchmark_observer.go
index c01d0d4e7..ea0219a6e 100644
--- a/banyand/trace/merge_benchmark_observer.go
+++ b/banyand/trace/merge_benchmark_observer.go
@@ -211,6 +211,7 @@ type mergeBenchmarkEvent struct {
 	StagingBatches        []mergeBenchmarkStagingBatch `json:"stagingBatches,omitempty"`
 	GuardDeferred         map[string]uint64            `json:"guardDeferred,omitempty"`
 	Resources             mergeBenchmarkResources      `json:"resources"`
+	CoreElapsedNanos      int64                        `json:"coreElapsedNanos"`
 	OutputRows            uint64                       `json:"outputRows"`
 	TracesEvaluated       uint64                       `json:"tracesEvaluated"`
 	InputBytes            uint64                       `json:"inputBytes"`
@@ -234,15 +235,28 @@ type mergeBenchmarkEvent struct {
 	PlannedStagingBatches uint64                       `json:"plannedStagingBatches"`
 	ChargedStagingBytes   uint64                       `json:"chargedStagingBytes"`
 	PeakStagedBytes       uint64                       `json:"peakStagedBytes"`
-	QueueNanos            int64                        `json:"queueNanos"`
-	HotInputParts         uint32                       `json:"hotInputParts"`
-	MatureInputParts      uint32                       `json:"matureInputParts"`
-	InputMinDepth         uint32                       `json:"inputMinDepth"`
-	InputMaxDepth         uint32                       `json:"inputMaxDepth"`
-	OutputDepth           uint32                       `json:"outputDepth"`
-	Version               uint32                       `json:"version"`
-	DecisionMaxTraceCount int                          `json:"decisionMaxTraceCount"`
-	LosslessRetry         bool                         `json:"losslessRetry"`
+	// DropSetBudget is the resolved drop-set ceiling this merge's filter carried,
+	// from resolveDropSetBudget. Zero means unlimited, which a production merge no
+	// longer reports: a zero here indicates a filter built without a budget.
+	DropSetBudget uint64 `json:"dropSetBudget"`
+	// TracesRetainedByCeiling is the number of traces this merge retained because
+	// the drop-set ceiling was reached. These traces are a subset of
+	// TracesRetained, not a separate category: a ceiling retention increments both,
+	// which is what keeps retained+dropped == evaluated true for consumers of that
+	// invariant. Subtract this field from TracesRetained for the verdict-only count.
+	TracesRetainedByCeiling uint64 `json:"tracesRetainedByCeiling"`
+	QueueNanos              int64  `json:"queueNanos"`
+	HotInputParts           uint32 `json:"hotInputParts"`
+	MatureInputParts        uint32 `json:"matureInputParts"`
+	InputMinDepth           uint32 `json:"inputMinDepth"`
+	InputMaxDepth           uint32 `json:"inputMaxDepth"`
+	OutputDepth             uint32 `json:"outputDepth"`
+	Version                 uint32 `json:"version"`
+	DecisionMaxTraceCount   int    `json:"decisionMaxTraceCount"`
+	LosslessRetry           bool   `json:"losslessRetry"`
+	// DropSetCapped is true when this merge's drop-set ceiling was reached at
+	// least once (equivalent to TracesRetainedByCeiling > 0).
+	DropSetCapped bool `json:"dropSetCapped"`
 }
 
 type mergeBenchmarkAggregate struct {
diff --git a/banyand/trace/merger.go b/banyand/trace/merger.go
index 80729280c..19e2dc9d9 100644
--- a/banyand/trace/merger.go
+++ b/banyand/trace/merger.go
@@ -31,6 +31,7 @@ import (
 
 	"github.com/dustin/go-humanize"
 
+	internalencoding "github.com/apache/skywalking-banyandb/banyand/internal/encoding"
 	"github.com/apache/skywalking-banyandb/banyand/internal/sidx"
 	pkgbytes "github.com/apache/skywalking-banyandb/pkg/bytes"
 	"github.com/apache/skywalking-banyandb/pkg/cgroups"
@@ -214,6 +215,86 @@ func resolveTraceBudget(opt option) uint64 {
 	return stageBudgetFromLimit(limit)
 }
 
+// testDropSetBudgetOverride forces the drop-set ceiling when non-zero. Test-only
+// seam (mirrors testStageBudgetOverride): resolveDropSetBudget consults it before
+// the memory limit, so a test can force a ceiling through the same call both
+// production construction sites make. There is no operator flag.
+var testDropSetBudgetOverride uint64
+
+const (
+	// dropSetAggregateDivisor bounds the aggregate bytes a merge's drop set may
+	// hold across all concurrent merges to ~memLimit/divisor: each of up to
+	// CPUs() concurrent merges (the hot lanes plus the serialized finalize round)
+	// gets memLimit/(divisor*CPUs). Settling this constant is spec section 14's
+	// first open question; it sets both the memory bound and, through spec
+	// section 5.2, the lifetime deletion bound.
+	dropSetAggregateDivisor = 16
+	// defaultDropSetBudget is the limit==0 (protector disabled) fallback, mirroring
+	// stageBudgetFromLimit's defaultSmallMergeThreshold fallback.
+	defaultDropSetBudget = 16 << 20
+	// minimumDropSetBudget keeps a divided budget from collapsing to a ceiling so
+	// small that sampling stops making useful progress. It is deliberately far
+	// below defaultStageBudgetFloor's 16MB, because a generous floor is what would
+	// break the aggregate bound above on a small node: this floor only binds when
+	// limit < 16MB*CPUs, and the aggregate then stays a small share of any
+	// plausible limit (128MB/16 CPUs: 10MB, under 8%). It does dominate the bound
+	// on implausibly small limits (32MB/16 CPUs: 31%), which is accepted and
+	// pinned by TestDropSetAggregateBoundHolds rather than left to chance.
+	minimumDropSetBudget = 1 << 20
+)
+
+// resolveDropSetBudget returns the per-merge drop-set ceiling. It mirrors
+// resolveStageBudget/stageBudgetFromLimit: divide the memory limit by CPUs() so
+// the aggregate across concurrent merges stays near memLimit/
+// dropSetAggregateDivisor. Every merge is charged the same — hot lane, slow
+// lane, and finalize round alike (spec section 3.4):
+//
+//   - No independent entry cap. stageBudgetFromLimit needs
+//     defaultMaxStagedTraceCount because its per-trace byte estimate is coarse;
+//     the drop-set accounting in maxIDsForBudget is already a fixed, exact
+//     bytes/entry conversion, so a second cap would only duplicate the budget
+//     with a coarser unit.
+//   - No larger ceiling for finalize despite the finalize scanner being
+//     concurrency-1 node-wide (banyand/trace/finalize_scanner.go). A per-lane
+//     finalize ceiling is deferred (spec section 9.1): it needs evidence — a
+//     non-zero retained-by-ceiling count on real shards — that the shared
+//     budget's lifetime deletion bound (spec section 5.2) is actually being
+//     hit before adding a second resolver and a second constant that can drift
+//     apart from this one.
+//
+// Both merge-filter construction sites — the hot one in
+// buildHotMergeFilterDecisionAt and the finalize one in runFinalizeRound — call
+// this and nothing else, so the two can never resolve different ceilings;
+// TestFiltersCarryResolvedDropSetBudget asserts that equality.
+//
+// A node whose protector is disabled (no --allowed-bytes and no valid cgroup
+// limit, i.e. GetLimit()==0) gets the flat defaultDropSetBudget rather than a
+// ceiling proportional to its RAM, so on such a node the operator lever on spec
+// section 5.2's deletion bound is the protector limit, not the machine's memory.
+// This mirrors stageBudgetFromLimit's flat limit==0 fallback; the difference is
+// that a flat staging budget only slows a merge while a flat drop-set ceiling
+// bounds deletion, which is why it is called out here and in spec section 5.2.
+func resolveDropSetBudget(opt option) uint64 {
+	if testDropSetBudgetOverride > 0 {
+		return testDropSetBudgetOverride
+	}
+	var limit uint64
+	if opt.protector != nil {
+		limit = opt.protector.GetLimit()
+	}
+	return dropSetBudgetFromLimit(limit, cgroups.CPUs())
+}
+
+// dropSetBudgetFromLimit is resolveDropSetBudget's CPU-count-parameterized
+// core, split out so it is testable across a CPU matrix without depending on
+// the host's real cgroups.CPUs() value.
+func dropSetBudgetFromLimit(limit uint64, cpus int) uint64 {
+	if limit == 0 {
+		return defaultDropSetBudget
+	}
+	return max(limit/(dropSetAggregateDivisor*uint64(max(1, cpus))), minimumDropSetBudget)
+}
+
 // stageBudgetFromLimit derives the per-merge staged-byte budget from the memory
 // limit. With up to cgroups.CPUs() merges staging at once, each merge is allowed
 // memLimit/(stageBudgetAggregateDivisor*CPUs) so the aggregate stays ~memLimit/
@@ -646,7 +727,9 @@ func (tst *tsTable) buildHotMergeFilterDecisionAt(parts []*partWrapper, logicalN
 		plannedStagingBatches: stagingPlan.PlannedBatches,
 		traceBudget:           resolveTraceBudget(tst.option),
 		maxTraceCount:         maxStagedTraceCountFromBudget(stagingPlan.BatchLimit),
-		forceSlow:             projectionRequiresSlowPath(chain.projection),
+		// The drop-set ceiling is active (spec section 3.4): every merge, hot or
+		// finalize, resolves the same budget from the same function.
+		budget: resolveDropSetBudget(tst.option),
 	}, ""
 }
 
@@ -714,9 +797,27 @@ func (tst *tsTable) mergePartsThenSendIntroductionObserved(creator snapshotCreat
 		operation.event.DecisionBatchLimit = filter.decisionBatchLimit
 		operation.event.PlannedStagingBatches = filter.plannedStagingBatches
 		operation.event.DecisionMaxTraceCount = filter.maxTraceCount
+		operation.event.DropSetBudget = filter.budget
 	}
 	losslessRetry := false
 	defer func() {
+		// filter.retainedByCeiling is read here, after every merge attempt has
+		// run, rather than through the optional benchmark observation: the
+		// capped-merge counter must fire even when no benchmark observer is
+		// installed, which is the normal case for a production finalize round.
+		if filter != nil {
+			// Published unconditionally, capped or not: the counter below only fires
+			// once deletion has already been lost, so an uncapped observation is the
+			// only thing that lets an operator watch headroom shrink beforehand.
+			tst.observeDropSetUsage(filter.budget, int(filter.dropSetEntries.Load()), lane)
+			if retainedByCeiling := filter.retainedByCeiling.Load(); retainedByCeiling > 0 {
+				tst.incPipelineMergesCeilingReached(lane)
+				if operation != nil {
+					operation.event.TracesRetainedByCeiling = retainedByCeiling
+					operation.event.DropSetCapped = true
+				}
+			}
+		}
 		observer.finish(operation, mergedPart, resultErr, losslessRetry)
 	}()
 	var guardSession *traceFragmentGuardSession
@@ -749,6 +850,17 @@ func (tst *tsTable) mergePartsThenSendIntroductionObserved(creator snapshotCreat
 	}
 	tst.incPipelineGuardLosslessRetry(1)
 	losslessRetry = true
+	// The rejected attempt's ceiling retentions describe an output that was
+	// discarded: the retry runs with no filter, so the part that actually gets
+	// published drops nothing and retains nothing by ceiling. Clear the counter so
+	// neither the deferred capped-merge counter and benchmark event above nor
+	// runFinalizeRound's operator warning reports a ceiling for a merge whose
+	// published output never hit one. Nothing re-increments it: the retry passes a
+	// nil filter.
+	if filter != nil {
+		filter.retainedByCeiling.Store(0)
+		filter.dropSetEntries.Store(0)
+	}
 	losslessResult, losslessErr := tst.mergePartsThenIntroduceAttempt(
 		creator, parts, merged, merges, closeCh, typ, lane, nil, finalizeGenOverride, operation, 2,
 	)
@@ -823,29 +935,26 @@ func (tst *tsTable) mergePartsThenIntroduceAttempt(creator snapshotCreator, part
 	if err != nil {
 		return mergeAttemptResult{}, err
 	}
+	defer releaseDroppedTraceIDs(dropped)
+	filter.recordDropSetSize(dropped)
 	if operation != nil {
 		newPart.mergeDepth = operation.event.OutputDepth
 	}
 	elapsed := time.Since(start)
+	if operation != nil {
+		operation.event.CoreElapsedNanos = elapsed.Nanoseconds()
+	}
 	tst.observeCoreMerge(parts, newPart, elapsed, creator, typ, lane)
 	partIDMap := make(map[uint64]struct{})
 	for _, pw := range parts {
 		partIDMap[pw.ID()] = struct{}{}
 	}
-	// When the core merge dropped any trace, prune the same trace ids from every
-	// sibling sidx part via an opaque per-element predicate. The trace layer owns
-	// the encoding (decodeTraceID); sidx stays encoding-agnostic. Undecodable
-	// elements fail open (retain).
+	// When the core merge dropped any trace, prune the same trace IDs from every
+	// sibling SIDX part via an opaque per-element predicate. The trace layer owns
+	// the encoding; SIDX stays encoding-agnostic. Undecodable elements fail open.
 	var keepFn func([]byte) bool
-	if len(dropped) > 0 {
-		keepFn = func(data []byte) bool {
-			id, decErr := decodeTraceID(data)
-			if decErr != nil {
-				return true
-			}
-			_, isDropped := dropped[id]
-			return !isDropped
-		}
+	if dropped.len() > 0 {
+		keepFn = dropped.keepEncoded
 	}
 	mergerIntroductionMap := make(map[string]*sidx.MergerIntroduction)
 	sidxInstances := tst.getAllSidx()
@@ -927,7 +1036,7 @@ func (tst *tsTable) mergePartsThenIntroduceAttempt(creator snapshotCreator, part
 
 	var revalidation traceFragmentGuardRevalidation
 	hasRevalidation := false
-	if len(dropped) > 0 && filter != nil && filter.guard != nil {
+	if dropped.len() > 0 && filter != nil && filter.guard != nil {
 		revalidation = filter.guard.revalidate(tst)
 		hasRevalidation = true
 		tst.incPipelineGuardBloomProbes(revalidation.BloomProbes)
@@ -1091,7 +1200,7 @@ func (tst *tsTable) removeSidxPartOnFailure(sidxName string, partID uint64) {
 
 func (tst *tsTable) mergeParts(fileSystem fs.FileSystem, closeCh <-chan struct{}, parts []*partWrapper, partID uint64, root string,
 	filter *mergeFilter, finalizeGenOverride *uint64,
-) (*partWrapper, map[string]struct{}, error) {
+) (*partWrapper, *droppedTraceIDs, error) {
 	if len(parts) == 0 {
 		return nil, nil, errNoPartToMerge
 	}
@@ -1142,6 +1251,12 @@ func (tst *tsTable) mergeParts(fileSystem fs.FileSystem, closeCh <-chan struct{}
 	}
 
 	pm, tf, tt, dropped, err := mergeBlocks(closeCh, bw, br, conflictTags, filter)
+	droppedTransferred := false
+	defer func() {
+		if !droppedTransferred {
+			releaseDroppedTraceIDs(dropped)
+		}
+	}()
 	releaseBlockWriter(bw)
 	releaseBlockReader(br)
 	for i := range pii {
@@ -1178,6 +1293,7 @@ func (tst *tsTable) mergeParts(fileSystem fs.FileSystem, closeCh <-chan struct{}
 	// metadata write covers all prior dirent changes (data file creations).
 	p := mustOpenFilePart(partID, root, fileSystem)
 	outputPublished = true
+	droppedTransferred = true
 	return newPartWrapper(nil, p), dropped, nil
 }
 
@@ -1287,22 +1403,37 @@ func (buffer *stagedTraceGroupBuffer) reset() {
 }
 
 type stagedEvaluationVectors struct {
-	traceBlocks  []sdk.TraceBlock
-	traceIDs     []string
-	guardRanges  []stagedTraceRange
-	guardBlocks  []traceFragmentGuardBlock
-	decisionMask []bool
+	projectionArenas []*pkgbytes.Buffer
+	traceBlocks      []sdk.TraceBlock
+	tagColumns       []sdk.TagColumn
+	tagValues        [][]byte
+	spans            [][]byte
+	spanIDs          []string
+	traceIDs         []string
+	guardRanges      []stagedTraceRange
+	guardBlocks      []traceFragmentGuardBlock
+	decisionMask     []bool
 }
 
 func (vectors *stagedEvaluationVectors) reset() {
 	for traceIdx := range vectors.traceBlocks {
 		vectors.traceBlocks[traceIdx] = sdk.TraceBlock{}
 	}
+	clear(vectors.projectionArenas)
+	clear(vectors.tagColumns)
+	clear(vectors.tagValues)
+	clear(vectors.spans)
+	clear(vectors.spanIDs)
 	clear(vectors.traceIDs)
 	clear(vectors.guardRanges)
 	clear(vectors.guardBlocks)
 	clear(vectors.decisionMask)
+	vectors.projectionArenas = vectors.projectionArenas[:0]
 	vectors.traceBlocks = vectors.traceBlocks[:0]
+	vectors.tagColumns = vectors.tagColumns[:0]
+	vectors.tagValues = vectors.tagValues[:0]
+	vectors.spans = vectors.spans[:0]
+	vectors.spanIDs = vectors.spanIDs[:0]
 	vectors.traceIDs = vectors.traceIDs[:0]
 	vectors.guardRanges = vectors.guardRanges[:0]
 	vectors.guardBlocks = vectors.guardBlocks[:0]
@@ -1413,18 +1544,56 @@ func acquireStagedEvaluationVectors(traceCount int, withGuard bool) *stagedEvalu
 	return vectors
 }
 
+func prepareStagedProjectionVectors(vectors *stagedEvaluationVectors, staged []stagedTrace, groups []stagedTraceGroup, projection sdk.Projection) {
+	rowCount := 0
+	for groupIdx := range groups {
+		group := &groups[groupIdx]
+		for stagedIdx := group.start; stagedIdx < group.end && stagedIdx < len(staged); stagedIdx++ {
+			metadata := staged[stagedIdx].metadata()
+			if metadata != nil {
+				rowCount += int(metadata.count)
+			}
+		}
+	}
+	tagColumnCount := len(groups) * len(projection.Tags)
+	tagValueCount := rowCount * len(projection.Tags)
+	if cap(vectors.projectionArenas) < len(groups) {
+		vectors.projectionArenas = make([]*pkgbytes.Buffer, 0, len(groups))
+	}
+	if cap(vectors.tagColumns) < tagColumnCount {
+		vectors.tagColumns = make([]sdk.TagColumn, 0, tagColumnCount)
+	}
+	if cap(vectors.tagValues) < tagValueCount {
+		vectors.tagValues = make([][]byte, 0, tagValueCount)
+	}
+	if projection.Spans && cap(vectors.spans) < rowCount {
+		vectors.spans = make([][]byte, 0, rowCount)
+	}
+	if projection.SpanIDs && cap(vectors.spanIDs) < rowCount {
+		vectors.spanIDs = make([]string, 0, rowCount)
+	}
+}
+
 func releaseStagedEvaluationVectors(vectors *stagedEvaluationVectors, reusable bool) bool {
 	if vectors == nil {
 		return false
 	}
 	if !reusable {
+		for _, arena := range vectors.projectionArenas {
+			stagedByteArenas.pool.Discard(arena)
+		}
 		stagedEvaluationPool.Discard(vectors)
 		return false
 	}
+	for _, arena := range vectors.projectionArenas {
+		releaseStagedByteArena(arena)
+	}
 	vectors.reset()
 	if cap(vectors.traceBlocks) > maxPooledEvaluationTraces || cap(vectors.traceIDs) > maxPooledEvaluationTraces ||
 		cap(vectors.guardRanges) > maxPooledEvaluationTraces || cap(vectors.guardBlocks) > maxPooledStagedBlocks ||
-		cap(vectors.decisionMask) > maxPooledEvaluationTraces {
+		cap(vectors.decisionMask) > maxPooledEvaluationTraces || cap(vectors.projectionArenas) > maxPooledEvaluationTraces ||
+		cap(vectors.tagColumns) > maxPooledStagedBlocks || cap(vectors.tagValues) > maxPooledStagedBlocks ||
+		cap(vectors.spans) > maxPooledStagedBlocks || cap(vectors.spanIDs) > maxPooledStagedBlocks {
 		stagedEvaluationPool.Discard(vectors)
 		return false
 	}
@@ -1488,7 +1657,10 @@ type mergeFilter struct {
 	plannedStagingBatches uint64 // estimated number of balanced decision batches
 	traceBudget           uint64 // hard cap on one trace's staged bytes; exceeding it retains the trace without evaluation (0 disables bypass)
 	maxTraceCount         int    // hard cap on logical traces sent to one Decide call (0 disables the count cap)
-	forceSlow             bool   // forces the slow assembly path when the chain projects row data
+	budget                uint64 // drop-set ceiling in bytes for this merge, from resolveDropSetBudget; 0 means unlimited
+	retainedByCeiling     atomic.Uint64
+	dropSetEntries        atomic.Uint64 // dropped IDs the published attempt finished holding; feeds the headroom histogram
+	forceSlow             bool          // test seam that forces decoded staging instead of projected raw staging
 }
 
 func (st *stagedTrace) metadata() *blockMetadata {
@@ -1508,6 +1680,18 @@ func (f *mergeFilter) guardContext() context.Context {
 	return f.ctx
 }
 
+// recordDropSetSize stores how many dropped IDs a merge attempt finished holding,
+// for the headroom histogram observeDropSetUsage publishes once the published
+// attempt is known. Nil-safe on both receiver and argument so the caller needs no
+// branch: an unfiltered merge has no filter, and a merge that dropped nothing has
+// no set.
+func (f *mergeFilter) recordDropSetSize(dropped *droppedTraceIDs) {
+	if f == nil {
+		return
+	}
+	f.dropSetEntries.Store(uint64(dropped.len()))
+}
+
 // approxBytes estimates the deep-copied heap a staged trace holds so mergeBlocks
 // can bound the total staged set rather than holding the whole merge in memory.
 func (st *stagedTrace) approxBytes() uint64 {
@@ -1564,7 +1748,65 @@ func (st *stagedTrace) approxBytes() uint64 {
 }
 
 func (st *stagedTrace) approxEvaluationBytes(projection sdk.Projection) uint64 {
-	if st.slowBlock == nil || !projectionRequiresSlowPath(projection) {
+	if !projectionRequiresSlowPath(projection) {
+		return 0
+	}
+	if st.isRaw {
+		if st.rawBM == nil {
+			return 0
+		}
+		rowCount := st.rawBM.count
+		n := uint64(unsafe.Sizeof(sdk.TraceBlock{})) + uint64(unsafe.Sizeof((*pkgbytes.Buffer)(nil)))
+		n += uint64(len(projection.Tags)) * (uint64(unsafe.Sizeof(sdk.TagColumn{})) + rowCount*uint64(unsafe.Sizeof([]byte{})))
+		if projection.SpanIDs {
+			n += rowCount * uint64(unsafe.Sizeof(""))
+		}
+		if projection.Spans {
+			n += rowCount * uint64(unsafe.Sizeof([]byte{}))
+		}
+		decoder := generateColumnValuesDecoder()
+		defer releaseColumnValuesDecoder(decoder)
+		for _, projectedTag := range projection.Tags {
+			encodedName, exists := projectedRawTagName(st.rawBM, projectedTag)
+			if !exists {
+				continue
+			}
+			encodedValues, exists := st.rawTags[encodedName]
+			if !exists {
+				continue
+			}
+			valueBuffer := pkgbytes.Buffer{Buf: encodedValues}
+			values, decodeErr := internalencoding.DecodeTagValues(nil, decoder, &valueBuffer, st.rawBM.tagType[encodedName], int(st.rawBM.count))
+			if decodeErr != nil {
+				return n
+			}
+			for _, value := range values {
+				n += uint64(len(value))
+			}
+		}
+		if projection.Spans || projection.SpanIDs {
+			spanIDs, spanTail, decodeErr := decoder.DecodeWithTail(nil, st.rawSpans, st.rawBM.count)
+			if decodeErr != nil {
+				return n
+			}
+			if projection.SpanIDs {
+				for _, spanID := range spanIDs {
+					n += uint64(len(spanID))
+				}
+			}
+			if projection.Spans {
+				spans, spansErr := decoder.Decode(nil, spanTail, st.rawBM.count)
+				if spansErr != nil {
+					return n
+				}
+				for _, span := range spans {
+					n += uint64(len(span))
+				}
+			}
+		}
+		return n
+	}
+	if st.slowBlock == nil {
 		return 0
 	}
 	block := &st.slowBlock.block
@@ -1575,6 +1817,7 @@ func (st *stagedTrace) approxEvaluationBytes(projection sdk.Projection) uint64 {
 	for tagIdx := range block.tags {
 		n += uint64(len(block.tags[tagIdx].values)) * uint64(unsafe.Sizeof([]byte{}))
 	}
+	n += uint64(len(projection.Tags)) * (uint64(unsafe.Sizeof(sdk.TagColumn{})) + uint64(len(block.spans))*uint64(unsafe.Sizeof([]byte{})))
 	if projection.Spans {
 		n += uint64(len(block.spans)) * uint64(unsafe.Sizeof([]byte{}))
 		for _, span := range block.spans {
@@ -1590,8 +1833,6 @@ func (st *stagedTrace) approxEvaluationBytes(projection sdk.Projection) uint64 {
 			if decodeTypedTag(stagedTag.name) != projectedTag {
 				continue
 			}
-			n += uint64(unsafe.Sizeof(sdk.TagColumn{}))
-			n += uint64(len(stagedTag.values)) * uint64(unsafe.Sizeof([]byte{}))
 			for _, value := range stagedTag.values {
 				n += uint64(len(value))
 			}
@@ -1779,6 +2020,7 @@ type stagedEvaluationBatch struct {
 
 func assembleStagedEvaluationBatch(filter *mergeFilter, staged []stagedTrace, groups []stagedTraceGroup) (stagedEvaluationBatch, bool) {
 	vectors := acquireStagedEvaluationVectors(len(groups), filter.guard != nil)
+	prepareStagedProjectionVectors(vectors, staged, groups, filter.chain.projection)
 	assembledBatch := stagedEvaluationBatch{vectors: vectors}
 	expectedStart := 0
 	for groupIdx := range groups {
@@ -1788,7 +2030,7 @@ func assembleStagedEvaluationBatch(filter *mergeFilter, staged []stagedTrace, gr
 			releaseStagedEvaluationVectors(vectors, true)
 			return stagedEvaluationBatch{}, false
 		}
-		stagedTraceBlock, assembled := assembleStagedTraceBlock(*group, staged[group.start:group.end], filter.chain.projection)
+		stagedTraceBlock, assembled := assembleStagedTraceBlockInto(vectors, *group, staged[group.start:group.end], filter.chain.projection)
 		if assembled {
 			vectors.traceIDs = append(vectors.traceIDs, group.traceID)
 			vectors.traceBlocks = append(vectors.traceBlocks, stagedTraceBlock)
@@ -1805,7 +2047,9 @@ func assembleStagedEvaluationBatch(filter *mergeFilter, staged []stagedTrace, gr
 	return assembledBatch, true
 }
 
-func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatch stagedEvaluationBatch) (map[string]struct{}, bool) {
+func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatch stagedEvaluationBatch,
+	tracker *dropTracker,
+) ([]bool, bool) {
 	if len(assembledBatch.vectors.traceBlocks) == 0 {
 		return nil, true
 	}
@@ -1826,7 +2070,6 @@ func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatc
 	if filter.owner != nil {
 		filter.owner.incPipelineTracesEvaluated(len(assembledBatch.vectors.traceIDs))
 	}
-	var dropMature map[string]struct{}
 	for traceIdx, traceID := range assembledBatch.vectors.traceIDs {
 		if keepMask[traceIdx] {
 			if filter.observation != nil {
@@ -1837,11 +2080,26 @@ func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatc
 			}
 			continue
 		}
-		if filter.guard == nil {
-			if dropMature == nil {
-				dropMature = make(map[string]struct{})
+		// The ceiling converts a proposed drop into a retention before either
+		// recording site below and before the guard: a trace that will be kept
+		// needs no guard confirmation, and skipping it saves the guard's bloom
+		// probes (spec section 3.1/3.2). Recording and dropping stop at the same
+		// instant, so the drop set stays complete with respect to the drops it
+		// actually performs.
+		if !tracker.canAccept() {
+			keepMask[traceIdx] = true
+			filter.retainedByCeiling.Add(1)
+			if filter.observation != nil {
+				filter.observation.retained.Add(1)
+			}
+			if filter.owner != nil {
+				filter.owner.incPipelineTracesRetained(1)
+				filter.owner.incPipelineTracesRetainedByCeiling(1)
 			}
-			dropMature[traceID] = struct{}{}
+			continue
+		}
+		if filter.guard == nil {
+			tracker.record(traceID)
 			if filter.observation != nil {
 				filter.observation.dropped.Add(1)
 			}
@@ -1860,10 +2118,7 @@ func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatc
 			filter.owner.incPipelineGuardBloomProbes(decision.BloomProbes)
 		}
 		if decision.Action == traceFragmentGuardActionDrop && decision.ConfirmedDrop != nil {
-			if dropMature == nil {
-				dropMature = make(map[string]struct{})
-			}
-			dropMature[traceID] = struct{}{}
+			tracker.record(traceID)
 			if filter.observation != nil {
 				filter.observation.dropped.Add(1)
 			}
@@ -1883,14 +2138,15 @@ func resolveStagedDrops(filter *mergeFilter, staged []stagedTrace, assembledBatc
 			filter.observation.recordGuardDeferred(decision.Reason)
 			filter.observation.retained.Add(1)
 		}
+		keepMask[traceIdx] = true
 	}
-	return dropMature, reusable
+	return keepMask, reusable
 }
 
 // flushStaged evaluates staged traces and writes them in ascending trace-ID order.
 // Chain failures retain the whole batch, and allocated slow blocks are released.
 func flushStaged(bw *blockWriter, filter *mergeFilter, staged []stagedTrace, groups []stagedTraceGroup, validBatch bool,
-	droppedSet map[string]struct{},
+	tracker *dropTracker,
 ) {
 	if len(staged) == 0 {
 		return
@@ -1898,18 +2154,26 @@ func flushStaged(bw *blockWriter, filter *mergeFilter, staged []stagedTrace, gro
 	// Build one Decide entry per trace ID. A trace split across physical blocks is
 	// assembled completely, decided once, and dropped as a unit.
 	assembledBatch, validOrder := assembleStagedEvaluationBatch(filter, staged, groups)
-	var dropMature map[string]struct{}
+	var effectiveKeepMask []bool
 	reusable := true
 	if validBatch && validOrder {
-		dropMature, reusable = resolveStagedDrops(filter, staged, assembledBatch)
+		effectiveKeepMask, reusable = resolveStagedDrops(filter, staged, assembledBatch, tracker)
 	}
-	for i := range staged {
-		if _, isDropped := dropMature[staged[i].traceID]; isDropped {
-			droppedSet[staged[i].traceID] = struct{}{}
-		} else {
-			writeStagedKeep(bw, &staged[i])
+	decisionIdx := 0
+	for groupIdx := range groups {
+		group := &groups[groupIdx]
+		keep := true
+		if validBatch && validOrder && decisionIdx < len(assembledBatch.vectors.traceIDs) &&
+			group.traceID == assembledBatch.vectors.traceIDs[decisionIdx] {
+			keep = len(effectiveKeepMask) == 0 || effectiveKeepMask[decisionIdx]
+			decisionIdx++
+		}
+		for stagedIdx := group.start; stagedIdx < group.end; stagedIdx++ {
+			if keep {
+				writeStagedKeep(bw, &staged[stagedIdx])
+			}
+			releaseStagedTrace(&staged[stagedIdx])
 		}
-		releaseStagedTrace(&staged[i])
 	}
 	if validOrder {
 		releaseStagedEvaluationVectors(assembledBatch.vectors, reusable)
@@ -1917,8 +2181,7 @@ func flushStaged(bw *blockWriter, filter *mergeFilter, staged []stagedTrace, gro
 }
 
 // rawFastPathEligible reports whether the current block can be copied raw
-// (without unmarshaling): raw merge is not force-disabled, the active retention
-// filter does not require the slow tag-projecting path, and this is the only
+// (without unmarshaling): raw merge is not force-disabled and this is the only
 // block for its traceID (the next block, if any, has a different traceID).
 func rawFastPathEligible(filter *mergeFilter, nextB, b *blockPointer) bool {
 	if forceSlowMerge {
@@ -1933,13 +2196,13 @@ func rawFastPathEligible(filter *mergeFilter, nextB, b *blockPointer) bool {
 type traceEvaluationStager struct {
 	bw                *blockWriter
 	filter            *mergeFilter
-	droppedSet        map[string]struct{}
 	traceBuffer       *stagedTraceBuffer
 	groupBuffer       *stagedTraceGroupBuffer
 	lastStagedTraceID string
 	bypassedTraceID   string
 	staged            []stagedTrace
 	groups            []stagedTraceGroup
+	tracker           dropTracker
 	stagedBytes       uint64
 	currentTraceBytes uint64
 	currentTraceStart int
@@ -1974,6 +2237,8 @@ func (tes *traceEvaluationStager) releaseBuffers() {
 		tes.groupBuffer.values = tes.groups
 		releaseStagedTraceGroupBuffer(tes.groupBuffer)
 	}
+	releaseDroppedTraceIDs(tes.tracker.exact)
+	tes.tracker.exact = nil
 	tes.traceBuffer = nil
 	tes.groupBuffer = nil
 	tes.staged = nil
@@ -1987,7 +2252,7 @@ func (tes *traceEvaluationStager) flush(reason mergeStagingFlushReason) {
 	if tes.filter.observation != nil {
 		tes.filter.observation.recordStagingBatch(reason, tes.stagedBytes, uint64(len(tes.groups)))
 	}
-	flushStaged(tes.bw, tes.filter, tes.staged, tes.groups, !tes.invalidOrder && !tes.invalidMetadata, tes.droppedSet)
+	flushStaged(tes.bw, tes.filter, tes.staged, tes.groups, !tes.invalidOrder && !tes.invalidMetadata, &tes.tracker)
 	clear(tes.staged)
 	tes.staged = tes.staged[:0]
 	clear(tes.groups)
@@ -2090,7 +2355,7 @@ func (tes *traceEvaluationStager) stage(st stagedTrace) {
 			tes.filter.observation.recordStagingBatch(mergeStagingFlushOversizedTrace, prefixBytes, uint64(len(tes.groups)-1))
 		}
 		flushStaged(tes.bw, tes.filter, tes.staged[:tes.currentTraceStart], tes.groups[:len(tes.groups)-1],
-			!tes.invalidOrder && !tes.invalidMetadata, tes.droppedSet)
+			!tes.invalidOrder && !tes.invalidMetadata, &tes.tracker)
 	}
 	tes.writeBypassed(tes.staged[tes.currentTraceStart:])
 	tes.bypassedTraceID = st.traceID
@@ -2155,7 +2420,7 @@ func (tes *traceEvaluationStager) batchBudgetReached() bool {
 
 func mergeBlocks(closeCh <-chan struct{}, bw *blockWriter, br *blockReader, conflictTags map[string]struct{},
 	filter *mergeFilter,
-) (*partMetadata, *traceIDFilter, *tagType, map[string]struct{}, error) {
+) (*partMetadata, *traceIDFilter, *tagType, *droppedTraceIDs, error) {
 	pendingBlockIsEmpty := true
 	pendingBlock := generateBlockPointer()
 	defer releaseBlockPointer(pendingBlock)
@@ -2182,14 +2447,12 @@ func mergeBlocks(closeCh <-chan struct{}, bw *blockWriter, br *blockReader, conf
 		br.mustReadRaw(&rawBlk, bm)
 		renameRawConflictTags(&rawBlk, conflictTags)
 	}
-	var droppedSet map[string]struct{}
 	var evaluationStager *traceEvaluationStager
 	if filter != nil {
-		droppedSet = make(map[string]struct{})
 		evaluationStager = &traceEvaluationStager{
-			bw:         bw,
-			filter:     filter,
-			droppedSet: droppedSet,
+			bw:      bw,
+			filter:  filter,
+			tracker: dropTracker{budget: filter.budget},
 		}
 		defer evaluationStager.releaseBuffers()
 	}
@@ -2316,8 +2579,10 @@ func mergeBlocks(closeCh <-chan struct{}, bw *blockWriter, br *blockReader, conf
 	var tf traceIDFilter
 	tt := make(tagType)
 	bw.Flush(&pm, &tf, &tt)
-	if len(droppedSet) == 0 {
-		droppedSet = nil
+	var droppedSet *droppedTraceIDs
+	if evaluationStager != nil {
+		droppedSet = evaluationStager.tracker.exact
+		evaluationStager.tracker.exact = nil
 	}
 	return &pm, &tf, &tt, droppedSet, nil
 }
diff --git a/banyand/trace/merger_drop_set_ceiling_test.go b/banyand/trace/merger_drop_set_ceiling_test.go
new file mode 100644
index 000000000..39a4fd769
--- /dev/null
+++ b/banyand/trace/merger_drop_set_ceiling_test.go
@@ -0,0 +1,744 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership. The ASF licenses this
+// file to you under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+
+package trace
+
+import (
+	"bytes"
+	"context"
+	"testing"
+	"time"
+
+	"github.com/rs/zerolog"
+	"github.com/stretchr/testify/require"
+
+	"github.com/apache/skywalking-banyandb/api/common"
+	"github.com/apache/skywalking-banyandb/banyand/internal/sidx"
+	"github.com/apache/skywalking-banyandb/banyand/protector"
+	"github.com/apache/skywalking-banyandb/pkg/fs"
+	"github.com/apache/skywalking-banyandb/pkg/logger"
+	"github.com/apache/skywalking-banyandb/pkg/pipeline/sdk"
+	"github.com/apache/skywalking-banyandb/pkg/run"
+	"github.com/apache/skywalking-banyandb/pkg/test"
+	"github.com/apache/skywalking-banyandb/pkg/timestamp"
+)
+
+// ceilingTestBudget is a drop-set budget chosen so the ceiling this file's merges
+// derive is exactly 2: two entries' price, plus one byte so the division cannot
+// reach three. ceilingTestIDBodyBytes is the allocation class the short "trace-x"
+// IDs below land in — allocClassBytes rounds any length up to 16 to 16 — and the
+// expression mirrors dropSetBytesPerEntry, which cannot be called in a const.
+// Lengthening those IDs past 16 bytes would move them into the next class and
+// change the derived ceiling.
+const (
+	ceilingTestIDBodyBytes = 16
+	ceilingTestBudget      = 2*(dropSetEntryHeaderBytes+ceilingTestIDBodyBytes+dropSetEntrySlotBytes) + 1
+)
+
+// idSet builds a drop-everything set for fakeSampler from a slice of trace IDs.
+func idSet(ids []string) map[string]struct{} {
+	set := make(map[string]struct{}, len(ids))
+	for _, id := range ids {
+		set[id] = struct{}{}
+	}
+	return set
+}
+
+// buildCeilingTestParts writes one single-trace file part per id and returns
+// their wrappers, ready to merge.
+func buildCeilingTestParts(t *testing.T, fileSystem fs.FileSystem, tmpPath string, ids []string) []*partWrapper {
+	t.Helper()
+	trs := singleTraceParts(ids)
+	parts := make([]*partWrapper, 0, len(trs))
+	// Start part IDs well above curPartID's zero value so the merge output's
+	// newPartID (AddUint64(&tst.curPartID, 1), i.e. 1 for a fresh table) never
+	// collides with an input part's on-disk directory.
+	const partIDBase = uint64(100)
+	for i, tr := range trs {
+		partID := partIDBase + uint64(i)
+		mp := generateMemPart()
+		mp.mustInitFromTraces(tr)
+		mp.mustFlush(fileSystem, partPath(tmpPath, partID))
+		p := mustOpenFilePart(partID, tmpPath, fileSystem)
+		parts = append(parts, newPartWrapper(nil, p))
+		releaseMemPart(mp)
+	}
+	return parts
+}
+
+// newCeilingTestTable builds a minimal *tsTable suitable for driving a real
+// mergePartsThenSendIntroduction call, with an optional sidx map, and no
+// running background loops.
+func newCeilingTestTable(t *testing.T, fileSystem fs.FileSystem, tmpPath string, sidxMap map[string]sidx.SIDX) *tsTable {
+	t.Helper()
+	closer := run.NewCloser(1)
+	t.Cleanup(closer.Done)
+	return &tsTable{
+		pm:         protector.Nop{},
+		fileSystem: fileSystem,
+		root:       tmpPath,
+		loopCloser: closer,
+		l:          logger.GetLogger("drop-set-ceiling-test"),
+		sidxMap:    sidxMap,
+	}
+}
+
+// runCeilingMerge drives one real merge through mergePartsThenSendIntroduction
+// with a mock introducer that applies every introduction immediately, and
+// returns the published output part (ref=1, caller must decRef).
+func runCeilingMerge(t *testing.T, tst *tsTable, parts []*partWrapper, filter *mergeFilter) *partWrapper {
+	t.Helper()
+	merged := make(map[uint64]struct{}, len(parts))
+	for _, pw := range parts {
+		merged[pw.ID()] = struct{}{}
+	}
+	merges := make(chan *mergerIntroduction, 1)
+	introducerDone := make(chan struct{})
+	go func() {
+		defer close(introducerDone)
+		for mi := range merges {
+			close(mi.applied)
+		}
+	}()
+	closeCh := make(chan struct{})
+	newPart, err := tst.mergePartsThenSendIntroduction(
+		snapshotCreatorMerger, parts, merged, merges, closeCh,
+		mergeTypeFile, mergeLaneFast, &mergeOverrides{filter: filter},
+	)
+	require.NoError(t, err)
+	close(merges)
+	<-introducerDone
+	return newPart
+}
+
+// readPartTraceIDs reads back the ascending trace-ID sequence a merged part
+// was written with.
+func readPartTraceIDs(t *testing.T, pw *partWrapper) []string {
+	t.Helper()
+	iter := generatePartMergeIter()
+	iter.mustInitFromPart(pw.p)
+	reader := generateBlockReader()
+	reader.init([]*partMergeIter{iter})
+	var ids []string
+	for reader.nextBlockMetadata() {
+		ids = append(ids, reader.block.bm.traceID)
+	}
+	require.NoError(t, reader.error())
+	releaseBlockReader(reader)
+	releasePartMergeIter(iter)
+	return ids
+}
+
+// recordingFakeSIDX is a sidx.SIDX whose Merge applies the caller-supplied
+// keepFn to a fixed candidate element set and records the survivors, so a
+// test can assert the drop set pruned SIDX-side elements exactly.
+type recordingFakeSIDX struct {
+	fakeSIDX
+	elements  []string
+	survivors []string
+}
+
+func (f *recordingFakeSIDX) Merge(_ <-chan struct{}, _ map[uint64]struct{}, _ uint64, keepFn func([]byte) bool) (*sidx.MergerIntroduction, error) {
+	f.survivors = f.survivors[:0]
+	for _, elem := range f.elements {
+		encoded := append([]byte{byte(idFormatV1)}, elem...)
+		if keepFn == nil || keepFn(encoded) {
+			f.survivors = append(f.survivors, elem)
+		}
+	}
+	return nil, nil
+}
+
+// recordingTraceFragmentGuard is a traceFragmentGuard test double that
+// confirms every Resolve call as a drop and records call counts, so a test
+// can assert the ceiling skips it for ceiling-retained traces while still
+// exercising the real guard-revalidation call site.
+type recordingTraceFragmentGuard struct {
+	resolveCalls    int
+	revalidateCalls int
+	bloomProbes     int
+}
+
+func (g *recordingTraceFragmentGuard) Resolve(_ context.Context, trace traceFragmentGuardTrace, _ traceFragmentSamplerAction) traceFragmentGuardDecision {
+	g.resolveCalls++
+	g.bloomProbes++
+	return traceFragmentGuardDecision{
+		Action:        traceFragmentGuardActionDrop,
+		ConfirmedDrop: &traceFragmentGuardConfirmedDrop{TraceID: trace.TraceID},
+		BloomProbes:   1,
+	}
+}
+
+func (g *recordingTraceFragmentGuard) RevalidateDrops(context.Context, traceFragmentGuardRevalidationRequest) traceFragmentGuardRevalidation {
+	g.revalidateCalls++
+	return traceFragmentGuardRevalidation{Publish: true}
+}
+
+func (*recordingTraceFragmentGuard) Close() {}
+
+// rejectingTraceFragmentGuard confirms every proposed drop but refuses to publish
+// the filtered output, which is what forces the merge onto its lossless retry.
+type rejectingTraceFragmentGuard struct {
+	revalidateCalls int
+}
+
+func (*rejectingTraceFragmentGuard) Resolve(_ context.Context, trace traceFragmentGuardTrace, _ traceFragmentSamplerAction) traceFragmentGuardDecision {
+	return traceFragmentGuardDecision{
+		Action:        traceFragmentGuardActionDrop,
+		ConfirmedDrop: &traceFragmentGuardConfirmedDrop{TraceID: trace.TraceID},
+		BloomProbes:   1,
+	}
+}
+
+func (g *rejectingTraceFragmentGuard) RevalidateDrops(context.Context, traceFragmentGuardRevalidationRequest) traceFragmentGuardRevalidation {
+	g.revalidateCalls++
+	return traceFragmentGuardRevalidation{Publish: false, Reason: traceFragmentGuardReasonBudgetExhausted}
+}
+
+func (*rejectingTraceFragmentGuard) Close() {}
+
+// TestMergeCeilingPrunesSidxExactly forces a two-entry ceiling on a merge
+// whose sampler proposes five drops, and asserts strict set equality — in
+// both directions — between each sidx instance's surviving element set and
+// the output part's trace-ID set: an orphan or a missing entry either way
+// fails the test.
+func TestMergeCeilingPrunesSidxExactly(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+
+	latency := &recordingFakeSIDX{elements: append([]string(nil), ids...)}
+	startTime := &recordingFakeSIDX{elements: append([]string(nil), ids...)}
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, map[string]sidx.SIDX{
+		"latency": latency, "start_time": startTime,
+	})
+
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(ids)}}, 0)
+	filter := &mergeFilter{chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	outputIDs := readPartTraceIDs(t, newPart)
+	require.ElementsMatch(t, []string{"trace-c", "trace-d", "trace-e"}, outputIDs)
+
+	require.ElementsMatch(t, outputIDs, latency.survivors, "latency sidx must retain exactly the output part's trace IDs")
+	require.ElementsMatch(t, outputIDs, startTime.survivors, "start_time sidx must retain exactly the output part's trace IDs")
+}
+
+// TestMergeCeilingRetainsTheAscendingTail pins the ordering bias of spec
+// section 4 as observed behavior: a capped merge spares the
+// lexicographically largest of the proposed drops, because core merge
+// proposes drops in ascending trace-ID order.
+func TestMergeCeilingRetainsTheAscendingTail(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(ids)}}, 0)
+	filter := &mergeFilter{chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	// The block reader yields blocks in the same ascending order they were
+	// written, so an exact (ordered) comparison also confirms writeStagedKeep
+	// preserved ascending order for the spared tail.
+	require.Equal(t, []string{"trace-c", "trace-d", "trace-e"}, readPartTraceIDs(t, newPart))
+}
+
+// TestMergeCeilingCounterAccounting asserts retained-by-ceiling equals the
+// proposed drops beyond the ceiling, and that total retained (visible via the
+// output part) equals verdict-retained plus ceiling-retained.
+func TestMergeCeilingCounterAccounting(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	// The sampler drops a,b,c,d (four proposed drops) but verdict-retains e.
+	// With a two-entry ceiling: a,b are dropped for real; c,d are
+	// ceiling-retained; e is verdict-retained. Total retained (3) = 1
+	// verdict-retained + 2 ceiling-retained.
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	proposedDrops := []string{"trace-a", "trace-b", "trace-c", "trace-d"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(proposedDrops)}}, 0)
+	filter := &mergeFilter{chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	outputIDs := readPartTraceIDs(t, newPart)
+	require.ElementsMatch(t, []string{"trace-c", "trace-d", "trace-e"}, outputIDs)
+	require.Equal(t, uint64(2), filter.retainedByCeiling.Load(), "retained-by-ceiling must equal the proposed drops beyond the ceiling")
+	require.Len(t, outputIDs, 3, "total retained must equal verdict-retained (1) plus ceiling-retained (2)")
+}
+
+// TestMergeCeilingSkipsGuard asserts the guard's Resolve call count equals the
+// number of pre-ceiling proposed drops: the guard is never consulted for a
+// trace that will be retained by the ceiling.
+func TestMergeCeilingSkipsGuard(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+
+	guard := &recordingTraceFragmentGuard{}
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(ids)}}, 0)
+	filter := &mergeFilter{
+		chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget,
+		guard: &traceFragmentGuardSession{guard: guard},
+	}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	require.Equal(t, 2, guard.resolveCalls, "the guard must only be consulted for the pre-ceiling proposed drops")
+	require.Equal(t, 2, guard.bloomProbes)
+}
+
+// TestMergeCeilingStillRevalidatesGuard asserts a capped merge that dropped at
+// least one trace still runs the guard's revalidation — the regression the
+// rejected bloom-release design (spec section 8) would have introduced.
+func TestMergeCeilingStillRevalidatesGuard(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+
+	guard := &recordingTraceFragmentGuard{}
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(ids)}}, 0)
+	filter := &mergeFilter{
+		chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget,
+		guard: &traceFragmentGuardSession{guard: guard},
+	}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	require.Equal(t, 1, guard.revalidateCalls, "a capped merge that dropped at least one trace must still revalidate")
+}
+
+// TestProductionBudgetMergeReachesNoCeiling asserts an ordinary-sized merge
+// carrying the real resolved production budget records every proposed drop and
+// retains nothing by ceiling. Before DS-5 this test asserted the budget==0
+// (unlimited) sentinel directly; now that both construction sites resolve a real
+// budget it pins two things instead: that the resolved value is the one under
+// test, and that the ceiling it derives leaves substantial headroom. Asserting
+// the derived ceiling — not just "this merge did not cap" — is what keeps the
+// test from passing for any budget above a few kilobytes, so shrinking
+// defaultDropSetBudget to a value that would cap real merges fails here.
+func TestProductionBudgetMergeReachesNoCeiling(t *testing.T) {
+	const (
+		dropCount = 150
+		// The production default must admit far more than a single merge's worth of
+		// drops; well below the ~246k the 16MiB fallback derives for these IDs, but
+		// high enough that any meaningful shrink of the constant trips it.
+		minProductionCeiling = 100_000
+	)
+	ids := make([]string, dropCount)
+	for i := range ids {
+		ids[i] = fmtTraceID(i)
+	}
+
+	budget := resolveDropSetBudget(option{})
+	require.NotZero(t, budget, "a production merge must resolve a real ceiling, not the unlimited sentinel")
+	derivedCeiling := maxIDsForBudget(budget, len(ids[0]))
+	require.GreaterOrEqual(t, derivedCeiling, minProductionCeiling,
+		"the production default budget must leave headroom for an ordinary merge")
+	require.Greater(t, derivedCeiling, dropCount, "this merge must sit below the derived ceiling by construction")
+
+	filter := &mergeFilter{chain: newTestChain(idSet(ids)), timeout: time.Second, budget: budget}
+	defer filter.chain.close()
+
+	_, dropped := mergeWithFilter(t, singleTraceParts(ids), filter)
+
+	require.Len(t, dropped, dropCount, "every proposed drop must be recorded below the ceiling")
+	require.Zero(t, filter.retainedByCeiling.Load())
+}
+
+// TestLosslessRetryClearsCeilingReporting asserts a capped attempt that the guard
+// rejects does not leave ceiling telemetry behind: the retry publishes an
+// unfiltered output that drops nothing, so reporting a ceiling for it would tell
+// an operator to raise memory over a merge that never hit one. Observability is
+// the only signal this design has for under-deletion (spec section 6), so it has
+// to describe the output that was actually published.
+func TestLosslessRetryClearsCeilingReporting(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+
+	// A guard that confirms drops but refuses publication forces the lossless
+	// retry, which re-runs the merge with no filter at all.
+	guard := &rejectingTraceFragmentGuard{}
+	chain := newTestChain(idSet(ids))
+	filter := &mergeFilter{
+		chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget,
+		guard: &traceFragmentGuardSession{guard: guard},
+	}
+	defer chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	if newPart != nil {
+		defer newPart.decRef()
+	}
+
+	require.Positive(t, guard.revalidateCalls, "the rejecting guard must have forced the lossless retry")
+	require.Zero(t, filter.retainedByCeiling.Load(),
+		"a discarded capped attempt must not leave ceiling retentions behind for the published output")
+	require.ElementsMatch(t, ids, readPartTraceIDs(t, newPart),
+		"the lossless retry publishes every trace, so nothing was dropped or ceiling-retained")
+}
+
+// TestLargeForcedCeilingMergeBoundsDropSetResidency is an in-process check —
+// NOT the containerized, resource-limited controlled run DS-5's exit gate
+// calls for. It drives one real merge over a data set two orders of
+// magnitude larger than this file's other ceiling tests (300 proposed drops
+// versus 5) through a forced ceiling, and asserts the number of traces
+// actually recorded as dropped stops exactly at maxIDsForBudget's derived
+// cap: never more, confirming residency never exceeds the resolved budget,
+// and never less, confirming the ceiling does not retain early.
+func TestLargeForcedCeilingMergeBoundsDropSetResidency(t *testing.T) {
+	const (
+		dropCount   = 300
+		wantCeiling = 60
+	)
+	ids := make([]string, dropCount)
+	for i := range ids {
+		ids[i] = fmtTraceID(i)
+	}
+	price := dropSetBytesPerEntry(len(ids[0]))
+	budget := uint64(wantCeiling)*uint64(price) + 1
+	require.Equal(t, wantCeiling, maxIDsForBudget(budget, len(ids[0])), "the chosen budget must derive exactly the target ceiling")
+
+	filter := &mergeFilter{chain: newTestChain(idSet(ids)), timeout: time.Second, budget: budget}
+	defer filter.chain.close()
+
+	retained, dropped := mergeWithFilter(t, singleTraceParts(ids), filter)
+
+	require.Len(t, dropped, wantCeiling, "drop-set residency must stop exactly at the derived ceiling, not beyond it")
+	require.Len(t, retained, dropCount-wantCeiling, "everything past the ceiling must be retained instead of dropped")
+	require.Equal(t, uint64(dropCount-wantCeiling), filter.retainedByCeiling.Load())
+}
+
+// fmtTraceID builds an ascending, zero-padded trace ID so a large synthetic
+// drop set stays in the ascending order add() requires.
+func fmtTraceID(i int) string {
+	const digits = "0123456789abcdef"
+	buf := make([]byte, 0, 16)
+	buf = append(buf, "trace-"...)
+	for shift := 28; shift >= 0; shift -= 4 {
+		buf = append(buf, digits[(i>>shift)&0xf])
+	}
+	return string(buf)
+}
+
+// TestCappedFinalizeRoundLeavesStateUnchanged asserts a capped finalize round
+// writes the same finalize.json fields a normal round does: generation
+// advanced, counter reset, no new fields, FinalizeRounds incremented once.
+// Guards spec section 11 invariant 7 that finalize scheduling is untouched.
+func TestCappedFinalizeRoundLeavesStateUnchanged(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	tst, err := newTSTable(
+		fileSystem, tmpPath,
+		common.Position{Database: "capped-finalize"},
+		logger.GetLogger("capped-finalize-test"),
+		timestamp.NewInclusiveTimeRange(time.Unix(-1, 0), time.Unix(1, 0)),
+		option{
+			flushTimeout:        0,
+			mergePolicy:         newDefaultMergePolicyForTesting(),
+			protector:           protector.Nop{},
+			decideTimeout:       time.Second,
+			mergeGraceDefault:   time.Millisecond,
+			maxTraceFragmentGap: time.Nanosecond,
+		},
+		nil,
+	)
+	require.NoError(t, err)
+	defer tst.Close()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	tst.mustAddTraces(tracesWithIDs(ids...), nil)
+	require.Eventually(t, func() bool {
+		s := tst.currentSnapshot()
+		if s == nil {
+			return false
+		}
+		defer s.decRef()
+		for _, pw := range s.parts {
+			if pw.mp == nil && pw.p.partMetadata.TotalCount > 0 {
+				return true
+			}
+		}
+		return false
+	}, 10*time.Second, 20*time.Millisecond, "flushed file part must appear")
+	require.Equal(t, uint64(len(ids)), snapshotTotalCount(tst))
+
+	testDropSetBudgetOverride = ceilingTestBudget
+	t.Cleanup(func() { testDropSetBudgetOverride = 0 })
+
+	// dropPrefixSampler{prefix: ""} proposes every trace ID as a drop.
+	finalized, roundErr := tst.runFinalizeRound([]sdk.Sampler{dropPrefixSampler{prefix: ""}}, int64(time.Millisecond))
+	require.NoError(t, roundErr)
+	require.True(t, finalized, "a round must have committed even though it was capped")
+
+	// Two of five dropped for real, three ceiling-retained: the round did
+	// less deletion than an uncapped round would have, but it still ran.
+	require.Equal(t, uint64(3), snapshotTotalCount(tst), "ceiling-retained traces must survive the round")
+	require.Equal(t, uint64(1), tst.finalizeGenCached.Load(), "generation must still advance to 1")
+	require.Zero(t, tst.unsampledBytes.Load(), "counter must still reset after the round")
+
+	st := readFinalizeState(fileSystem, tmpPath)
+	require.Equal(t, uint64(1), st.FinalizeGeneration, "persisted generation must be 1, same shape as an uncapped round")
+	require.Equal(t, 1, st.FinalizeRounds, "persisted round count must be incremented exactly once")
+	require.NotEmpty(t, st.LastFinalizedAt)
+}
+
+// TestCappedFinalizeRoundWarnsOnce asserts exactly one warning is logged for a
+// capped finalize round, and none for an uncapped one.
+func TestCappedFinalizeRoundWarnsOnce(t *testing.T) {
+	newTable := func(t *testing.T, name string, buf *bytes.Buffer) *tsTable {
+		t.Helper()
+		tmpPath, defFn := test.Space(require.New(t))
+		t.Cleanup(defFn)
+		fileSystem := fs.NewLocalFileSystem()
+		zl := zerolog.New(buf)
+		tst, err := newTSTable(
+			fileSystem, tmpPath,
+			common.Position{Database: name},
+			&logger.Logger{Logger: &zl},
+			timestamp.NewInclusiveTimeRange(time.Unix(-1, 0), time.Unix(1, 0)),
+			option{
+				flushTimeout:        0,
+				mergePolicy:         newDefaultMergePolicyForTesting(),
+				protector:           protector.Nop{},
+				decideTimeout:       time.Second,
+				mergeGraceDefault:   time.Millisecond,
+				maxTraceFragmentGap: time.Nanosecond,
+			},
+			nil,
+		)
+		require.NoError(t, err)
+		t.Cleanup(func() { require.NoError(t, tst.Close()) })
+		return tst
+	}
+	waitForFlush := func(t *testing.T, tst *tsTable) {
+		t.Helper()
+		require.Eventually(t, func() bool {
+			s := tst.currentSnapshot()
+			if s == nil {
+				return false
+			}
+			defer s.decRef()
+			for _, pw := range s.parts {
+				if pw.mp == nil && pw.p.partMetadata.TotalCount > 0 {
+					return true
+				}
+			}
+			return false
+		}, 10*time.Second, 20*time.Millisecond, "flushed file part must appear")
+	}
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+
+	t.Run("capped", func(t *testing.T) {
+		var buf bytes.Buffer
+		tst := newTable(t, "capped-warn", &buf)
+		tst.mustAddTraces(tracesWithIDs(ids...), nil)
+		waitForFlush(t, tst)
+
+		testDropSetBudgetOverride = ceilingTestBudget
+		t.Cleanup(func() { testDropSetBudgetOverride = 0 })
+
+		finalized, roundErr := tst.runFinalizeRound([]sdk.Sampler{dropPrefixSampler{prefix: ""}}, int64(time.Millisecond))
+		require.NoError(t, roundErr)
+		require.True(t, finalized)
+
+		warnCount := bytes.Count(buf.Bytes(), []byte("drop-set ceiling"))
+		require.Equal(t, 1, warnCount, "exactly one warning must be logged for a capped round")
+	})
+
+	t.Run("uncapped", func(t *testing.T) {
+		var buf bytes.Buffer
+		tst := newTable(t, "uncapped-warn", &buf)
+		tst.mustAddTraces(tracesWithIDs(ids...), nil)
+		waitForFlush(t, tst)
+
+		finalized, roundErr := tst.runFinalizeRound([]sdk.Sampler{dropPrefixSampler{prefix: ""}}, int64(time.Millisecond))
+		require.NoError(t, roundErr)
+		require.True(t, finalized)
+
+		warnCount := bytes.Count(buf.Bytes(), []byte("drop-set ceiling"))
+		require.Zero(t, warnCount, "an uncapped round must not warn")
+	})
+}
+
+// TestBenchmarkEventCarriesDropSetCeiling forces a ceiling and asserts the
+// benchmark event's resolved budget, capped flag, and retained-by-ceiling
+// count are populated and consistent with each other.
+func TestBenchmarkEventCarriesDropSetCeiling(t *testing.T) {
+	tmpPath, defFn := test.Space(require.New(t))
+	defer defFn()
+	fileSystem := fs.NewLocalFileSystem()
+
+	ids := []string{"trace-a", "trace-b", "trace-c", "trace-d", "trace-e"}
+	parts := buildCeilingTestParts(t, fileSystem, tmpPath, ids)
+	defer func() {
+		for _, pw := range parts {
+			pw.decRef()
+		}
+	}()
+	tst := newCeilingTestTable(t, fileSystem, tmpPath, nil)
+	observer := newMergeBenchmarkObserver(nil, mergeBenchmarkObserverOptions{})
+	require.True(t, tst.setMergeBenchmarkObserver(observer))
+
+	chain := newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{dropIDs: idSet(ids)}}, 0)
+	filter := &mergeFilter{chain: chain, timeout: time.Second, owner: tst, budget: ceilingTestBudget}
+	defer filter.chain.close()
+
+	newPart := runCeilingMerge(t, tst, parts, filter)
+	defer newPart.decRef()
+
+	snapshot := observer.snapshot()
+	require.Len(t, snapshot.Events, 1)
+	event := snapshot.Events[0]
+	require.Equal(t, uint64(ceilingTestBudget), event.DropSetBudget)
+	require.True(t, event.DropSetCapped)
+	require.Equal(t, filter.retainedByCeiling.Load(), event.TracesRetainedByCeiling)
+	require.Positive(t, event.TracesRetainedByCeiling)
+}
+
+// TestFiltersCarryResolvedDropSetBudget is DS-5's activation test: both
+// mergeFilter construction sites — the hot filter (buildHotMergeFilterDecisionAt)
+// and the finalize filter (runFinalizeRound) — must carry resolveDropSetBudget's
+// value, and that value must be identical at both sites. The equality assertion
+// is deliberate: it is what fails if a later change reintroduces a lane-specific
+// budget without updating spec section 3.4.
+func TestFiltersCarryResolvedDropSetBudget(t *testing.T) {
+	const group = "ds5-filters-carry-budget"
+	resetRegistries()
+	t.Cleanup(resetRegistries)
+
+	// A fixed, non-default, non-override protector limit makes it evident that
+	// the value observed at both sites is really resolveDropSetBudget's output,
+	// not a coincidental match with some other constant.
+	opt := option{
+		flushTimeout:          0,
+		mergePolicy:           newDefaultMergePolicyForTesting(),
+		protector:             fixedLimitProtector{limit: 4 << 30},
+		decideTimeout:         time.Second,
+		mergeGraceDefault:     time.Millisecond,
+		maxTraceFragmentGap:   time.Microsecond,
+		nativePipelineEnabled: true,
+	}
+	tmpPath, cleanupFn := test.Space(require.New(t))
+	t.Cleanup(cleanupFn)
+	fileSystem := fs.NewLocalFileSystem()
+	tst, tableErr := newTSTable(
+		fileSystem, tmpPath,
+		common.Position{Database: group},
+		logger.GetLogger(group),
+		timestamp.NewInclusiveTimeRange(time.Unix(-1, 0), time.Unix(1, 0)),
+		opt, nil,
+	)
+	require.NoError(t, tableErr)
+	t.Cleanup(func() { require.NoError(t, tst.Close()) })
+
+	deregister := registerSampler(group, &durationEnvelopeSampler{})
+	t.Cleanup(deregister)
+	setMergeEventForGroup(group, true)
+	t.Cleanup(func() { setMergeEventForGroup(group, false) })
+
+	tst.mustAddTraces(tracesWithIDs("trace-a", "trace-b"), nil)
+	parts := waitForImplementationFileParts(t, tst, 1)
+	defer releaseImplementationParts(parts)
+
+	want := resolveDropSetBudget(tst.option)
+	require.NotZero(t, want, "the resolved budget must be a real ceiling once DS-5 activates it")
+
+	// Hot construction site.
+	hotFilter, reason := tst.buildHotMergeFilterDecision(parts)
+	require.NotNil(t, hotFilter, "hot filter must build; reason: %v", reason)
+	defer hotFilter.chain.close()
+	require.Equal(t, want, hotFilter.budget, "hot filter must carry resolveDropSetBudget's value")
+
+	// Finalize construction site: the filter is local to runFinalizeRound, so
+	// capture its budget the same way production observability does — through
+	// the benchmark event, which mergePartsThenSendIntroductionObserved
+	// populates from filter.budget before any decision is made.
+	observer := newMergeBenchmarkObserver(nil, mergeBenchmarkObserverOptions{})
+	require.True(t, tst.setMergeBenchmarkObserver(observer))
+	finalized, roundErr := tst.runFinalizeRound([]sdk.Sampler{dropPrefixSampler{prefix: "nonexistent-"}}, int64(time.Millisecond))
+	require.NoError(t, roundErr)
+	require.True(t, finalized, "the finalize round must commit")
+
+	snapshot := observer.snapshot()
+	require.Len(t, snapshot.Events, 1)
+	require.Equal(t, want, snapshot.Events[0].DropSetBudget, "finalize filter must carry resolveDropSetBudget's value")
+
+	require.Equal(t, hotFilter.budget, snapshot.Events[0].DropSetBudget,
+		"hot and finalize construction sites must carry the identical resolved budget (spec section 3.4)")
+}
diff --git a/banyand/trace/metrics.go b/banyand/trace/metrics.go
index b64e58ffe..0411b59e2 100644
--- a/banyand/trace/metrics.go
+++ b/banyand/trace/metrics.go
@@ -84,10 +84,34 @@ type metrics struct {
 	pipelineGuardPublicationRejected meter.Counter
 	pipelineGuardLosslessRetry       meter.Counter
 	pipelineGuardBypassed            meter.Counter
+	// pipelineTracesRetainedByCeiling and pipelineMergesCeilingReached carry the
+	// shard dimension, unlike the group-scoped pipeline counters above: the
+	// deletion bound they report against is per shard (spec section 5.2), so
+	// without seg/shard an operator can see that a group is under-deleting but not
+	// where. Both are deleted per tsTable in deleteMetrics, so their cardinality is
+	// bounded by live segments rather than growing with rotation.
+	pipelineTracesRetainedByCeiling meter.Counter
+	pipelineMergesCeilingReached    meter.Counter
+	// pipelineDropSetBudgetBytes is the resolved ceiling every merge in this group
+	// is charged. It is the denominator for the two counters above: without it a
+	// dashboard cannot tell a capped merge from a merge that had room to spare.
+	pipelineDropSetBudgetBytes meter.Gauge
+	// pipelineDropSetEntries distributes the dropped-ID count each merge finished
+	// with, so headroom is observable *before* the ceiling is reached. The counters
+	// above only fire once deletion has already been lost, which makes them a
+	// lagging indicator on their own.
+	pipelineDropSetEntries meter.Histogram
 
 	tbMetrics
 }
 
+// dropSetEntryBuckets spans a single dropped trace ID to well past the ceiling a
+// 16 GiB node derives (~671k entries, spec section 3.4), so a dashboard can watch
+// the distribution climb toward whatever ceiling resolveDropSetBudget produced.
+var dropSetEntryBuckets = meter.Buckets{
+	1, 100, 1_000, 10_000, 50_000, 100_000, 250_000, 500_000, 1_000_000, 2_000_000,
+}
+
 func (tst *tsTable) incTotalWritten(delta int) {
 	if tst == nil || tst.metrics == nil {
 		return
@@ -330,6 +354,38 @@ func (tst *tsTable) incPipelineTracesRetained(delta int) {
 	tst.metrics.pipelineTracesRetained.Inc(float64(delta))
 }
 
+// incPipelineTracesRetainedByCeiling counts a trace retained because the
+// merge's drop-set ceiling was reached, distinct from retained-by-verdict.
+// Every such trace also increments incPipelineTracesRetained.
+func (tst *tsTable) incPipelineTracesRetainedByCeiling(delta int) {
+	if tst == nil || tst.metrics == nil {
+		return
+	}
+	tst.metrics.pipelineTracesRetainedByCeiling.Inc(float64(delta), tst.p.ShardLabelValues()...)
+}
+
+// incPipelineMergesCeilingReached counts one merge whose drop-set ceiling was
+// reached, split by lane.
+func (tst *tsTable) incPipelineMergesCeilingReached(lane string) {
+	if tst == nil || tst.metrics == nil {
+		return
+	}
+	tst.metrics.pipelineMergesCeilingReached.Inc(1, append(tst.p.ShardLabelValues(), lane)...)
+}
+
+// observeDropSetUsage publishes what one merge's drop set cost against the
+// ceiling it was charged: the resolved budget as a gauge, and the number of IDs
+// the merge finished holding as a distribution. Called once per merge, for capped
+// and uncapped merges alike — an uncapped observation is what makes headroom
+// visible before the ceiling bites.
+func (tst *tsTable) observeDropSetUsage(budget uint64, entries int, lane string) {
+	if tst == nil || tst.metrics == nil || budget == 0 {
+		return
+	}
+	tst.metrics.pipelineDropSetBudgetBytes.Set(float64(budget))
+	tst.metrics.pipelineDropSetEntries.Observe(float64(entries), append(tst.p.ShardLabelValues(), lane)...)
+}
+
 //nolint:unused
 func (tst *tsTable) incPipelineTracesImmature(delta int) {
 	if tst == nil || tst.metrics == nil {
@@ -488,6 +544,10 @@ func (m *metrics) DeleteAll() {
 	m.pipelineGuardPublicationRejected.Delete()
 	m.pipelineGuardLosslessRetry.Delete()
 	m.pipelineGuardBypassed.Delete()
+	m.pipelineDropSetBudgetBytes.Delete()
+	// The ceiling counters and the entry histogram are shard-labeled, so they are
+	// deleted per tsTable in deleteMetrics rather than here — a group-level Delete()
+	// with no label values would not match their series.
 }
 
 func (s *supplier) newMetrics(p common.Position) storage.Metrics {
@@ -537,6 +597,11 @@ func (s *supplier) newMetrics(p common.Position) storage.Metrics {
 		pipelineGuardPublicationRejected: factory.NewCounter("pipeline_guard_publication_rejected"),
 		pipelineGuardLosslessRetry:       factory.NewCounter("pipeline_guard_lossless_retry"),
 		pipelineGuardBypassed:            factory.NewCounter("pipeline_guard_bypassed"),
+		pipelineTracesRetainedByCeiling:  factory.NewCounter("pipeline_traces_retained_by_ceiling", common.ShardLabelNames()...),
+		pipelineMergesCeilingReached:     factory.NewCounter("pipeline_merges_ceiling_reached", append(common.ShardLabelNames(), "lane")...),
+		pipelineDropSetBudgetBytes:       factory.NewGauge("pipeline_drop_set_budget_bytes"),
+		pipelineDropSetEntries: factory.NewHistogram("pipeline_drop_set_entries", dropSetEntryBuckets,
+			append(common.ShardLabelNames(), "lane")...),
 		tbMetrics: tbMetrics{
 			totalMemParts:                  factory.NewGauge("total_mem_part", common.ShardLabelNames()...),
 			totalMemElements:               factory.NewGauge("total_mem_elements", common.ShardLabelNames()...),
@@ -602,6 +667,11 @@ func (qs *queueSupplier) newMetrics(p common.Position) (storage.Metrics, observa
 		pipelineGuardPublicationRejected: factory.NewCounter("pipeline_guard_publication_rejected"),
 		pipelineGuardLosslessRetry:       factory.NewCounter("pipeline_guard_lossless_retry"),
 		pipelineGuardBypassed:            factory.NewCounter("pipeline_guard_bypassed"),
+		pipelineTracesRetainedByCeiling:  factory.NewCounter("pipeline_traces_retained_by_ceiling", common.ShardLabelNames()...),
+		pipelineMergesCeilingReached:     factory.NewCounter("pipeline_merges_ceiling_reached", append(common.ShardLabelNames(), "lane")...),
+		pipelineDropSetBudgetBytes:       factory.NewGauge("pipeline_drop_set_budget_bytes"),
+		pipelineDropSetEntries: factory.NewHistogram("pipeline_drop_set_entries", dropSetEntryBuckets,
+			append(common.ShardLabelNames(), "lane")...),
 		tbMetrics: tbMetrics{
 			totalMemParts:                  factory.NewGauge("total_mem_part", common.ShardLabelNames()...),
 			totalMemElements:               factory.NewGauge("total_mem_elements", common.ShardLabelNames()...),
@@ -687,6 +757,15 @@ func (tst *tsTable) deleteMetrics() {
 	tst.metrics.tbMetrics.totalFilePartUncompressedBytes.Delete(tst.p.ShardLabelValues()...)
 	tst.metrics.tbMetrics.pendingDataCount.Delete(tst.p.ShardLabelValues()...)
 	tst.metrics.tbMetrics.mergeQuarantinedParts.Delete(tst.p.ShardLabelValues()...)
+	tst.metrics.pipelineTracesRetainedByCeiling.Delete(tst.p.ShardLabelValues()...)
+	// Mem merges carry an empty lane label (flusher.go passes ""), so that series
+	// needs deleting too, exactly as the "mem" rows in DeleteAll do for the
+	// totalMerge* families.
+	for _, lane := range []string{"", mergeLaneFast, mergeLaneSlow, mergeLaneFinalize} {
+		laneValues := append(tst.p.ShardLabelValues(), lane)
+		tst.metrics.pipelineMergesCeilingReached.Delete(laneValues...)
+		tst.metrics.pipelineDropSetEntries.Delete(laneValues...)
+	}
 	tst.metrics.indexMetrics.DeleteAll(tst.p.SegLabelValues()...)
 }
 
diff --git a/banyand/trace/pipeline_chain.go b/banyand/trace/pipeline_chain.go
index 90d02d7a4..dde18d9fb 100644
--- a/banyand/trace/pipeline_chain.go
+++ b/banyand/trace/pipeline_chain.go
@@ -22,6 +22,9 @@ import (
 	"sync"
 	"time"
 
+	internalencoding "github.com/apache/skywalking-banyandb/banyand/internal/encoding"
+	pkgbytes "github.com/apache/skywalking-banyandb/pkg/bytes"
+	"github.com/apache/skywalking-banyandb/pkg/convert"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
 	"github.com/apache/skywalking-banyandb/pkg/pipeline/sdk"
 )
@@ -256,98 +259,181 @@ func (mc *mergeChain) runChain(batch *sdk.TraceBatch, observation *mergeEvaluati
 	return sdk.EvaluateChainInto(mc.samplers, batch, decisionMask, onBypass)
 }
 
-// assembleTraceBlock builds a COPY-backed sdk.TraceBlock from a loaded merge
-// block, name-selecting only the columns named in proj. Every returned slice is
-// owned by the block (deep-copied from the engine's pooled buffers) so the merge
-// loop may recycle/overwrite those buffers while an abandoned Decide goroutine
-// still reads the block.
-func assembleTraceBlock(traceID string, bp *blockPointer, proj sdk.Projection) sdk.TraceBlock {
-	tb := sdk.TraceBlock{
-		TraceID: traceID,
-		MinTS:   bp.bm.timestamps.min,
-		MaxTS:   bp.bm.timestamps.max,
-	}
-	if len(proj.Tags) > 0 {
-		for _, name := range proj.Tags {
-			for i := range bp.block.tags {
-				if decodeTypedTag(bp.block.tags[i].name) != name {
-					continue
-				}
-				src := bp.block.tags[i].values
-				values := make([][]byte, len(src))
-				for j, v := range src {
-					if v != nil {
-						values[j] = append([]byte(nil), v...)
-					}
-				}
-				tb.Tags = append(tb.Tags, sdk.TagColumn{
-					Name:      name,
-					Values:    values,
-					ValueType: bp.block.tags[i].valueType,
-				})
-				break
+func projectionRequiresSlowPath(projection sdk.Projection) bool {
+	return len(projection.Tags) > 0 || projection.SpanIDs || projection.Spans
+}
+
+func projectedRawTagName(metadata *blockMetadata, projectedName string) (string, bool) {
+	if _, exists := metadata.tags[projectedName]; exists {
+		return projectedName, true
+	}
+	selectedName := ""
+	for encodedName := range metadata.tags {
+		if decodeTypedTag(encodedName) == projectedName && (selectedName == "" || encodedName < selectedName) {
+			selectedName = encodedName
+		}
+	}
+	return selectedName, selectedName != ""
+}
+
+func appendProjectedTraceBlock(vectors *stagedEvaluationVectors, traceID string, minTS, maxTS int64, source *block,
+	projection sdk.Projection,
+) sdk.TraceBlock {
+	arenaSize := 0
+	for _, projectedName := range projection.Tags {
+		for tagIdx := range source.tags {
+			sourceTag := &source.tags[tagIdx]
+			if decodeTypedTag(sourceTag.name) != projectedName {
+				continue
+			}
+			for _, value := range sourceTag.values {
+				arenaSize += len(value)
 			}
+			break
 		}
 	}
-	if proj.SpanIDs {
-		spanIDs := make([]string, len(bp.block.spanIDs))
-		copy(spanIDs, bp.block.spanIDs)
-		tb.SpanIDs = spanIDs
+	if projection.Spans {
+		for _, span := range source.spans {
+			arenaSize += len(span)
+		}
+	}
+	if projection.SpanIDs {
+		for _, spanID := range source.spanIDs {
+			arenaSize += len(spanID)
+		}
+	}
+	var arena *pkgbytes.Buffer
+	if arenaSize > 0 {
+		arena = acquireStagedByteArena(arenaSize)
+		vectors.projectionArenas = append(vectors.projectionArenas, arena)
+	}
+	offset := 0
+	copyBytes := func(sourceBytes []byte) []byte {
+		if sourceBytes == nil {
+			return nil
+		}
+		if len(sourceBytes) == 0 {
+			return []byte{}
+		}
+		target := arena.Buf[offset : offset+len(sourceBytes) : offset+len(sourceBytes)]
+		copy(target, sourceBytes)
+		offset += len(sourceBytes)
+		return target
 	}
-	if proj.Spans {
-		spans := make([][]byte, len(bp.block.spans))
-		for i, s := range bp.block.spans {
-			if s != nil {
-				spans[i] = append([]byte(nil), s...)
+	traceBlock := sdk.TraceBlock{TraceID: traceID, MinTS: minTS, MaxTS: maxTS}
+	columnStart := len(vectors.tagColumns)
+	for _, projectedName := range projection.Tags {
+		for tagIdx := range source.tags {
+			sourceTag := &source.tags[tagIdx]
+			if decodeTypedTag(sourceTag.name) != projectedName {
+				continue
+			}
+			valueStart := len(vectors.tagValues)
+			for _, value := range sourceTag.values {
+				vectors.tagValues = append(vectors.tagValues, copyBytes(value))
 			}
+			values := vectors.tagValues[valueStart:len(vectors.tagValues):len(vectors.tagValues)]
+			vectors.tagColumns = append(vectors.tagColumns, sdk.TagColumn{
+				Name: projectedName, ValueType: sourceTag.valueType, Values: values,
+			})
+			break
 		}
-		tb.Spans = spans
 	}
-	return tb
+	traceBlock.Tags = vectors.tagColumns[columnStart:len(vectors.tagColumns):len(vectors.tagColumns)]
+	if projection.SpanIDs {
+		spanIDStart := len(vectors.spanIDs)
+		for _, spanID := range source.spanIDs {
+			vectors.spanIDs = append(vectors.spanIDs, convert.BytesToString(copyBytes(convert.StringToBytes(spanID))))
+		}
+		traceBlock.SpanIDs = vectors.spanIDs[spanIDStart:len(vectors.spanIDs):len(vectors.spanIDs)]
+	}
+	if projection.Spans {
+		spanStart := len(vectors.spans)
+		for _, span := range source.spans {
+			vectors.spans = append(vectors.spans, copyBytes(span))
+		}
+		traceBlock.Spans = vectors.spans[spanStart:len(vectors.spans):len(vectors.spans)]
+	}
+	return traceBlock
 }
 
-func projectionRequiresSlowPath(projection sdk.Projection) bool {
-	return len(projection.Tags) > 0 || projection.SpanIDs || projection.Spans
+func assembleRawTraceBlockInto(vectors *stagedEvaluationVectors, stagedBlock *stagedTrace, projection sdk.Projection) (sdk.TraceBlock, bool) {
+	metadata := stagedBlock.rawBM
+	if metadata == nil || metadata.traceID != stagedBlock.traceID || !metadata.timestamps.known || metadata.timestamps.min > metadata.timestamps.max {
+		return sdk.TraceBlock{}, false
+	}
+	decoder := generateColumnValuesDecoder()
+	defer releaseColumnValuesDecoder(decoder)
+	projectedBlock := block{minTS: metadata.timestamps.min, maxTS: metadata.timestamps.max}
+	if len(projection.Tags) > 0 {
+		for _, projectedName := range projection.Tags {
+			encodedName, exists := projectedRawTagName(metadata, projectedName)
+			if !exists {
+				continue
+			}
+			valueType := metadata.tagType[encodedName]
+			encodedValues, exists := stagedBlock.rawTags[encodedName]
+			if !exists {
+				return sdk.TraceBlock{}, false
+			}
+			valueBuffer := pkgbytes.Buffer{Buf: encodedValues}
+			values, decodeErr := internalencoding.DecodeTagValues(nil, decoder, &valueBuffer, valueType, int(metadata.count))
+			if decodeErr != nil {
+				return sdk.TraceBlock{}, false
+			}
+			projectedBlock.tags = append(projectedBlock.tags, tag{name: projectedName, valueType: valueType, values: values})
+		}
+	}
+	if projection.SpanIDs || projection.Spans {
+		spanIDBytes, spanTail, decodeErr := decoder.DecodeWithTail(nil, stagedBlock.rawSpans, metadata.count)
+		if decodeErr != nil {
+			return sdk.TraceBlock{}, false
+		}
+		if projection.SpanIDs {
+			projectedBlock.spanIDs = make([]string, len(spanIDBytes))
+			for spanIdx, spanID := range spanIDBytes {
+				projectedBlock.spanIDs[spanIdx] = convert.BytesToString(spanID)
+			}
+		}
+		if projection.Spans {
+			spans, spansErr := decoder.Decode(nil, spanTail, metadata.count)
+			if spansErr != nil {
+				return sdk.TraceBlock{}, false
+			}
+			projectedBlock.spans = spans
+		}
+	}
+	return appendProjectedTraceBlock(vectors, stagedBlock.traceID, metadata.timestamps.min, metadata.timestamps.max, &projectedBlock, projection), true
 }
 
-func assembleStagedTraceBlock(group stagedTraceGroup, staged []stagedTrace, projection sdk.Projection) (sdk.TraceBlock, bool) {
+func assembleStagedTraceBlockInto(vectors *stagedEvaluationVectors, group stagedTraceGroup, staged []stagedTrace,
+	projection sdk.Projection,
+) (sdk.TraceBlock, bool) {
 	if group.traceID == "" || len(staged) == 0 || !group.validMetadata || group.minTS > group.maxTS {
 		return sdk.TraceBlock{}, false
 	}
-	requiresSlowPath := projectionRequiresSlowPath(projection)
-	if !requiresSlowPath {
+	if !projectionRequiresSlowPath(projection) {
 		return sdk.TraceBlock{TraceID: group.traceID, MinTS: group.minTS, MaxTS: group.maxTS}, true
 	}
+	if len(staged) == 1 && staged[0].isRaw {
+		return assembleRawTraceBlockInto(vectors, &staged[0], projection)
+	}
 	aggregate := generateBlockPointer()
 	defer releaseBlockPointer(aggregate)
 	aggregate.bm.traceID = group.traceID
 	for stagedIdx := range staged {
 		stagedBlock := &staged[stagedIdx]
-		if stagedBlock.traceID != group.traceID {
+		if stagedBlock.traceID != group.traceID || stagedBlock.isRaw || stagedBlock.slowBlock == nil {
 			return sdk.TraceBlock{}, false
 		}
-		var metadata *blockMetadata
-		switch {
-		case stagedBlock.isRaw:
-			return sdk.TraceBlock{}, false
-		case stagedBlock.slowBlock != nil:
-			metadata = &stagedBlock.slowBlock.bm
-			aggregate.appendAll(stagedBlock.slowBlock)
-		default:
-			return sdk.TraceBlock{}, false
-		}
-		if metadata.traceID != group.traceID || !metadata.timestamps.known ||
-			metadata.timestamps.min > metadata.timestamps.max {
+		metadata := &stagedBlock.slowBlock.bm
+		if metadata.traceID != group.traceID || !metadata.timestamps.known || metadata.timestamps.min > metadata.timestamps.max {
 			return sdk.TraceBlock{}, false
 		}
+		aggregate.appendAll(stagedBlock.slowBlock)
 	}
 	if aggregate.Len() == 0 || aggregate.timestampBoundsUnknown {
 		return sdk.TraceBlock{}, false
 	}
-	aggregate.bm.timestamps = timestampsMetadata{
-		min:   group.minTS,
-		max:   group.maxTS,
-		known: true,
-	}
-	return assembleTraceBlock(group.traceID, aggregate, projection), true
+	return appendProjectedTraceBlock(vectors, group.traceID, group.minTS, group.maxTS, &aggregate.block, projection), true
 }
diff --git a/banyand/trace/pipeline_chain_filter_test.go b/banyand/trace/pipeline_chain_filter_test.go
index c6c157c16..258ae0d08 100644
--- a/banyand/trace/pipeline_chain_filter_test.go
+++ b/banyand/trace/pipeline_chain_filter_test.go
@@ -451,7 +451,8 @@ func TestInMergeFilter_Instant_Standalone(t *testing.T) {
 // chunked path yields the same drop/keep outcome as a single-batch flush and
 // keeps each surviving trace's span payload intact across chunk boundaries,
 // guarding the per-chunk deep-copy lifetime, the ascending-order write
-// requirement, and the cross-chunk droppedSet that drives sidx pruning.
+// requirement, and the cross-chunk exact dropped-ID collector that drives SIDX
+// pruning.
 func TestInMergeFilter_ChunkedStaging_TinyBudget(t *testing.T) {
 	// Force a 1-byte staging budget so a chunk flushes at every trace boundary
 	// (one trace per chunk) — the maximal-churn case. testStageBudgetOverride is
diff --git a/banyand/trace/pipeline_chain_test.go b/banyand/trace/pipeline_chain_test.go
index bc8d6d5e3..5a203526e 100644
--- a/banyand/trace/pipeline_chain_test.go
+++ b/banyand/trace/pipeline_chain_test.go
@@ -20,6 +20,7 @@ package trace
 import (
 	"fmt"
 	"runtime"
+	"sort"
 	"sync/atomic"
 	"testing"
 	"time"
@@ -27,7 +28,10 @@ import (
 
 	"github.com/stretchr/testify/require"
 
+	internalencoding "github.com/apache/skywalking-banyandb/banyand/internal/encoding"
+	pkgbytes "github.com/apache/skywalking-banyandb/pkg/bytes"
 	"github.com/apache/skywalking-banyandb/pkg/convert"
+	"github.com/apache/skywalking-banyandb/pkg/encoding"
 	"github.com/apache/skywalking-banyandb/pkg/fs"
 	pbv1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
 	"github.com/apache/skywalking-banyandb/pkg/pipeline/sdk"
@@ -60,6 +64,27 @@ type durationEnvelopeSampler struct {
 	maxTS     atomic.Int64
 }
 
+type blockingProjectionSampler struct {
+	entered  chan struct{}
+	release  chan struct{}
+	observed chan string
+}
+
+func (s *blockingProjectionSampler) Kind() sdk.Kind { return sdk.KindSampler }
+
+func (s *blockingProjectionSampler) Project() sdk.Projection {
+	return sdk.Projection{Tags: []string{"status"}, Spans: true}
+}
+
+func (s *blockingProjectionSampler) Close() error { return nil }
+
+func (s *blockingProjectionSampler) Decide(batch *sdk.TraceBatch) (sdk.Verdict, error) {
+	close(s.entered)
+	<-s.release
+	s.observed <- string(batch.Traces[0].Tags[0].Values[0]) + "/" + string(batch.Traces[0].Spans[0])
+	return sdk.Verdict{Keep: []bool{true}}, nil
+}
+
 func (s *durationEnvelopeSampler) Kind() sdk.Kind          { return sdk.KindSampler }
 func (s *durationEnvelopeSampler) Project() sdk.Projection { return sdk.Projection{} }
 func (s *durationEnvelopeSampler) Close() error            { return nil }
@@ -169,6 +194,14 @@ func mergeWithFilter(t *testing.T, parts []*traces, filter *mergeFilter) ([]stri
 
 	pm, tf, tagTypes, dropped, err := mergeBlocks(closeCh, bw, br, nil, filter)
 	require.NoError(t, err)
+	var droppedSet map[string]struct{}
+	if dropped != nil {
+		droppedSet = make(map[string]struct{}, dropped.len())
+		for _, traceID := range dropped.ids {
+			droppedSet[traceID] = struct{}{}
+		}
+		releaseDroppedTraceIDs(dropped)
+	}
 	releaseBlockWriter(bw)
 	releaseBlockReader(br)
 	for _, iter := range pmi {
@@ -192,7 +225,7 @@ func mergeWithFilter(t *testing.T, parts []*traces, filter *mergeFilter) ([]stri
 	require.NoError(t, reader.error())
 	releaseBlockReader(reader)
 	releasePartMergeIter(mergedIter)
-	return got, dropped
+	return got, droppedSet
 }
 
 func singleTraceParts(ids []string) []*traces {
@@ -241,6 +274,47 @@ func appendTrace(parts []*traces, traceID, status string) []*traces {
 	return parts
 }
 
+func projectedSingleTraceParts(statuses map[string]string) []*traces {
+	parts := make([]*traces, 0, len(statuses))
+	traceIDs := make([]string, 0, len(statuses))
+	for traceID := range statuses {
+		traceIDs = append(traceIDs, traceID)
+	}
+	sort.Strings(traceIDs)
+	for _, traceID := range traceIDs {
+		parts = append(parts, &traces{
+			traceIDs:   []string{traceID},
+			timestamps: []int64{1},
+			tags: [][]*tagValue{{
+				{tag: "status", valueType: pbv1.ValueTypeStr, value: convert.StringToBytes(statuses[traceID])},
+				{tag: "unrequested", valueType: pbv1.ValueTypeStr, value: convert.StringToBytes("ignored")},
+			}},
+			spans:   [][]byte{[]byte("span-" + traceID)},
+			spanIDs: []string{"span-" + traceID},
+		})
+	}
+	return parts
+}
+
+func TestMergeFilter_ProjectsUniqueRawTraceWithoutSlowMerge(t *testing.T) {
+	sampler := &wholeTraceErrorSampler{}
+	filter := &mergeFilter{
+		chain:   newMergeChain("g", "s", []sdk.Sampler{sampler}, 0),
+		timeout: time.Second,
+	}
+
+	got, dropped := mergeWithFilter(t, projectedSingleTraceParts(map[string]string{
+		"trace-error": "error",
+		"trace-ok":    "success",
+	}), filter)
+
+	require.Equal(t, []string{"trace-error"}, got)
+	require.Equal(t, map[string]struct{}{"trace-ok": {}}, dropped)
+	require.Equal(t, int64(1), sampler.calls.Load())
+	require.Equal(t, int64(2), sampler.traceCount.Load())
+	require.Equal(t, int64(2), sampler.rowCount.Load())
+}
+
 func TestMergeFilter_AssemblesEveryPhysicalBlockBeforeDecide(t *testing.T) {
 	sampler := &wholeTraceErrorSampler{}
 	chain := newMergeChain("g", "s", []sdk.Sampler{sampler}, 0)
@@ -432,6 +506,49 @@ func TestTraceEvaluationStagerReservesProjectedEvaluationCopies(t *testing.T) {
 		"the budget must reserve transient TraceBlock vectors and copied projected values")
 }
 
+func TestRawProjectionBudgetCoversSparseColumnsAndDecodedPayload(t *testing.T) {
+	tagBuffer := pkgbytes.Buffer{}
+	_, encodeErr := internalencoding.EncodeTagValues(&tagBuffer, [][]byte{[]byte("error")}, pbv1.ValueTypeStr)
+	require.NoError(t, encodeErr)
+	spanID := []byte("a-compressible-span-id-a-compressible-span-id")
+	span := []byte("span-body")
+	encodedSpans := encoding.EncodeBytesBlock(nil, [][]byte{spanID})
+	encodedSpans = encoding.EncodeBytesBlock(encodedSpans, [][]byte{span})
+	stagedBlock := stagedTrace{
+		isRaw: true, traceID: "trace-projected", rawBM: &blockMetadata{
+			traceID: "trace-projected", count: 1, spans: &dataBlock{},
+			timestamps: timestampsMetadata{min: 1, max: 2, known: true},
+			tags:       map[string]*dataBlock{"status": {}}, tagType: map[string]pbv1.ValueType{"status": pbv1.ValueTypeStr},
+		},
+		rawTags: map[string][]byte{"status": tagBuffer.Buf}, rawSpans: encodedSpans,
+	}
+	projection := sdk.Projection{Tags: []string{"missing-a", "status", "missing-b"}, SpanIDs: true, Spans: true}
+	charged := stagedBlock.approxEvaluationBytes(projection)
+	vectors := &stagedEvaluationVectors{}
+	prepareStagedProjectionVectors(vectors, []stagedTrace{stagedBlock}, []stagedTraceGroup{{
+		traceID: "trace-projected", start: 0, end: 1, minTS: 1, maxTS: 2, validMetadata: true,
+	}}, projection)
+	assembled, valid := assembleRawTraceBlockInto(vectors, &stagedBlock, projection)
+	require.True(t, valid)
+	defer func() {
+		for _, arena := range vectors.projectionArenas {
+			releaseStagedByteArena(arena)
+		}
+	}()
+	require.Equal(t, spanID, []byte(assembled.SpanIDs[0]))
+	require.Equal(t, span, assembled.Spans[0])
+
+	actual := uint64(cap(vectors.tagColumns))*uint64(unsafe.Sizeof(sdk.TagColumn{})) +
+		uint64(cap(vectors.tagValues))*uint64(unsafe.Sizeof([]byte{})) +
+		uint64(cap(vectors.spanIDs))*uint64(unsafe.Sizeof("")) +
+		uint64(cap(vectors.spans))*uint64(unsafe.Sizeof([]byte{}))
+	for _, arena := range vectors.projectionArenas {
+		actual += uint64(len(arena.Buf))
+	}
+	require.GreaterOrEqual(t, charged, actual,
+		"the hard staging estimate must cover sparse projection vectors and decoded span-ID, span, and tag bytes")
+}
+
 func TestMergeFilter_TraceCountBudgetBoundsDecideBatch(t *testing.T) {
 	sampler := &wholeTraceErrorSampler{}
 	filter := &mergeFilter{
@@ -545,6 +662,74 @@ func TestEvaluationVectorPoolDiscardsUnsafeAndOversizedBatches(t *testing.T) {
 	require.Empty(t, reusableVectors.decisionMask)
 }
 
+func projectedStagedTrace(traceID, status, span string) ([]stagedTrace, []stagedTraceGroup) {
+	block := &blockPointer{}
+	block.bm.traceID = traceID
+	block.bm.count = 1
+	block.bm.timestamps = timestampsMetadata{min: 1, max: 2, known: true}
+	block.block.minTS = 1
+	block.block.maxTS = 2
+	block.block.spanIDs = []string{"span-id"}
+	block.block.spans = [][]byte{[]byte(span)}
+	block.block.tags = []tag{{name: "status", valueType: pbv1.ValueTypeStr, values: [][]byte{[]byte(status)}}}
+	return []stagedTrace{{traceID: traceID, slowBlock: block}}, []stagedTraceGroup{{
+		traceID: traceID, start: 0, end: 1, minTS: 1, maxTS: 2, validMetadata: true,
+	}}
+}
+
+func TestStagedEvaluationBatchPacksProjectedPayloadIntoArena(t *testing.T) {
+	staged, groups := projectedStagedTrace("trace-arena", "error", "span-body")
+	filter := &mergeFilter{chain: newMergeChain("g", "s", []sdk.Sampler{&fakeSampler{proj: sdk.Projection{
+		Tags: []string{"status"}, SpanIDs: true, Spans: true,
+	}}}, 0)}
+	defer filter.chain.close()
+
+	assembled, valid := assembleStagedEvaluationBatch(filter, staged, groups)
+	require.True(t, valid)
+	require.Len(t, assembled.vectors.projectionArenas, 1)
+	require.Len(t, assembled.vectors.traceBlocks, 1)
+	traceBlock := &assembled.vectors.traceBlocks[0]
+	require.Equal(t, []byte("error"), traceBlock.Tags[0].Values[0])
+	require.Equal(t, []byte("span-body"), traceBlock.Spans[0])
+	require.Equal(t, "span-id", traceBlock.SpanIDs[0])
+
+	staged[0].slowBlock.block.tags[0].values[0][0] = 'X'
+	staged[0].slowBlock.block.spans[0][0] = 'X'
+	staged[0].slowBlock.block.spanIDs[0] = "changed"
+	require.Equal(t, []byte("error"), traceBlock.Tags[0].Values[0])
+	require.Equal(t, []byte("span-body"), traceBlock.Spans[0])
+	require.Equal(t, "span-id", traceBlock.SpanIDs[0])
+	require.True(t, releaseStagedEvaluationVectors(assembled.vectors, true))
+}
+
+func TestTimedOutProjectionBatchNeverRecyclesArena(t *testing.T) {
+	sampler := &blockingProjectionSampler{
+		entered: make(chan struct{}), release: make(chan struct{}), observed: make(chan string, 1),
+	}
+	filter := &mergeFilter{
+		chain: newMergeChain("g", "s", []sdk.Sampler{sampler}, 0), timeout: 10 * time.Millisecond,
+	}
+	defer filter.chain.close()
+	staged, groups := projectedStagedTrace("trace-timeout", "error", "span-body")
+	assembled, valid := assembleStagedEvaluationBatch(filter, staged, groups)
+	require.True(t, valid)
+
+	tracker := &dropTracker{}
+	_, reusable := resolveStagedDrops(filter, staged, assembled, tracker)
+	require.Nil(t, tracker.exact)
+	require.False(t, reusable)
+	<-sampler.entered
+	require.False(t, releaseStagedEvaluationVectors(assembled.vectors, reusable))
+
+	replacement := acquireStagedByteArena(len("error") + len("span-body"))
+	for byteIdx := range replacement.Buf {
+		replacement.Buf[byteIdx] = 'X'
+	}
+	releaseStagedByteArena(replacement)
+	close(sampler.release)
+	require.Equal(t, "error/span-body", <-sampler.observed)
+}
+
 func TestStagedByteArenaCacheBoundsAggregateRetention(t *testing.T) {
 	poolName := fmt.Sprintf("trace-test-staged-byte-arena-%d", stagedByteArenaTestPoolID.Add(1))
 	cache := newStagedByteArenaPool(poolName, 8)
@@ -810,9 +995,9 @@ func (s *sleepSampler) Decide(batch *sdk.TraceBatch) (sdk.Verdict, error) {
 }
 
 func TestMergeFilter_CoupledSidxPrune(t *testing.T) {
-	// Verify the keepFn constructed from dropped set (as merger.go does) correctly
-	// filters sidx-encoded data: retained traces pass, dropped trace is filtered,
-	// corrupt data is fail-open.
+	// Verify the compact exact lookup used by the merger filters SIDX-encoded
+	// data: retained traces pass, dropped traces are filtered, and corrupt data
+	// fails open.
 	filter := &mergeFilter{
 		chain:   newTestChain(map[string]struct{}{"traceB": {}}),
 		timeout: time.Second,
@@ -820,18 +1005,10 @@ func TestMergeFilter_CoupledSidxPrune(t *testing.T) {
 	_, dropped := mergeWithFilter(t, singleTraceParts([]string{"traceA", "traceB", "traceC"}), filter)
 	require.Contains(t, dropped, "traceB")
 
-	var keepFn func([]byte) bool
-	if len(dropped) > 0 {
-		keepFn = func(data []byte) bool {
-			id, decErr := decodeTraceID(data)
-			if decErr != nil {
-				return true
-			}
-			_, isDropped := dropped[id]
-			return !isDropped
-		}
-	}
-	require.NotNil(t, keepFn)
+	exactDropped := acquireDroppedTraceIDs()
+	t.Cleanup(func() { releaseDroppedTraceIDs(exactDropped) })
+	exactDropped.add("traceB")
+	keepFn := exactDropped.keepEncoded
 
 	encodeID := func(id string) []byte { return append([]byte{byte(idFormatV1)}, []byte(id)...) }
 
diff --git a/banyand/trace/pipeline_metrics.go b/banyand/trace/pipeline_metrics.go
index f27b675d0..8a2087087 100644
--- a/banyand/trace/pipeline_metrics.go
+++ b/banyand/trace/pipeline_metrics.go
@@ -50,6 +50,16 @@ type samplerMetrics struct {
 	// pluginTelemetryPanicTotal{group,plugin_name} counts panics recovered inside
 	// the host telemetry adapter.
 	pluginTelemetryPanicTotal meter.Counter
+	// finalizeRounds{group,shard} and finalizeTerminal{group,shard} publish the
+	// per-shard finalize state that bounds how much a shard can ever delete
+	// (spec section 5.2): once rounds reach max_finalize_rounds the shard is marked
+	// terminal and never sampled again, so any traces the drop-set ceiling spared
+	// are undeleted permanently. They live here, on the scanner-reachable pipeline
+	// factory rather than on the per-group storage metrics, because the scanner
+	// reads this state for every shard — including terminal ones — without
+	// reopening the segment, which is exactly the case that has to stay visible.
+	finalizeRounds   meter.Gauge
+	finalizeTerminal meter.Gauge
 }
 
 // newSamplerMetrics creates a samplerMetrics wired to factory. If factory is
@@ -67,9 +77,27 @@ func newSamplerMetrics(factory observability.Factory) *samplerMetrics {
 		pluginTelemetrySeriesRejectedTotal: factory.NewCounter("plugin_telemetry_series_rejected_total", "group", "plugin_name"),
 		pluginLogDroppedTotal:              factory.NewCounter("plugin_log_dropped_total", "group", "plugin_name"),
 		pluginTelemetryPanicTotal:          factory.NewCounter("plugin_telemetry_panic_total", "group", "plugin_name"),
+		finalizeRounds:                     factory.NewGauge("finalize_rounds", "group", "shard"),
+		finalizeTerminal:                   factory.NewGauge("finalize_terminal", "group", "shard"),
 	}
 }
 
+// observeFinalizeState publishes one shard's finalize round count and terminal
+// flag. Called from the scan pre-filter, which reads this state from disk for
+// every cooled shard on every tick, so a shard that has gone terminal keeps
+// reporting instead of falling silent the moment it stops being finalized.
+func (m *samplerMetrics) observeFinalizeState(group, shard string, rounds int, terminal bool) {
+	if m == nil {
+		return
+	}
+	m.finalizeRounds.Set(float64(rounds), group, shard)
+	terminalValue := float64(0)
+	if terminal {
+		terminalValue = 1
+	}
+	m.finalizeTerminal.Set(terminalValue, group, shard)
+}
+
 func (m *samplerMetrics) setActiveCount(group string, n int) {
 	if m == nil {
 		return
diff --git a/banyand/trace/tag.go b/banyand/trace/tag.go
index 31c612f9b..11db00554 100644
--- a/banyand/trace/tag.go
+++ b/banyand/trace/tag.go
@@ -50,6 +50,13 @@ var (
 		"int_arr": pbv1.ValueTypeInt64Arr,
 		"ts":      pbv1.ValueTypeTimestamp,
 	}
+	typedTagSuffixes = func() []string {
+		suffixes := make([]string, 0, len(suffixToValueType))
+		for suffix := range suffixToValueType {
+			suffixes = append(suffixes, typedTagSeparator+suffix)
+		}
+		return suffixes
+	}()
 )
 
 func encodeTypedTag(name string, vt pbv1.ValueType) string {
@@ -61,18 +68,17 @@ func encodeTypedTag(name string, vt pbv1.ValueType) string {
 }
 
 func decodeTypedTag(key string) string {
-	for suffix := range suffixToValueType {
-		sepSuffix := typedTagSeparator + suffix
-		if strings.HasSuffix(key, sepSuffix) {
-			return key[:len(key)-len(sepSuffix)]
+	for _, suffix := range typedTagSuffixes {
+		if strings.HasSuffix(key, suffix) {
+			return key[:len(key)-len(suffix)]
 		}
 	}
 	return key
 }
 
 func hasTypeSuffix(key string) bool {
-	for suffix := range suffixToValueType {
-		if strings.HasSuffix(key, typedTagSeparator+suffix) {
+	for _, suffix := range typedTagSuffixes {
+		if strings.HasSuffix(key, suffix) {
 			return true
 		}
 	}
diff --git a/docs/design/post-trace-pipeline.md b/docs/design/post-trace-pipeline.md
index c3ed731b1..0dbbf3ff5 100644
--- a/docs/design/post-trace-pipeline.md
+++ b/docs/design/post-trace-pipeline.md
@@ -466,7 +466,29 @@ Below are two operational scenarios represented as complete `TracePipelineConfig
 }
 ```
 
-> Each plugin link's `config` is a structured `google.protobuf.Struct` set directly in the pipeline config (not an opaque blob); the engine does not interpret its keys — it serializes the object to JSON and hands the bytes to the plugin's constructor, which unmarshals them into its own typed config. The gating chain here is a single `sampler` link whose `Project()` returns `Projection{ Tags: ["start_time", "latency", "is_error", "tags"], SpanIDs: false, Spans: false }`, so the verdict it [...]
+> Each plugin link's `config` is a structured `google.protobuf.Struct` set directly in the pipeline config, not an opaque
+> blob. The engine does not interpret its keys: it serializes the object to JSON and hands the bytes to the plugin's
+> constructor, which unmarshals them into its own typed config.
+>
+> The gating chain here is a single `sampler` link whose `Project()` returns tags `start_time`, `latency`, `is_error`, and
+> `tags`, with `SpanIDs` and `Spans` false. The verdict therefore reads only those tag columns, plus the intrinsic
+> `trace_id`, `MinTS`, and `MaxTS`, and never a span body. For a unique physical trace block, the merge keeps encoded
+> output on its raw-copy path and decodes only these projected columns into an immutable evaluation arena. A trace split
+> across physical blocks still uses the ordinary full decode because compaction must consolidate its output.
+>
+> The searchable tags (`db.type`, `mq.queue`) are **not** separate columns. SkyWalking flattens them into one `tags`
+> string array of `key=value` entries, so every `keepTagRules` entry resolves to that single column. "Keep errors" is
+> satisfied by the projected `is_error` tag rather than by reading spans. The duration test is the trace envelope
+> `max(start_time + latency) - min(start_time)`, computed from two cheap tag columns. It does **not** use
+> `MaxTS - MinTS`, which is the spread of per-row *start* timestamps (and zero for a single-segment trace), not a duration.
+>
+> The `sw-trace-sampler.so` link is implemented at
+> [`plugins/skywalking/sw-trace-sampler`](../../plugins/skywalking/sw-trace-sampler). A teaching example of the same SDK
+> contract lives at
+> [`pkg/pipeline/sdk/_example/segment-tail-sampler`](../../pkg/pipeline/sdk/_example/segment-tail-sampler) (§2.5). Each
+> `StageRule.plugins` chain has the same shape: one shared sampler whose config tightens from Hot (`durationThresholdMs`
+> 100, `keepErrors`, and the `db.type` plus `mq.queue` keep-tag rules) to Warm (`keepErrors` only), with each link projecting
+> only the tags its config references and keeping `Spans` false.
 
 - **Retention Dynamics** (real `sw_trace` traces; gating runs in Hot, owned by the gating chain; per-stage retention owned by each stage's `plugins` chain):
 
diff --git a/docs/design/trace-drop-set-bounding-plan.md b/docs/design/trace-drop-set-bounding-plan.md
new file mode 100644
index 000000000..91c814ca2
--- /dev/null
+++ b/docs/design/trace-drop-set-bounding-plan.md
@@ -0,0 +1,391 @@
+# Trace Merge Drop-Set Bounding — Execution Plan
+
+Execution plan for [trace-drop-set-bounding.md](trace-drop-set-bounding.md). That document holds the rationale,
+measurements, and rejected alternatives; this one holds the work. Read the spec's sections 3 and 5 before starting any
+ticket.
+
+## Status
+
+DS-1, DS-1b, DS-2, DS-3, DS-4 and DS-5 are implemented, plus the production instruments of spec §6. The ceiling is
+active on every merge.
+
+Outstanding:
+
+- **DS-5's validation has not been executed.** It now rides the Phase 10 SkyWalking acceptance workload as two runs — one
+  at default settings for the headroom measurement, one at `--allowed-bytes=256MiB` to exercise the capped path. Until
+  both produce reports the ticket is code-complete but not closed, and the memory bound rests on unit-level residency
+  checks. This is the one item that gates calling the series done.
+- **DS-9** (arena-backed IDs) not started. Optional, but it raises the ceiling ~24% and so improves the deletion bound
+  DS-5's validation runs will measure — worth landing before those runs rather than after.
+- **DS-11** (documentation) not started.
+
+## Shape of the work
+
+Eight tickets. One PR each; CI runs on pull requests, not on pushes.
+
+The series is deliberately small. A finalize round is treated as one more merge, so nothing touches
+`banyand/trace/finalize_state.go`, `banyand/trace/finalize_scanner.go`, the round scheduling, or any query path. The four
+features that would recover the deletion bounded by spec §5.2 are deferred, listed at the end of this document as
+prospective tickets with their prerequisites.
+
+**The mechanism lands inert.** DS-3 wires the ceiling into the decision loop while the production budget stays zero,
+which `dropTracker` treats as unlimited. Nothing in production behaviour changes until DS-5 activates it. That
+single-ticket activation boundary is the rollback plan for the whole series — revert DS-5 and the mechanism is dormant
+again with no code removed.
+
+```
+DS-1 ──> DS-1b ──> DS-3 ──> DS-4 ──┐
+DS-2 ──────────────────────────────┴──> DS-5 ──> DS-11
+DS-9 (independent, any time after DS-1; best before DS-5)
+```
+
+**Definition of done for every ticket:** its own tests pass; `make lint` clean; the existing `banyand/trace` suite passes
+**unmodified** unless the ticket explicitly lists a test it changes; and the diff touches neither `pkg/query/...` nor the
+two finalize files named above.
+
+## Stage 1 — Mechanism, inert
+
+### DS-1 — `dropTracker` with exact residency accounting
+
+**Size.** S. **Depends on.** Nothing.
+
+**Scope.** A self-contained structure and its arithmetic. No call sites.
+
+- `dropTracker` wrapping the existing `*droppedTraceIDs`, with `canAccept() bool` and a one-way `full` flag.
+- `liveBytes()` extending the pool's existing sizing (`banyand/trace/drop_set.go:35-37`) with the ID-body bytes.
+- `projectedIndexBytes(n int) int64` returning exactly what `buildIndex` will allocate for `n` entries.
+- `maxIDsForBudget(budget uint64) int`, where **`budget == 0` means unlimited** — this is what keeps DS-3 inert. DS-1b
+  adds the observed-ID-length parameter; land the sentinel and the `max(1, …)` clamp here.
+- A residency benchmark reporting bytes per entry.
+
+**Out of scope.** Any change to `merger.go`. Reading the protector. The arena (DS-9).
+
+**Files.** `banyand/trace/drop_set.go`, `banyand/trace/drop_set_test.go`.
+
+**Tests.**
+
+- `TestProjectedIndexBytesMatchesBuildIndex` — for `n` in `{0, 1, 2, 3, 4, 5, 7, 8, 9, 1023, 1024, 1025, 65535, 65536,
+  65537}`, build a real set of `n` IDs, call `buildIndex`, assert `projectedIndexBytes(n) == int64(len(slots))*8`. The
+  power-of-two boundaries are the point: `nextPow2(2n)` is discontinuous and the projection must be exact, not
+  conservative.
+- `TestCanAcceptStopsAtBudget` — for budgets 1 MiB / 8 MiB / 32 MiB, add IDs until `canAccept` is false; assert (a) it
+  never returns true again, (b) `liveBytes() + projectedIndexBytes(len+1)` is at or below the budget at the stop point,
+  (c) `buildIndex` then leaves measured residency at or below the budget.
+- `TestZeroBudgetIsUnlimited` — `maxIDsForBudget(0)` yields a tracker that accepts far past any ceiling.
+- `BenchmarkDropSetResidency` — `b.ReportMetric` bytes per entry at 100 k and 1 M entries, so DS-9 has a baseline.
+
+**Exit.** Projection exact at every tested `n`. Measured residency at or below budget for all three budgets.
+
+**Rollback.** Dead code; safe to leave.
+
+---
+
+### DS-1b — Derive bytes/entry from the observed ID length
+
+**Size.** S. **Depends on.** DS-1.
+
+**Scope.** A fixed bytes/entry constant priced for the 42-byte ID of spec §1.1 lets longer trace IDs overshoot the budget
+proportionally, so the ceiling is not a ceiling (about 1.4x at 96 bytes, 3x at 256). Replace it with a price derived from
+an observed length.
+
+- `allocClassBytes(n)` — round up to the allocator's size-class stride (16 below 256 bytes, 32 above), an upper bound
+  because a ceiling must never under-count.
+- `dropSetBytesPerEntry(idLen)` = header + slack + `allocClassBytes(idLen)` + worst-case slots. At `idLen == 42` this is
+  exactly 100, so the change generalizes the old constant rather than re-tuning it and §3.4's ceilings are unchanged for
+  that case.
+- The tracker carries `budget` instead of a precomputed `maxIDs` and derives `maxIDs` when the first ID is recorded, via
+  a `record` method. Three states stay distinct: `budget == 0` unlimited, `maxIDs == 0` with a non-zero budget "not yet
+  derived, admit the entry that derives it", and the `max(1, …)` clamp keeps a non-zero budget bounding.
+- `record` re-derives if a longer ID appears, so per-shard uniformity is self-correcting rather than load-bearing.
+- `liveBytes` prices bodies with `allocClassBytes` too, so the predicate and the derivation speak in the same units.
+
+**Out of scope.** The arena layout (DS-9), which later replaces only the body term.
+
+**Files.** `banyand/trace/drop_set.go`, `banyand/trace/drop_set_test.go`.
+
+**Tests.**
+
+- `TestBytesPerEntryTracksIDLength` — the regression test. At lengths 42/64/96/128/256, drive a tracker to its ceiling and
+  assert `residentBytes()` stays at or below the budget, and that a longer ID yields a strictly smaller ceiling.
+- `TestTrackerRederivesOnLongerID` — a longer ID lowers the ceiling; a subsequent shorter one does not raise it.
+- `TestTinyBudgetStillBounds` and `TestZeroBudgetIsUnlimited` updated for the derived form: the clamp and the unlimited
+  sentinel must both survive it.
+
+**Exit.** Residency at or below budget at every tested ID length — the invariant that is false with a fixed constant.
+
+---
+
+### DS-2 — Budget resolution
+
+**Size.** XS. **Depends on.** Nothing (parallel to DS-1).
+
+**Scope.** One resolver, no consumers.
+
+- `resolveDropSetBudget(opt option)` — `limit/(dropSetAggregateDivisor*CPUs)`, floor `minimumDropSetBudget`,
+  `defaultDropSetBudget` when the limit is zero. **No lane parameter and no second function**: finalize is charged the
+  same as a hot merge (spec §3.4).
+- `testDropSetBudgetOverride`, mirroring `testStageBudgetOverride` (`banyand/trace/merger.go:189`).
+- Constants, with comments covering why the floor is 1 MiB rather than staging's 16 MiB and when it binds, why there is
+  no independent entry cap, and — pointing at spec §9.1 — why finalize is not given a larger ceiling despite being
+  concurrency-1.
+
+**Out of scope.** Wiring the budget into a filter (DS-5).
+
+**Files.** `banyand/trace/merger.go` (budget block near `:194-243`), new `banyand/trace/drop_set_budget_test.go`.
+
+**Tests.**
+
+- `TestResolveDropSetBudget` — table over `(limit, CPUs)` covering 0, 512 MiB, 4 GiB, 16 GiB × 1, 4, 8, 16 CPUs; exact
+  expected bytes including the zero-limit fallback and the minimum clamp.
+- `TestDropSetAggregateBoundHolds` — for each row, assert `budget*(CPUs/2+2) <= limit/8`, and assert the documented
+  small-node overshoot explicitly for CPUs 1 and 2 rather than letting it look like a failure. The aggregate invariant
+  becomes a test rather than a comment in the spec.
+- `TestDropSetFloorBoundRegime` — the floor-bound regime the rows above are all too large to reach: assert the floor
+  binds, that the aggregate bound still holds above a plausible smallest limit, and that below it the floor dominates.
+  Without this, the floor's effect on the bound is untested.
+- `TestDropSetBudgetOverrideWins`.
+
+**Exit.** Table passes. Aggregate bound asserted, including the small-CPU exception.
+
+**Rollback.** Unused function; safe.
+
+---
+
+### DS-3 — Ceiling enforcement in the decision loop (inert)
+
+**Size.** M. **Depends on.** DS-1.
+
+**Scope.** The behavioural seam, with the production budget still zero so the ceiling is unreachable outside tests.
+
+- `traceEvaluationStager` holds a `dropTracker` instead of a bare `*droppedTraceIDs`
+  (`banyand/trace/merger.go:2050-2066`).
+- In `resolveStagedDrops` (`banyand/trace/merger.go:1945-1996`): a ceiling check placed **before the guard and before both
+  `recordDroppedTraceID` sites**. When the tracker is full, set `keepMask[traceIdx] = true`, run the retained accounting,
+  increment a new retained-by-ceiling counter, and `continue` — the guard is not consulted for a trace that will be kept.
+- `incPipelineTracesRetainedByCeiling` in `banyand/trace/metrics.go` (alongside `:318-334`), plus the `observation` hook.
+- `filter.budget` plumbed through `mergeFilter`, left at zero by both construction sites.
+
+**Out of scope.** Activating the budget (DS-5). Benchmark-event fields and the warning log (DS-4). Any change to
+`keepEncoded`, `filterBlockPointer`, the SIDX merge signature, the output part's `traceIDFilter`, the finalize state or
+scanner, or any query path.
+
+**Files.** `banyand/trace/merger.go`, `banyand/trace/metrics.go`, the merge-observation type.
+
+**Tests.**
+
+- `TestMergeCeilingPrunesSidxExactly` — the load-bearing test. Force a two-entry ceiling on a merge whose sampler proposes
+  five drops. Assert the output part contains exactly the three spared traces plus all verdict-retained ones, and that for
+  **each** sidx instance the element set equals the output part's trace-ID set — strict equality in both directions, so
+  both an orphan and a missing entry fail.
+- `TestMergeCeilingRetainsTheAscendingTail` — the spared traces are the lexicographically largest of the proposed drops,
+  pinning the bias of spec §4 as observed behaviour rather than a claim.
+- `TestMergeCeilingSkipsGuard` — the guard's bloom-probe count equals the number of *pre-ceiling* proposed drops.
+- `TestMergeCeilingStillRevalidatesGuard` — a capped merge that dropped at least one trace still runs
+  `filter.guard.revalidate` (`banyand/trace/merger.go:926`). This is the regression the rejected bloom design would have
+  introduced; assert it even though this design cannot reach it.
+- `TestMergeCeilingCounterAccounting` — retained-by-ceiling equals proposed drops beyond the ceiling; total retained
+  equals verdict-retained plus ceiling-retained.
+- `TestCappedFinalizeRoundLeavesStateUnchanged` — a capped finalize round writes the same `finalize.json` fields a normal
+  round does: generation advanced, counter reset, no new fields, `FinalizeRounds` incremented once. Guards the spec §11
+  invariant 7 that finalize scheduling is untouched.
+- `TestMergeCeilingInertWithoutOverride` — with no override, a merge proposing many drops records every one; nothing is
+  retained by ceiling.
+- Unmodified: `TestMergeFilter_CoupledSidxPrune` (`banyand/trace/pipeline_chain_test.go:997`),
+  `TestMergeFilter_IdempotentReMerge`, `banyand/trace/pipeline_chain_filter_test.go:508`.
+
+**Exit.** All of the above, with zero edits to existing tests.
+
+---
+
+### DS-4 — Observability
+
+**Size.** S. **Depends on.** DS-3.
+
+**Scope.** Making the ceiling visible before it can fire in production. With no continuation mechanism this is the only
+signal that a shard is under-deleting, so it is part of the series rather than a follow-up.
+
+- Benchmark-event fields beside `StagingHardLimit` (`banyand/trace/merger.go:712-716`): resolved budget, capped flag,
+  retained-by-ceiling count.
+- A capped-merge counter split by lane.
+- One `Warn` per capped finalize round, naming group, shard, and retained-by-ceiling count. Exactly one: not per batch,
+  not per trace.
+
+**Out of scope.** Budget activation. Anything that changes a merge decision. Anything persisted.
+
+**Files.** `banyand/trace/merger.go`, `banyand/trace/merge_benchmark_observer.go`, `banyand/trace/metrics.go`,
+`banyand/trace/finalizer.go` (log call only).
+
+**Tests.**
+
+- `TestBenchmarkEventCarriesDropSetCeiling` — forced ceiling; all three fields populated and consistent with the counters.
+- `TestCappedFinalizeRoundWarnsOnce` — log capture asserts exactly one warning for a capped round and none for an uncapped
+  one.
+
+**Exit.** Both tests, plus the new fields visible in a forced-ceiling run's report.
+
+---
+
+## Stage 2 — Activation
+
+### DS-5 — Activate the budget
+
+**Size.** XS (the diff). Validation rides the Phase 10 SkyWalking acceptance workload rather than standing up its own
+harness, so it costs one extra run of an existing workload plus a flag. **Depends on.** DS-2, DS-4.
+
+**Scope.** The only ticket in the series that changes production behaviour.
+
+- Hot filter construction (`banyand/trace/merger.go:638-650`) and finalize filter construction
+  (`banyand/trace/finalizer.go:156-168`) both carry `resolveDropSetBudget`. Same call, same value.
+- No operator flag, matching the staging budget's precedent (`banyand/trace/merger.go:191-193`).
+
+**Files.** `banyand/trace/merger.go`, `banyand/trace/finalizer.go`.
+
+**Tests.**
+
+- `TestFiltersCarryResolvedDropSetBudget` — both construction sites carry the resolver's value, and they are equal. The
+  equality assertion is deliberate: it is what would fail if someone reintroduced a lane-specific budget without updating
+  spec §3.4.
+- `TestProductionBudgetMergeReachesNoCeiling` — an ordinary-sized merge at the resolved budget records every drop. Assert
+  the *derived ceiling* the budget yields, not merely that this merge did not cap, or the test passes for any budget above
+  a few kilobytes and stops guarding the default constant.
+- `TestLosslessRetryClearsCeilingReporting` — a capped attempt rejected by the fragment guard is retried without
+  sampling, and the retry's published output drops nothing; the capped-merge counter, `DropSetCapped`, and the finalize
+  warning must all describe that published output, not the discarded attempt. Verify this test fails without the fix.
+- An in-process residency check over a few hundred proposed drops is worth adding, clearly labelled as **not** a
+  workload-level measurement.
+
+### DS-5 validation: two SkyWalking integration runs
+
+Validation rides the Phase 10 SkyWalking acceptance workload of the
+[merge optimization plan](trace-pipeline-merge-optimization-plan.md) rather than the containerised controlled run that
+earlier drafts of this plan specified. Section "Why not the controlled run" below records that decision.
+
+Both runs read the instruments of spec §6; without them neither run can answer anything about the ceiling.
+
+**Run A — default settings, the headroom measurement.** The standard serialized 24-hour workload, unmodified. At a 4 GiB
+limit and `GOMAXPROCS=2` the budget is 128 MiB, a ceiling near 1.34 million traces in one merge, so real traffic will not
+reach it. That is the result, not a failure to test:
+
+- [ ] `pipeline_drop_set_entries` p99 recorded against `pipeline_drop_set_budget_bytes / dropSetBytesPerEntry`. **This
+      ratio is the deliverable** — it is how much headroom production-shaped traffic actually has, and therefore whether
+      the ceiling is load-bearing at default settings at all.
+- [ ] `pipeline_traces_retained_by_ceiling` is zero on every shard, confirming activation is behaviour-neutral here.
+- [ ] Phase 10's existing gates still pass: correct core and secondary-index ledgers, no OOM, no unexpected lossless
+      retry, no regression against the pipeline-disabled baseline.
+- [ ] Observed trace-ID length recorded. Real SkyWalking IDs are the first workload test of DS-1b's derived
+      bytes/entry and of the per-shard uniformity it expects; an ID longer than the 42 bytes spec §1.1 measured is
+      exactly the case the derived price exists for.
+
+**Run B — `--allowed-bytes=256MiB`, the capped-path measurement.** `resolveDropSetBudget` reads the protector limit and
+`--allowed-bytes` sets it directly, so this is a supported production flag, not a test seam. At 2 CPUs it yields an 8 MiB
+budget and a ceiling near 84,000 traces, which the same workload reaches comfortably. This is the only run that
+exercises the code this ticket adds:
+
+- [ ] `pipeline_traces_retained_by_ceiling` non-zero, with the shard label identifying where.
+- [ ] For every shard, secondary-index contents equal exactly the retained-trace set — spec invariant 9, now under real
+      trace IDs, real drop ratios, real fragment-guard behaviour and live query traffic rather than one frozen selection.
+- [ ] Queries ordered by `latency` and `start_time` return the same traces as the pipeline-disabled baseline for the
+      traces both retain. No short result sets, which is what a violation of the "no orphan index entries" invariant
+      would look like from outside.
+- [ ] Peak heap and RSS bounded, with drop-set residency attributable via `pipeline_drop_set_entries` ×
+      `dropSetBytesPerEntry` and at or below the resolved budget.
+- [ ] Traces left undeleted recorded as a number — this quantifies spec §5.2 on a real workload and is the input to any
+      later decision to take a deferred feature (spec §9).
+- [ ] `finalize_rounds` progression and any `finalize_terminal` transitions recorded.
+- [ ] No OOM, panic, malformed verdict, or unexpected lossless retry.
+
+Report both runs under `.scratch/trace-drop-set-bounding/ds5-<n>`.
+
+**Why not the controlled run.** `banyand/cmd/trace-merge-benchmark` over `banyand/internal/benchmark/tracebaseline` runs
+ten alternating single-merge container processes on a frozen seed, five per variant, under a canonical
+`GOMAXPROCS=2` / `MemoryMax=4 GiB` readiness gate. Its unique contribution is a reproducible paired comparison with exact
+oracles and CV bounds. But at canonical resources the ceiling sits near 1.34 million traces while the existing frozen
+selection holds 33,353 — roughly 40x too small to make a merge cap. Reaching it would need capturing a ~1.4 million-trace
+seed, and shrinking container memory instead would fail the readiness gate and make the result incomparable to the
+Phase 6 series.
+
+The integration runs cover more of what matters here and cost far less: aggregate concurrency across hot lanes and the
+finalize round, which a single-merge run never exercises; real trace IDs; and end-to-end query behaviour. What they give
+up is reproducibility — live traffic is not replayable, so there is no byte-identical paired comparison. That trade is
+accepted deliberately: the claims at stake are about a ceiling that either fires or does not, and about index exactness
+when it does, neither of which needs byte-identical inputs to establish.
+
+**Exit.** Run A's headroom ratio recorded; Run B's capped path clean on index exactness, query results, and bounded
+residency; undeleted-trace count recorded. Until both runs have reports, DS-5 is code-complete but **not** closed: the
+ceiling is live in production with no workload-level evidence behind it.
+
+**Rollback.** Revert this ticket alone. The mechanism returns to inert; no other ticket needs touching.
+
+---
+
+## Independent
+
+### DS-9 — Arena-backed IDs
+
+**Size.** M. **Depends on.** DS-1. Independent of everything else, but worth landing **before** DS-5: it raises the
+ceiling by about 24 percent, so it directly improves the deletion bound that DS-5 will measure.
+
+**Scope.** Replace `ids []string` with a byte arena plus `uint32` offsets. The Phase 6 index, the fingerprint check, and
+the exact `bytes.Equal` confirmation are untouched — the probe becomes `arena[offs[i]:offs[i+1]]` instead of
+`convert.StringToBytes(ids[i])`, same single probe and single comparison. `bodyBytes` becomes exactly `len(arena)`, so
+`maxIDsForBudget` stops depending on a size-class estimate.
+
+**Out of scope.** Replacing the index with binary search. Explicitly rejected: spec §10.
+
+**Files.** `banyand/trace/drop_set.go`, `banyand/trace/drop_set_test.go`.
+
+**Tests.**
+
+- Existing `drop_set_test.go` assertions pass unchanged, including prefix/extension non-matching, fail-open on malformed
+  input, and the ascending-order and duplicate-suppression behaviour of `add`.
+- `BenchmarkDropSetLookup` at 1 / 35 / 99 percent shows no regression against DS-1's baseline; the ticket states the
+  tolerance and sample count it used. A regression outside noise blocks the ticket — this path was tuned in Phase 6 and is
+  not worth trading for memory the ceiling already bounds.
+- `BenchmarkDropSetResidency` shows the expected bytes-per-entry reduction; `maxIDsForBudget` rises accordingly.
+- `TestProjectedIndexBytesMatchesBuildIndex` still exact.
+
+**Exit.** No lookup regression; residency reduced; DS-1's projection test still exact.
+
+---
+
+### DS-11 — Documentation
+
+**Size.** S. **Depends on.** DS-5.
+
+**Scope.**
+
+- `docs/design/post-trace-pipeline.md:630-632` — a merge may stop dropping at its ceiling; the pruning predicate, lockstep
+  publication, and atomicity are unchanged.
+- `docs/design/trace-pipeline-merge-optimization-plan.md` Phase 6 — the collector is now ceiling-bounded; the phase's
+  exactness invariant is unchanged, not revised.
+- Operator documentation: the retained-by-ceiling counter and what to do about it (raise memory), the ordering bias of
+  spec §4, and — the item an operator is most likely to be surprised by — that a ceiling-bound shard will not shrink as
+  much as the sampler's configuration implies (spec §12 risk 2).
+
+**Tests.** None. Review-only.
+
+---
+
+## Deferred
+
+Prospective tickets, not part of this series. Each corresponds to a spec §9 subsection, which holds the numbers and the
+reasoning. Listed in prerequisite order; none is required for the series above to be complete and correct.
+
+| Ticket | Buys | Prerequisite | Spec |
+| --- | --- | --- | --- |
+| **DF-1** Per-lane finalize ceiling | ~`CPUs`x the lifetime deletion bound (~2.7 M to ~21 M traces per shard at 4 GiB / 8 CPUs) | DS-5's retained-by-ceiling number showing the bound is being hit | §9.1 |
+| **DF-2** Continuation rounds | Removes the ingest gate so leftover work clears itself | DF-1 — raising the ceiling is cheaper per unit of deletion recovered than adding rounds | §9.2 |
+| **DF-3** Sampling watermark | Makes DF-2's round count `ceil(droppable / maxIDs)` and its plugin cost proportional to the shard rather than to shard × rounds | DF-2 | §9.3 |
+| **DF-4** Bloom-filter pruning | Removes the deletion bound entirely rather than raising it | A refillable Phase-1 query limit — a query-layer change, worth doing on its own merits | §9.4, §8 |
+
+DF-2 is the one to scope carefully when its turn comes: it adds persisted finalize state, changes two scanner predicates
+that must move together, and reintroduces the finalize write amplification that spec §5.3 currently avoids.
+
+---
+
+## Decisions to settle before DS-5
+
+1. `dropSetAggregateDivisor = 16`. It sets both the memory bound and, through spec §5.2, the lifetime deletion bound.
+   DS-2's table encodes whatever is chosen, so changing it later means changing that table.
+2. Whether DS-9 lands before DS-5. Recommended: yes, so the deletion bound DS-5 measures is the one the design will
+   actually ship with.
diff --git a/docs/design/trace-drop-set-bounding.md b/docs/design/trace-drop-set-bounding.md
new file mode 100644
index 000000000..d55603f03
--- /dev/null
+++ b/docs/design/trace-drop-set-bounding.md
@@ -0,0 +1,579 @@
+# Trace Merge Drop-Set Bounding
+
+## Status
+
+This document specifies a bound on the merge-wide dropped-trace-ID collector introduced by Phase 6 of the
+[merge optimization plan](trace-pipeline-merge-optimization-plan.md), which was unbounded in the number of dropped traces
+per merge.
+
+Implemented, except the validation. The mechanism (DS-1, DS-1b), the budget resolver (DS-2), the ceiling seam (DS-3),
+observability (DS-4), activation (DS-5), and the production instruments of section 6 are in the tree. The ceiling is
+therefore **live** on every merge.
+
+The workload validation has **not** run. It rides the Phase 10 SkyWalking acceptance workload as two runs: one at
+default settings, which measures how much headroom real traffic has against the ceiling, and one at
+`--allowed-bytes=256MiB`, which lowers the ceiling enough for real traffic to reach it and so is the only run that
+exercises the capped path. Until both produce reports the ceiling is active with no workload-level evidence behind it,
+and the memory bound rests on unit-level residency checks. See the execution plan for the gate and for why it replaced
+the containerised controlled run.
+
+**The bound is applied to the sampling decision, not to the pruning predicate.** When a merge reaches its drop-set
+ceiling it stops dropping traces and retains the remainder. Secondary-index pruning therefore stays exact for every drop
+that is performed, the secondary index remains exactly the set of retained traces, and no query-layer change is
+required. Phase 6's hard invariant — *"Secondary-index lookup remains exact. No probabilistic structure can authorize a
+deletion."* — is preserved verbatim.
+
+**Every merge is treated identically.** One budget function, one constant, no lane parameter. A finalize round is one
+more merge: same ceiling, one round, no continuation mechanism, no watermark, and no change to the finalize round
+machinery, its persisted state, or its scheduling. `banyand/trace/finalize_state.go` is not touched;
+`banyand/trace/finalize_scanner.go` gains telemetry only, and its decisions are unchanged (section 7).
+
+The accepted cost is bounded deletion: a capped finalize round leaves traces undeleted, and they are only revisited by
+the existing re-round path, which is capped at eight rounds per shard for its lifetime. Section 5 states the numbers.
+Finalize I/O does not change, because the round count does not change.
+
+Four features that would each lift part of this limit are specified and deferred in section 9: bloom-filter pruning,
+continuation rounds, the sampling watermark, and a per-lane finalize ceiling. None is a prerequisite; each is an
+independent later choice, and section 9 records what must be true before it can be taken.
+
+## 1. Problem
+
+`droppedTraceIDs` (`banyand/trace/drop_set.go`) holds every trace ID the core merge dropped, for the whole duration of
+one merge, so that each sibling secondary-index merge can prune the same IDs (`banyand/trace/merger.go:843-856`):
+
+- `ids []string` — ascending, deduplicated, one entry per dropped trace.
+- `slots []uint64` — an open-addressed index built lazily on first lookup, sized to the next power of two at or above
+  `2N`, so between `2N` and `4N` slots of eight bytes.
+
+It is released only after every secondary-index merge has published (`banyand/trace/merger.go:826`).
+`maxPooledDroppedTraceIDBytes = 4 MiB` (`banyand/trace/drop_set.go:26`) bounds only what is returned to the reuse pool;
+it is not a limit on a live merge, as Phase 6 already recorded.
+
+Nothing bounds `N`. The pipeline's other working sets are budgeted — `stageBudgetFromLimit` gives each merge
+`memLimit/(4 × CPUs)` for staged bytes so the aggregate stays near `memLimit/4`, plus a per-trace budget and a
+trace-count cap (`banyand/trace/merger.go:194-243`). The drop set sits outside that accounting: staging is bounded per
+batch and reset at every flush, while the drop set accumulates across all batches of the merge.
+
+### 1.1 Measured residency
+
+Measured on the real structure with 42-byte service-prefixed IDs, each body allocated per entry as
+`blockMetadata.unmarshal` does (`banyand/trace/block_metadata.go:170`). Reserved heap is `HeapSys` — what the container
+sees.
+
+| Dropped traces | Live heap | `ids` | `slots` | ID bodies | Live before index | Reserved heap |
+| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| 100,000 | 7.6 MiB | 1.8 | 2.0 | 3.8 | 5.6 MiB | 19 MiB |
+| 1,000,000 | 71.1 MiB | 16.9 | 16.0 | 38.1 | 55.1 MiB | 163 MiB |
+| 4,000,000 | 281.3 MiB | 64.7 | 64.0 | 152.6 | 217.3 MiB | 615 MiB |
+| 16,000,000 | 1,113.2 MiB | 246.8 | 256.0 | 610.4 | 857.2 MiB | 2,270 MiB |
+
+Roughly 73 to 80 bytes per entry live. Reserved heap is close to twice live heap because `ids` grows by append doubling
+and `slots` is a single contiguous allocation — 256 MB at sixteen million entries. Reserved heap, not live heap,
+terminates a container.
+
+### 1.2 Trigger
+
+The exposure is the ordinary finalize path, not a rare large hot merge:
+
+- `runFinalizeRound` selects **every cooled part in the shard** into **one** merge
+  (`banyand/trace/finalizer.go:92-119`). The only quantity gate is disk headroom (`:141`).
+- `warrantsFinalize` returns true unconditionally when `FinalizeGeneration == 0`
+  (`banyand/trace/finalize_scanner.go:211`), so a shard's first finalize round rewrites its entire segment in one merge
+  with one drop set.
+- The scanner ticks every ten minutes (`banyand/trace/finalize_scanner.go:32`) over cooled segments only, so that first
+  round has no natural chunking.
+
+At a ninety percent drop rate a shard holding twenty million traces produces an eighteen million entry drop set: about
+1.3 GiB live, 2.6 GiB reserved, inside a process also serving queries and hot merges.
+
+Hot merges are milder, bounded by the merge policy and the lane threshold, but up to `CPUs/2 + 1` run concurrently
+(`banyand/trace/merger.go:266-283`), each with its own set, alongside the node-wide serialized finalize round.
+
+The protector is consulted once at round start (`banyand/trace/finalizer.go:58`) and never again as the set grows.
+
+## 2. Goals and non-goals
+
+**Goals.**
+
+1. A hard, resource-derived ceiling on drop-set residency per merge and in aggregate.
+2. Secondary-index contents remain exactly the retained-trace set. No orphan entries, no missing entries.
+3. No change to any query path, plan, or operator.
+4. No change to the finalize round machinery, its persisted state, or its scheduling.
+5. Byte-identical behaviour below the ceiling.
+6. The deletion lost at the ceiling is bounded and observable.
+
+**Non-goals.**
+
+1. Recovering the deletion lost at the ceiling. Section 9 lists four ways to do that later; none is in scope.
+2. Bounding the finalize round's part selection.
+3. Changing the fragment guard, the staging budgets, or the plugin decision path.
+4. Reducing the cost of the exact lookup selected by Phase 6.
+
+## 3. Design
+
+### 3.1 Retain instead of drop at the ceiling
+
+The ceiling changes what the sampler is *allowed to act on*, never how the secondary index is pruned. Once a merge's
+drop set is full, every subsequent proposed drop becomes a retention:
+
+- The trace is written to the output part.
+- It is counted as retained, under a distinct counter — retained-by-ceiling, not retained-by-verdict.
+- The fragment guard is **not** consulted for it. The guard exists to confirm drops; a trace that will be retained needs
+  no confirmation, and skipping it saves the guard's bloom probes.
+
+Because recording and dropping stop at the same instant, the drop set stays complete with respect to the drops actually
+performed. That is the whole correctness argument, and it is why nothing downstream changes:
+
+| Consumer | Change |
+| --- | --- |
+| `keepEncoded` predicate (`banyand/trace/drop_set.go:84`) | none |
+| `filterBlockPointer` (`banyand/internal/sidx/merge.go:255`) | none |
+| Guard revalidation gate (`banyand/trace/merger.go:926`) | none — the set is never released, so `dropped.len()` stays truthful |
+| Output part `traceIDFilter` | none |
+| Finalize state, scanner, scheduling | none |
+| Query plan, engine, limit pushdown | none |
+| Phase 6 hard invariant | none |
+
+The state is a single one-way flag plus the existing set. No release-mid-merge semantics, no count-versus-length
+divergence.
+
+```go
+type dropTracker struct {
+    exact  *droppedTraceIDs // never released early; lives to SIDX publication as today
+    maxIDs int              // derived from the resolved budget; 0 means unlimited
+    full   bool             // one-way within a merge
+}
+```
+
+### 3.2 Where the ceiling is enforced
+
+One seam, in `resolveStagedDrops` (`banyand/trace/merger.go:1945-1996`), before either `recordDroppedTraceID` call site
+and before the guard:
+
+```go
+for traceIdx, traceID := range assembledBatch.vectors.traceIDs {
+    if keepMask[traceIdx] {
+        // ... existing retained accounting ...
+        continue
+    }
+    if !tracker.canAccept() {
+        // Ceiling reached: retain rather than drop, and do not enter the guard
+        // for a trace that will be kept.
+        keepMask[traceIdx] = true
+        // ... retained accounting + retained-by-ceiling counter ...
+        continue
+    }
+    if filter.guard == nil {
+        recordDroppedTraceID(...)
+        continue
+    }
+    // ... existing guard path, unchanged ...
+}
+```
+
+`flushStaged` (`banyand/trace/merger.go:2002-2035`) needs no change: it already writes every trace whose mask entry is
+true. The ceiling may be reached mid-batch; per-trace mask flipping handles that with no batch-boundary special case.
+
+### 3.3 Cap predicate
+
+Cap in bytes, accounted exactly. The pool's sizing function already computes most of it
+(`banyand/trace/drop_set.go:35-37`). The index **will** be built, so the projection is not optional:
+
+```
+liveBytes(N)      = cap(ids) * sizeof(string) + bodyBytes
+projectedIndex(N) = nextPow2(max(2, 2N)) * 8      // exactly what buildIndex will allocate
+```
+
+`maxIDs` is derived once, from the budget and one entry's price, so the steady-state cost is one integer comparison per
+proposed drop rather than a byte computation. Because `nextPow2` is discontinuous, price the slot share at the worst-case
+ratio of four slots per entry:
+
+| Layout | Header + slack | Body | Slots (worst case) | Bytes/entry at a 42-byte ID |
+| --- | ---: | ---: | ---: | ---: |
+| Today (`[]string`) | 20 | `allocClass(len)` | 32 | 100 |
+| Arena + `uint32` offsets (§3.5) | 5 | `len` | 32 | 81 |
+
+**The body term is derived from an observed ID length, not fixed.** A constant priced for the 42-byte
+service-prefixed ID of §1.1 would let a deployment with longer IDs overshoot the budget proportionally — about 1.4x at 96
+bytes, 3x at 256 — so the ceiling would not be a ceiling. Trace-ID length is uniform within a shard, so the first
+recorded ID prices the whole merge; `allocClass` rounds it up to the allocator's size-class stride (16 bytes below 256,
+32 above) because a ceiling must never under-count residency. At 42 bytes this yields exactly 100, so deriving the price
+generalizes the fixed constant rather than re-tuning it, and the ceilings in §3.4 are unchanged for that case.
+
+The derivation re-runs if a longer ID ever appears, which can only lower `maxIDs`. Uniformity is therefore an expectation
+that makes one sample sufficient, not an assumption the memory bound rests on.
+
+### 3.4 One budget for every merge
+
+Hot lane, slow lane, and finalize round all resolve the same ceiling from the same function. There is no per-lane budget
+and no special case for finalize.
+
+```go
+const dropSetAggregateDivisor = 16
+const defaultDropSetBudget    = 16 << 20 // protector disabled; mirrors stageBudgetFromLimit's limit==0 fallback
+const minimumDropSetBudget    =  1 << 20
+
+// resolveDropSetBudget returns the per-merge drop-set ceiling. It mirrors
+// stageBudgetFromLimit: divide by CPUs() so the aggregate across concurrent merges
+// stays near memLimit/dropSetAggregateDivisor. Finalize is not special-cased — it is
+// one more merge and is charged the same. See §5 for what that costs it and §9 for
+// the deferred alternative.
+func resolveDropSetBudget(opt option) uint64 {
+    if testDropSetBudgetOverride > 0 { return testDropSetBudgetOverride }
+    limit := protectorLimit(opt)
+    if limit == 0 { return defaultDropSetBudget }
+    return max(limit/(dropSetAggregateDivisor*uint64(max(1, cgroups.CPUs()))), minimumDropSetBudget)
+}
+```
+
+Resulting ceilings, at 100 bytes per entry today and 81 with section 3.5:
+
+| memLimit | CPUs | Budget | Traces per merge | Aggregate worst case |
+| ---: | ---: | ---: | ---: | ---: |
+| 512 MiB | 4 | 8 MiB | 84 k / 103 k | 32 MiB (6.3%) |
+| 4 GiB | 8 | 32 MiB | 335 k / 414 k | 192 MiB (4.7%) |
+| 16 GiB | 16 | 64 MiB | 671 k / 828 k | 640 MiB (3.9%) |
+
+Aggregate assumes `CPUs/2 + 2` merges — the hot lanes plus the finalize round — all simultaneously at the ceiling. That
+is a bound, not an expectation. Below four CPUs the `CPUs` divisor is smaller than `CPUs/2 + 2`, so the aggregate can
+exceed `memLimit/16` by up to 2.5x on a one- or two-CPU node; the absolute figures there are small, and the existing
+`stageBudgetFromLimit` has the same property by the same convention.
+
+Two deliberate departures from `stageBudgetFromLimit`:
+
+1. **A 1 MiB floor, not `defaultStageBudgetFloor`'s 16 MiB.** Some floor is needed, or a divided budget on a small node
+   collapses to a ceiling too small for sampling to make useful progress. But a *generous* floor is exactly what breaks
+   the aggregate bound above, so it is set two orders of magnitude lower than staging's. It binds only when
+   `limit < 16 MiB × CPUs`, where the aggregate stays a small share of any plausible limit (128 MiB / 16 CPUs: 10 MiB,
+   under 8 %). On implausibly small limits the floor does dominate the bound (32 MiB / 16 CPUs: 31 %); that is accepted,
+   and pinned by a test rather than left to chance.
+2. **No independent entry cap.** Staging needs `defaultMaxStagedTraceCount` because its per-trace byte estimate is
+   coarse; here the byte accounting is exact. The omission must be commented as deliberate.
+
+### 3.5 Arena-backed IDs (separable)
+
+The ceiling *is* deletion capacity, so bytes per entry converts directly into traces deleted per merge. Replacing
+`ids []string` with a byte arena plus `uint32` offsets removes both the sixteen-byte string headers and the size-class
+rounding, raising the ceiling by about twenty-four percent.
+
+It does not change the lookup shape. `keepEncoded` compares `convert.StringToBytes(dropped.ids[storedIdx-1])` against
+the probe; with an arena it compares `arena[offs[i]:offs[i+1]]`. Same single slot probe, same single `bytes.Equal`, no
+extra indirection. The Phase 6 index and its exact-confirmation step are untouched.
+
+It also makes `bodyBytes` exactly `len(arena)`, so the cap predicate stops depending on a size-class estimate.
+
+Swapping the index for binary search over `ids` remains out of scope; see section 10.
+
+### 3.6 Dynamic trigger
+
+The static ceiling does not cover pressure arriving from elsewhere in the process. The switch to retain-only fires on
+**either** condition:
+
+1. `liveBytes(N) + projectedIndex(N+1) > budget` — the static ceiling.
+2. `pm.State() == protector.StateHigh`, sampled every 4,096 recorded drops — dynamic pressure, regardless of the
+   ceiling.
+
+The second closes the gap in section 1.2. Its failure mode is benign: it retains traces, so a spurious trigger costs
+deletion, never correctness.
+
+## 4. Consequence: which traces survive
+
+Traces are proposed for dropping in core-merge order, which is ascending trace ID. So the traces a capped merge spares
+are the **lexicographically largest** IDs in that merge. SkyWalking trace IDs are service-prefixed, so within one capped
+round the spared set is correlated with service name rather than being a uniform sample.
+
+A later round's ascending walk encounters the previous survivors and deletes the next `maxIDs` of them, so the bias
+erodes as long as rounds keep happening. It becomes permanent when rounds stop — see section 5.2. The bias must be
+documented in operator docs, because "sampling retained more traces for services late in the alphabet" is otherwise an
+inexplicable observation.
+
+## 5. Cost: bounded deletion
+
+### 5.1 Hot merges: benign
+
+A capped hot merge's output has `FinalizeGen` min-propagated from its inputs (`banyand/trace/merger.go:1168-1176`), so
+the spared traces stay selectable by later hot merges and by finalize. Nothing is lost, only deferred.
+
+### 5.2 Finalize: bounded by the existing round budget
+
+A finalize round's output is stamped `gNext` and the next round selects on `FinalizeGen < gNext+1`
+(`banyand/trace/finalizer.go:74,108,1166-1167`, and the field comment at `banyand/trace/finalize_state.go:45-52`), so a
+capped round's output **is** eligible for a later round. No new mechanism is added to exploit that; the existing gates
+apply unchanged:
+
+- `warrantsFinalize` requires `unsampledBytes >= max(floorBytes, ratio × total)` once `FinalizeGeneration != 0`
+  (`banyand/trace/finalize_scanner.go:211-219`), and the counter was reset by the round that just ran
+  (`banyand/trace/finalizer.go:193-204`), so a later round waits on **new ingest** rather than on the leftover work.
+- `cooldownNs` paces rounds.
+- `finalizeMaxRoundsDefault = 8` (`banyand/trace/pipeline_registry.go:96`) is a hard per-shard lifetime cap, after which
+  the shard is marked `Terminal` and never scanned again (`banyand/trace/finalize_scanner.go:196-203`).
+
+So total deletion for a shard's lifetime is bounded by eight rounds times the ceiling:
+
+| memLimit | CPUs | Ceiling per round | Lifetime deletion bound (8 rounds) |
+| ---: | ---: | ---: | ---: |
+| 512 MiB | 4 | 84 k / 103 k | 670 k / 824 k |
+| 4 GiB | 8 | 335 k / 414 k | 2.7 M / 3.3 M |
+| 16 GiB | 16 | 671 k / 828 k | 5.4 M / 6.6 M |
+
+A shard with eighteen million droppable traces at 4 GiB and eight CPUs therefore leaves roughly fifteen million
+permanently undeleted. **This is the accepted cost of the design.** It is a deliberate trade: memory safety and a
+minimal, self-contained change, against deletion throughput on large shards. Section 9's deferred features are the
+engineering levers.
+
+The operator lever is **the protector limit**, not the machine's memory. The ceiling scales linearly with
+`protector.GetLimit()`, which is `--allowed-bytes` when set and otherwise a valid cgroup memory limit
+(`banyand/protector/protector.go:245-269`). A node with neither — no `--allowed-bytes` and no readable or finite cgroup
+limit, which is the bare-metal default — leaves the protector *disabled*, and `resolveDropSetBudget` then returns the flat
+`defaultDropSetBudget` regardless of how much RAM the machine has: about 168,000 traces per merge and 1.3 million per
+shard lifetime, whether the box has 8 GiB or 512 GiB.
+
+That is the same shape as `stageBudgetFromLimit`'s flat `limit == 0` fallback, so it is consistent with how the rest of
+the merge pipeline treats an unmeasurable node. The consequence differs, though, and is worth stating rather than
+inferring: a flat staging budget only slows a merge, while a flat drop-set ceiling bounds deletion permanently. **On such
+a node, adding RAM does nothing for sampling; setting `--allowed-bytes` (or running under a cgroup limit) is what raises
+the ceiling.** Deriving a budget from physical RAM instead was rejected: it would add a memory-discovery path that the
+rest of the codebase deliberately routes through the protector, and a node running with no memory limit at all has no
+budget for staging either.
+
+The failure is invisible without section 6's counter, which is why that counter and its warning log are part of this
+specification rather than a follow-up.
+
+### 5.3 Finalize I/O is unchanged
+
+Round count does not change, and a round rewrites the same parts it does today. A capped round writes *more* bytes than
+an uncapped one, because it retains traces it would otherwise have removed — but that is strictly less work than the
+unbounded status quo does, and there is no additional rewrite. This design adds no finalize write amplification.
+
+## 6. Observability
+
+Without this, the design's cost is invisible: a shard quietly under-deletes and nothing says so. With no continuation
+mechanism, observability is the *only* thing standing between a capped shard and a silent one.
+
+On `banyand_trace_tst_`, per merge:
+
+| Instrument | Labels | Answers |
+| --- | --- | --- |
+| `pipeline_traces_retained_by_ceiling` (counter) | `group,seg,shard` | How much deletion was lost, and where. Distinct from retained-by-verdict; both also increment `pipeline_traces_retained` |
+| `pipeline_merges_ceiling_reached` (counter) | `group,seg,shard,lane` | Which lane is capping — `finalize` is the one that matters |
+| `pipeline_drop_set_budget_bytes` (gauge) | `group` | The resolved ceiling: the denominator for the two above |
+| `pipeline_drop_set_entries` (histogram) | `group,seg,shard,lane` | How close merges are running to that ceiling |
+
+The histogram is emitted **whether or not a merge caps**, and that is the point: the two counters only fire once
+deletion has already been lost, so on their own they are a lagging indicator. Watching the upper buckets approach
+`pipeline_drop_set_budget_bytes / dropSetBytesPerEntry` is what gives an operator warning *before* the ceiling bites. A
+zero budget emits nothing rather than a zero gauge, so "no ceiling" never reads as "a zero-byte ceiling".
+
+The shard dimension is carried because the deletion bound is per shard (§5.2); without it a dashboard shows that a group
+is under-deleting but not where. These series are deleted per tsTable in `deleteMetrics`, so cardinality is bounded by
+live segments rather than growing with rotation.
+
+On `banyand_trace_pipeline_`, per shard, published by the scan pre-filter (§7):
+
+| Instrument | Labels | Answers |
+| --- | --- | --- |
+| `finalize_rounds` (gauge) | `group,shard` | How much of the shard's lifetime round budget is spent |
+| `finalize_terminal` (gauge) | `group,shard` | Whether the loss is now permanent — this shard can never delete another trace |
+
+- The resolved budget, the `full` flag, and the retained-by-ceiling count in the benchmark event, next to
+  `StagingHardLimit` (`banyand/trace/merger.go:712-716`).
+- A warning log when a finalize round hits the ceiling, naming the group, shard, and count. This is the one condition an
+  operator can act on, by raising the protector limit (§5.2 — not by adding RAM, if the protector is disabled).
+- All three must describe the merge output that was actually **published**. A capped attempt that the fragment guard
+  rejects is retried without sampling, and the retry's output drops nothing; reporting a ceiling for it would send an
+  operator after a merge that never hit one.
+
+Nothing is added to the persisted finalize state; a capped round is visible through metrics and logs only.
+
+## 7. Required changes
+
+| Site | Change |
+| --- | --- |
+| `banyand/trace/drop_set.go:28-59` | Add `dropTracker` with `canAccept`, exact `liveBytes`/`projectedIndex`. Optionally arena-back the IDs (§3.5). |
+| `banyand/trace/merger.go:1945-1996` | Ceiling check before the guard and before both record sites; flip `keepMask`; new counter. |
+| `banyand/trace/merger.go:2050-2066` | `traceEvaluationStager` holds the tracker instead of a bare `*droppedTraceIDs`. |
+| `banyand/trace/merger.go:194-243` | Add `resolveDropSetBudget` and `testDropSetBudgetOverride`. One function, no lane parameter. |
+| `banyand/trace/merger.go:638-650` | Hot filter carries the budget. |
+| `banyand/trace/finalizer.go:156-168` | Finalize filter carries the **same** budget. Nothing else in the finalize path changes. |
+| `banyand/trace/merger.go:712-716` | Emit budget, capped flag, retained-by-ceiling count. |
+| `banyand/trace/metrics.go:318-334` | Retained-by-ceiling and capped-merge counters. |
+| `docs/design/post-trace-pipeline.md:630-632` | Note that a merge may stop dropping at its ceiling; the pruning predicate and lockstep publication are unchanged. |
+| `docs/design/trace-pipeline-merge-optimization-plan.md` Phase 6 | Record that the collector is now ceiling-bounded; the phase's exactness invariant is unchanged. |
+
+Not changed: `keepEncoded`, `filterBlockPointer`, the SIDX merge signature, the output part's `traceIDFilter`,
+`banyand/trace/finalize_state.go`, every query path.
+
+`banyand/trace/finalize_scanner.go` gains **telemetry only**: the scan pre-filter publishes each shard's finalize state
+(section 6) before deciding, because it is the only place a terminal shard is still visited. Selection, generation
+stamping, cooldown, and the round cap are untouched, and the pre-filter returns exactly what it returned before — pinned
+by `TestSegmentMayWarrantObservedMatchesUnobserved`.
+
+## 8. Rejected: prune with the retained-ID bloom filter
+
+Recorded here rather than in section 9 because the reason is a query-layer finding that outlives this design.
+
+The alternative was to release the exact set at the ceiling and prune with the output part's retained-ID bloom filter
+(`banyand/trace/block_writer.go:236,283`, read back at `banyand/trace/merger.go:1181`), which is free — it is built,
+persisted, and re-read today. A bloom has no false negatives, so a negative proves non-membership and the deletion stays
+exact; a false positive can only *retain* an entry for a dropped trace, at about 0.042 percent
+(`pkg/filter/bloom_filter.go:29-34`). That would have bounded memory with **no** deletion loss at all.
+
+The reasoning is sound but the conclusion drawn from it — that a surviving entry for a dropped trace is query-invisible
+— is false on the default query engine:
+
+- The pushed-down limit is `limit + offset`, the user-visible limit (`pkg/query/logical/trace/trace_analyzer.go:95`).
+- It reaches Phase 1 as `maxRows` and caps the stream of **secondary-index-derived** distinct trace IDs before any core
+  scan (`banyand/trace/query_vectorized.go:361-388`, `pkg/query/vectorized/trace/limit.go:50-66`,
+  `limit_carry.go:56-88`).
+- The core scan runs afterwards (`banyand/trace/query_vectorized.go:398-431`). A trace with no spans yields nothing, and
+  nothing backfills: the distributed plan sends `Limit = maxTraceSize` to data nodes
+  (`pkg/query/logical/trace/trace_plan_distributed.go:135-136`) and the liaison only trims.
+- The vectorized engine is enabled by default (`pkg/query/vectorized/trace/config.go:49-55`).
+
+So an orphan entry inside the top-N window consumes a result slot and the query silently returns fewer traces than the
+limit. Tag filters make this more likely, not less: they are pushed into the secondary index
+(`pkg/query/logical/trace/trace_plan_tag_filter.go:135-152`) and a surviving element keeps all its tag columns
+(`banyand/internal/sidx/merge.go:252-283`), so an orphan can match and enter the window. The row path tolerates it
+(`banyand/trace/query.go:366-370` skips zero-cursor traces and keeps pulling) but it is not the default.
+
+A projection served entirely from secondary-index tags would turn this from a short count into wrong rows. No such path
+exists today — Phase 1 carries only trace ID, key, and part ID (`banyand/trace/streaming_pipeline.go:40-46`,
+`pkg/query/vectorized/trace/limit_carry.go:56-88`) and result tags come only from the core block scan
+(`banyand/trace/query_vectorized.go:246-289`) — but it is an obvious future optimization, and a memory design whose
+correctness depends on nobody adding it is not safe.
+
+Note the corollary, which is why this section matters even though the bloom is rejected: **fail-open-on-ceiling — "stop
+pruning, keep every entry" — is not an acceptable fallback either.** It produces orphans for one hundred percent of
+post-ceiling drops where the bloom produced them for 0.042 percent. Retaining the *traces* is the only fallback that
+keeps the index exact.
+
+## 9. Deferred features
+
+Each of these lifts part of section 5.2's deletion bound. None is a prerequisite for this design, none is required for
+it to be correct, and they are independent of one another. Listed in the order their prerequisites are likely to be met.
+
+### 9.1 Per-lane finalize ceiling
+
+**Buys.** About `CPUs` times more deletion per finalize round — at 4 GiB / 8 CPUs, 256 MiB and ~2.7 million traces per
+round instead of 32 MiB and ~335,000, so the lifetime bound rises from ~2.7 million to ~21 million traces per shard.
+Equally memory-safe, since the finalize scanner is concurrency-1 node-wide
+(`banyand/trace/finalize_scanner.go:34-37`).
+
+**Costs.** A second resolver and a second call site, so two budget constants that can drift apart, and a test table that
+has to cover both.
+
+**Prerequisite.** Evidence that the lifetime bound is actually being hit — the retained-by-ceiling counter from section 6
+being non-zero on real shards.
+
+**Why not now.** The whole point of one budget is that finalize is not special. This is the cheapest way to change that
+decision if the data says it was wrong, which is why it is listed first.
+
+### 9.2 Continuation rounds
+
+**Buys.** Removes the ingest gate, so leftover work clears itself. A capped round would persist a pending flag,
+`warrantsFinalize` and `shardMayWarrant` would both honour it (bypassing the `unsampledBytes` threshold but not the
+cooldown), and a separate bounded `ContinuationRounds` counter would keep `FinalizeRounds` free for ingest-driven work.
+
+**Costs.** New persisted finalize state, changes in two scanner predicates that must move together, a new bound to
+choose, and a new crash-ordering case to verify against the DD6 argument. It also multiplies finalize rewrite volume by
+roughly the number of extra rounds, since every round rewrites the whole shard whatever it deletes — the reason section
+5.3's "I/O is unchanged" holds only while continuation is absent.
+
+**Prerequisite.** 9.1 first, because raising the ceiling is strictly cheaper per unit of deletion recovered than adding
+rounds.
+
+### 9.3 Sampling watermark
+
+**Buys.** Only useful with 9.2. Without it, every continuation round re-runs the sampler over all surviving traces,
+re-deciding traces earlier rounds already retained by verdict, so plugin work scales with rounds times survivors. A
+watermark — the last trace ID a capped round actually **decided** — lets the next round skip evaluation at or below it,
+which retains those traces, exactly the verdict they already had. Round count becomes `ceil(droppable / maxIDs)`,
+provable rather than hoped for.
+
+**Costs.** One more persisted field, and one sharp edge: the watermark must be set from the last trace *decided*, never
+the last trace *read*, or traces that were staged but never evaluated would be exempted from sampling forever.
+
+**Prerequisite.** 9.2.
+
+### 9.4 Bloom-filter pruning
+
+**Buys.** The only option that removes the deletion bound entirely rather than raising it: memory bounded with no
+retention loss at all.
+
+**Costs and prerequisite.** Section 8. It requires making the Phase-1 limit refillable — over-fetch and backfill after
+the core-scan join, or apply the cap post-join — which is a query-layer change worth doing on its own merits and is the
+hard prerequisite here. Until then this option is unavailable, not merely unattractive.
+
+## 10. Other rejected alternatives
+
+- **Unbounded exact set (status quo).** Residency scales with shard size, which is unbounded, and reserved heap is twice
+  live heap. Rejected.
+- **Swapping the index for binary search over the ascending `ids`.** Saves sixteen to thirty-two bytes per entry, but
+  `keepEncoded` runs once per secondary-index element and elements outnumber traces. Phase 6 measured the sorted slice at
+  2.3 to 3.6 times slower than the selected compact hash (`banyand/trace/drop_set_test.go:73-86`). Rejected.
+- **Spilling the drop set to disk with on-disk verification.** Bounded, exact, and it would preserve full deletion — but
+  on a heavy-drop merge most probes are true positives, so most lookups hit disk. Rejected on cost.
+- **Chunking the finalize round's part selection.** Would bound `N` by construction with no deletion loss. Rejected on
+  effectiveness, not complexity: whole-shard selection is what puts every fragment of a trace in the same merge set, so
+  chunking would leave cross-chunk fragmented traces permanently guard-deferred
+  (`banyand/trace/merger.go:1965-1995`) at a rate set by fragmentation, which is worse and less predictable than the
+  bound in section 5.2.
+
+## 11. Invariants
+
+Preserved unchanged:
+
+1. Secondary-index lookup remains exact. No probabilistic structure authorizes a deletion. *(Phase 6, verbatim.)*
+2. All physical blocks for one trace ID are assembled into exactly one sampler decision.
+3. The fragment guard pins and validates conjunction parts before any drop.
+4. Core and secondary-index outputs are introduced atomically.
+5. Timeout, panic, malformed-verdict, and plugin-error paths fail open.
+6. The pipeline-disabled path performs no drop-set work.
+7. Finalize round selection, generation stamping, persisted state, cooldown, and round cap are exactly as before.
+
+Introduced:
+
+8. **The drop set is complete with respect to the drops performed.** Recording and dropping stop at the same instant.
+9. **A secondary index contains exactly the entries of its part's retained traces** — no orphans, none missing.
+10. **Drop-set residency never exceeds the resolved budget**, and `full` is one-way within a merge.
+11. **The ceiling only ever converts a drop into a retention.** It never changes a retention into a drop, never
+    evaluates a partial trace, and never bypasses the guard for a trace that is dropped.
+12. **A capped merge's spared traces remain eligible for a later merge or round.** For hot merges this follows from
+    `FinalizeGen` min-propagation; for finalize, from the unchanged generation predicate — subject to the round bound in
+    section 5.2, which is a bound on deletion, not a correctness claim.
+
+## 12. Risks
+
+1. **Silent under-deletion.** The headline risk, and the one with no mitigation inside this design. A shard can reach its
+   lifetime round cap with millions of undeleted traces and look healthy. Mitigation: section 6's counter and warning log
+   are not optional, and section 9.1 is the cheapest response if the counter says the bound is being hit.
+2. **A protector-disabled node gets the worst ceiling and the least obvious lever.** Section 5.2: the flat fallback
+   applies regardless of RAM, and **neither** validation run can observe it: both execute under a limit, and the
+   capped-path run enables the protector explicitly via `--allowed-bytes`. Mitigation: documented in section 5.2 and at `resolveDropSetBudget`; the counter still fires, so the condition is
+   detectable even though the validation run will not surface it.
+3. **Retention grows storage.** Traces retained by ceiling occupy disk that the sampler intended to reclaim. The
+   finalize disk-headroom gate (`banyand/trace/finalizer.go:141`) still protects the write path, but a shard whose
+   sampling is ceiling-bound will not shrink as an operator expects. Belongs in operator documentation next to the
+   counter.
+4. **Ordering bias.** Section 4. Mitigation: documentation.
+5. **Guard probe interaction.** Skipping the guard for ceiling-retained traces changes how many bloom probes a merge
+   performs, so guard-probe metrics shift on capped merges. Expected, not a defect; assert it rather than be surprised.
+6. **Pool churn.** Sets above `maxPooledDroppedTraceIDBytes` (4 MiB) are not pooled, and every ceiling in section 3.4
+   exceeds it, so a capped merge's set is garbage rather than reused. Pre-existing behaviour; measure before changing the
+   pool bound.
+
+## 13. Execution
+
+The ticket-level breakdown, with per-ticket boundaries, tests, and rollback, is in
+[trace-drop-set-bounding-plan.md](trace-drop-set-bounding-plan.md). In outline: the mechanism lands inert (production
+budget zero, which the tracker treats as unlimited), and a single activation ticket turns it on and is the rollback
+boundary for the series.
+
+## 14. Open questions
+
+1. `dropSetAggregateDivisor = 16`. It sets both the memory bound and, through section 5.2, the lifetime deletion bound.
+   Settle before activation, because the exit-gate measurements are stated against it.
+2. Whether `maxRounds` should become operator-tunable. It is per-group in `finalizeConfig`
+   (`banyand/trace/pipeline_registry.go:132`) but the v1 proto carries no override field
+   (`banyand/trace/pipeline_registry.go:135-137`), so today the only lever on section 5.2's bound is memory. Not required
+   by this design; worth deciding separately.
diff --git a/docs/design/trace-pipeline-merge-optimization-plan.md b/docs/design/trace-pipeline-merge-optimization-plan.md
index c5c5c22b9..0216bb62b 100644
--- a/docs/design/trace-pipeline-merge-optimization-plan.md
+++ b/docs/design/trace-pipeline-merge-optimization-plan.md
@@ -2,7 +2,9 @@
 
 ## Status
 
-Proposed for review. Do not treat the targets in this document as frozen acceptance gates until they are approved.
+Execution record. Phases 1 through 9 are closed. The original Phase 3 resource targets are retained below as historical
+goals, together with their measured disposition; they are not reported as passed. Phase 10, the final serialized
+SkyWalking integration and acceptance run, is the only remaining phase.
 
 ## Opening Baseline (Before Adaptive Batching)
 
@@ -73,12 +75,12 @@ the gate. `/proc/self/io` counters remain diagnostic only.
 
 **Exit gate.**
 
-- [ ] CPU-set pinning in place alongside `GOMAXPROCS=4`.
-- [ ] Pre-dispatch and post-introduction pprof bases captured independently.
-- [ ] Environment capture (image digest, CPU set, filesystem, kernel, Go version, binary checksum, plugin checksum,
+- [x] CPU-set pinning in place alongside `GOMAXPROCS=2` in the canonical two-CPU, 4 GiB container.
+- [x] Pre-dispatch and post-introduction pprof bases captured independently.
+- [x] Environment capture (image digest, CPU set, filesystem, kernel, Go version, binary checksum, plugin checksum,
   storage device, clone method) recorded per suite.
-- [ ] Disabled/enabled series stability documented across ≥5 alternating runs.
-- [ ] Wall-time and CPU deltas are not compared until the disabled/enabled series are sufficiently stable.
+- [x] Disabled/enabled series stability documented across ≥5 alternating runs.
+- [x] Wall-time and CPU deltas are not compared until the disabled/enabled series are sufficiently stable.
 
 **Dependencies.** None.
 
@@ -87,6 +89,19 @@ detect deltas. This phase is the gate for evidence, not for performance. It meas
 the serialized integration workload already frozen by the performance-test design; capacity sweep and ingestion
 throughput calibration are outside this plugin-overhead plan.
 
+**Acceptance evidence.** The final Phase 1 suite is
+`.scratch/trace-pipeline-merge-performance/phase1-phase4-final-2c4g-v1/suite.json`, with its diagram-first report at
+`report.html`. It contains five serialized disabled runs and ten controlled runs alternating five disabled and five
+retain-all processes. Every run used CPU set `0-1`, `GOMAXPROCS=2`, a 4 GiB cgroup memory limit, a separately pinned
+controller, one shard, and complete image, binary, fixture, schedule, filesystem, device, and clone identities. All
+controlled runs captured distinct pre-dispatch and post-introduction heap, allocation, block, and mutex profiles plus a
+controlled CPU profile.
+
+The disabled controlled wall/CPU coefficients of variation were 0.729%/0.782%; retain-all was 1.220%/0.592%. The five
+serialized runs had 1.535% wall-time CV, 0.317% CPU CV, exact ledgers, 3,219 writes, 286 ordinary merges, and median
+logical write amplification of 0.9472. The controlled mature gate is the frozen, all-mature production-picker selection,
+not the unstable number of mature-containing selections produced during continuous writing.
+
 ---
 
 ### Phase 2 — Staging-Budget Correctness
@@ -139,8 +154,8 @@ the merge call. Invalid trace ordering rejected. Fragment-guard conjunction part
 - [x] Logical trace groups built incrementally with one descriptor per trace (first/last block indexes, accumulated
   min/max ts, staged-byte estimate, fragment-guard range).
 - [x] Pooled objects fully reset before reuse; race tests pass.
-- [ ] Controlled re-run demonstrates ≥50% reduction in allocated bytes and allocation count, ≥30% reduction in peak heap
-  and peak RSS.
+- [x] Original resource target disposition recorded from the final five-pair controlled series; unmet residuals are
+  quantified and assigned to the projection and common-I/O phases rather than reported as successful.
 
 **Dependencies.** Phase 1, Phase 2.
 
@@ -166,11 +181,18 @@ used 319.3 MiB allocated, 3,277,411 allocations, 161.8 MiB peak heap, and 180.7
 rows and all ledgers. Against the opening retain-all medians, those single-run deltas are approximately -5.8%, -15.5%,
 -19.6%, and -22.6%, respectively; they are diagnostic rather than an acceptance series.
 
-The remaining target is therefore open. The profiles show that the first fresh-process batch must still allocate the
-deep-copied payload, while the default 512 MiB staging budget lets this seed complete in one decision batch and gives the
-pools no within-run reuse. Phase 4's batch-size sweep is required to determine whether bounded chunk reuse can meet the
-allocation and peak-memory targets. Until that sweep completes, Phase 3 is structurally complete but not closed as a
-performance gate.
+The final five-pair alternating series closes the target investigation. Relative to the opening retain-all medians, the
+final retain-all medians changed as follows: allocated bytes from 350,463,856 to 278,189,568 (-20.62%), allocation count
+from 3,877,039 to 3,200,466 (-17.45%), peak heap from 185,520,488 to 118,567,352 (-36.09%), and peak RSS from 191,930,368
+to 172,855,296 (-9.94%). Only the original 30% peak-heap target passed; the 50% allocation targets and 30% RSS target did
+not pass.
+
+This result is explicitly accepted as the Phase 3 disposition, not relabeled as target success. Exact profiles show that
+the cold merge still requires timeout-safe ownership of the deep-copied trace payload, while decoder, writer, and common
+merge work remains in both variants. Removing that residual requires a safe projection-ownership/decode change in Phase
+7 or common merge-I/O work in Phase 8; more framework pooling would either retain too much memory or violate the timeout
+lifetime invariant. Wall and CPU values are recorded but are not credited as a speedup because filesystem timing remains
+an attribution risk.
 
 ---
 
@@ -191,11 +213,11 @@ causes complete-trace batch boundaries. Both byte and trace-count limits remain
 - [x] Every sampled merge reports peak charged staging bytes, batch bytes and trace count, flush reason, and peak
   concurrent staged bytes.
 - [x] Cold first-merge cost and subsequent same-process reuse are reported separately without changing the budget.
-- [ ] The serialized 24-hour workload validates naturally varying merge sizes under the canonical two-CPU, 4 GiB
+- [x] The serialized 24-hour workload validates naturally varying merge sizes under the canonical two-CPU, 4 GiB
   container and its resource-derived 256 MiB budget.
-- [ ] At least one naturally budget-limited merge, or explicit evidence that the production-shaped workload never
+- [x] At least one naturally budget-limited merge, or explicit evidence that the production-shaped workload never
   reaches the limit, is documented without manufacturing smaller batches.
-- [ ] Core and secondary-index ledgers, complete-trace decisions, peak heap, peak RSS, allocations, plugin calls, CPU
+- [x] Core and secondary-index ledgers, complete-trace decisions, peak heap, peak RSS, allocations, plugin calls, CPU
   time, wall time, and logical write amplification remain reported.
 
 **Dependencies.** Phase 3.
@@ -242,6 +264,26 @@ instead of the cold merge's five. Peak staged memory remained 27.25 MiB and ever
 in this diagnostic includes the history of earlier merges in the same process and must not be interpreted as an isolated
 per-merge RSS delta.
 
+**Final full-day validation.** The current-commit report is
+`.scratch/trace-pipeline-merge-performance/phase4-final-2c4g-v2/pilot/report.json` at commit `742c2dc8`. It replayed all
+3,219 writes in serialized publication/merge order, completed 286 ordinary MERGE rounds, and then performed one cooled
+FINALIZE. The primary trajectory contained input selections from 8 to 15 parts, 8 to 147,126 rows, and 5,631 to
+36,948,453 compressed bytes, with 281 distinct input-byte sizes and depth ranges from `(0,0)` through `(2,4)`.
+
+All ordinary rounds correctly bypassed sampling because each selected set contained hot data. FINALIZE selected 20
+mature parts and processed 325,570 rows containing 74,576 complete traces. Ten sampler calls retained every trace, with
+zero drops, oversized bypasses, lossless retries, or ledger differences. Core, `latency`, and `start_time` ledgers all
+matched, and logical write amplification was 0.9639.
+
+The final selection's metadata estimate was 190,169,855 bytes. The unchanged 4 GiB resource formula produced a
+268,435,456-byte hard staging ceiling, while the adaptive planner chose a 31,694,976-byte preferred decision limit and
+six planned batches. Runtime charging totaled 307,138,095 bytes across the decisions and peaked at 31,698,325 live
+staged bytes. Thus natural production-shaped input did trigger adaptive byte-limit batching, but it did not approach the
+hard ceiling because the lower preferred limit controlled the live set as designed. Primary wall/CPU time was
+96.27/55.68 seconds with 963,196,888 allocated bytes; cooldown wall/CPU time was 15.04/15.14 seconds with 480,141,576
+allocated bytes. Process cgroup peak was 296,116,224 bytes, 6.9% of the 4 GiB limit. Separate primary and cooldown CPU,
+heap, allocation, block, and mutex profiles accompany the report.
+
 ---
 
 ### Phase 5 — Decision Path Overhead
@@ -301,18 +343,72 @@ filtering and secondary-index pruning costs reported separately.
 
 **Exit gate.**
 
-- [ ] Duplication between per-batch mature-drop set and merge-wide dropped-ID set removed.
-- [ ] Each dropped trace ID stored once.
-- [ ] Compact exact lookup representation for secondary-index pruning evaluated and selected.
-- [ ] Bounded drop-set storage reused between batches.
-- [ ] Guard confirmation objects constructed only when plugin proposes a drop.
-- [ ] Sweep at 1% / 35% / 99% deletion ratios completed; fixed cost and nonlinear behavior documented.
+- [x] Duplication between per-batch mature-drop set and merge-wide dropped-ID set removed.
+- [x] Each dropped trace ID stored once.
+- [x] Compact exact lookup representation for secondary-index pruning evaluated and selected.
+- [x] Bounded drop-set storage reused between batches.
+- [x] Guard confirmation objects constructed only when plugin proposes a drop.
+- [x] Sweep at 1% / 35% / 99% deletion ratios completed; fixed cost and nonlinear behavior documented.
 
 **Dependencies.** Phase 4, Phase 5.
 
 **Boundary rationale.** Different workload characteristic from retain-all. The original plan explicitly defers this
 until retain-all overhead is controlled; honoring that deferral keeps the comparison meaningful.
 
+**Implementation.** An effective decision mask now replaces the temporary per-batch drop map. A confirmed drop is
+appended directly to one merge-wide collector, while a guard-deferred proposal is changed to retain in the same mask.
+The sorted staged groups and sorted decision trace IDs are then walked together, eliminating a second lookup during core
+output. The collector records each trace ID once in core merge order and is acquired lazily on the first confirmed drop.
+Its ID and lookup storage is returned after SIDX publication to a 4 MiB aggregate-bounded BanyanDB internal pool; this is
+a reuse bound, not a limit on a live merge. Oversized collectors remain correct and are discarded instead of pooled.
+
+SIDX pruning lazily builds an open-addressed exact index over the collected IDs. Each slot stores a 32-bit hash
+fingerprint and an ID-vector offset, but a fingerprint match is always followed by an exact byte comparison. Therefore a
+collision cannot authorize deletion. Unknown or malformed encodings fail open. The predicate compares encoded bytes
+without constructing a string per SIDX row. The fragment guard is still entered only for a plugin-proposed drop, and
+only a confirmed guard decision reaches the collector.
+
+**Exact-lookup evaluation.** A five-sample microbenchmark used 33,353 service-prefixed IDs and 33,353 lookups per
+operation. All candidates performed zero measured allocations during lookup. Median times were:
+
+| Deletion ratio | Go map | Sorted slice | Selected compact hash |
+| ---: | ---: | ---: | ---: |
+| 1% | 0.707 ms | 2.581 ms | 1.136 ms |
+| 35% | 1.271 ms | 5.973 ms | 1.711 ms |
+| 99% | 1.443 ms | 8.923 ms | 2.492 ms |
+
+The Go map is the fastest isolated lookup, but it has bucket overhead and previously participated in duplicate
+per-batch and merge-wide storage. The sorted vector has the smallest auxiliary representation but is 2.3-3.6 times
+slower than the compact hash. The compact hash was selected because it keeps one ordered ID vector, uses packed slots,
+preserves exactness, and its full-merge results below reduce both CPU and allocation cost. Evidence is in
+`.scratch/trace-pipeline-merge-performance/phase6-drop-set-benchmark-v2.txt`.
+
+**Controlled deletion sweep.** Before and after results are medians of five fresh two-CPU, 4 GiB Docker processes over
+the immutable 15-part mature selection. The 1%, 35%, and 99% configurations produced 325, 11,778, and 33,032 effective
+drops; the fragment guard deferred 0, 1, and 12 plugin proposals respectively. Every run matched the exact core,
+`latency`, and `start_time` oracles.
+
+| Effective deletion | Wall | CPU | Allocated bytes | Allocations | Peak heap | SIDX time |
+| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| 0.974% | -1.21% | -1.96% | -4.60% | -8.40% | -2.91% | -3.78% |
+| 35.313% | -0.72% | -0.61% | -4.68% | -9.64% | -1.13% | -4.30% |
+| 99.038% | -2.81% | -2.11% | -7.75% | -13.48% | -7.40% | -3.43% |
+
+Peak RSS changed by -3.17%, +2.86%, and +6.77%; unlike peak heap, this process-level high-water mark did not track the
+drop-set live storage and is not credited as an improvement. One low wall-time outlier made the after 1% wall-time
+coefficient of variation 8.17%, and a low baseline outlier made the before 35% coefficient 7.59%; the resource and
+correctness conclusions do not depend on those timing samples. Baseline and optimized reports are in
+`.scratch/trace-pipeline-merge-performance/phase6-before-v1` and
+`.scratch/trace-pipeline-merge-performance/phase6-after-v1`.
+
+The fixed component is the 294,252 SIDX predicate invocations across two indexes: removing the escaping decode string
+eliminated approximately 294,000 allocations at every ratio. The nonlinear components are the collector/index size and
+probe cost, which grow with confirmed drops, while core and SIDX output writes shrink as more traces are removed. No
+pathological growth appeared at 99%: allocated bytes and wall/CPU time were lowest there. A final one-run diagnostic
+reported core versus combined SIDX elapsed time as 2,207.5/401.7 ms at 1%, 2,138.1/374.0 ms at 35%, and
+1,936.0/206.5 ms at 99%. Its reports are in
+`.scratch/trace-pipeline-merge-performance/phase6-breakdown-v1`.
+
 ---
 
 ### Phase 7 — Projection Path Optimization
@@ -327,17 +423,54 @@ Deep-copy lifetime protection retained unless an equally safe ownership mechanis
 
 **Exit gate.**
 
-- [ ] Copied tag values and span bodies packed into column arenas.
-- [ ] Aggregate block and column vectors reused.
-- [ ] Columns decoded only when requested by the combined plugin projection.
-- [ ] Ref-counted immutable batch buffers (if adopted) demonstrated safe with timed-out plugins.
-- [ ] Real-policy benchmark (e.g. error/status rules + regex/tag rules) shows measurable improvement.
+- [x] Copied tag values and span bodies packed into column arenas.
+- [x] Aggregate block and column vectors reused.
+- [x] Unique raw blocks decode only columns requested by the combined plugin projection; fragmented traces retain the
+  existing full decode required to consolidate their physical blocks into one output block.
+- [x] Ref-counting was not adopted. Timed-out batches discard their immutable arenas rather than resetting or pooling
+  them, and a blocking-plugin test proves that their bytes remain unchanged after the merge returns.
+- [x] The default SkyWalking real-policy workload shows a measurable improvement on the frozen mature fixture.
 
 **Dependencies.** Phase 3.
 
 **Boundary rationale.** Fundamentally different code path from the retain-all work. Separate phase keeps the diff
 reviewable and prevents attribution confusion in the final integration report.
 
+**Implementation and evidence.** `TagColumn.AtInto` lets a plugin reuse one decoded `sdk.Value`; the SkyWalking duration
+and dedicated-error paths use it. The merge no longer disables raw output merely because a projection is present. A
+unique physical trace block is kept in raw output form while only requested tag/span columns are decoded into an owned
+per-trace `pkg/bytes.Buffer`. Aggregate trace-block, tag-column, tag-value, span, and span-ID vectors are bounded and
+reused. A fragmented trace still takes the decoded consolidation path because its physical blocks must become one
+ordered output block, but only projected data is copied into the decision batch. Both paths preserve the read-only SDK
+contract. Normal completion resets the arenas; timeout completion discards them so a late plugin cannot observe recycled
+memory.
+
+The focused five-run SDK comparison reduced the median SkyWalking duration-rule cost from 247.5 to 154.4 ns/trace
+(-37.6%) and the dedicated-error cost from 126.6 to 88.86 ns/trace (-29.8%). The Zipkin duration path fell from 240.5 to
+154.6 ns/trace (-35.7%); its in-array error path does not use `AtInto` and remained statistically unchanged.
+
+The 24-hour accelerated default-policy check used the same two-CPU, 4 GiB container, full two-times fixture, default
+SkyWalking configuration, and frozen ledgers before and after the implementation. Both runs evaluated 74,576 complete
+traces, dropped exactly 26,380, retained 48,196, reproduced verdict SHA
+`e1be6f66e676dc95d33223585f59a648da7556f6c98af1f13801978fd2b19107`, and preserved all core and secondary-index
+ledgers at a 35.3733104484% deletion ratio. For the sampling cooldown, wall time changed from 14.862 to 4.828 seconds
+(-67.5%), CPU from 15.116 to 4.664 seconds (-69.1%), allocated bytes from 1,022,124,168 to 636,793,768 (-37.7%), and
+allocations from 16,046,788 to 8,254,193 (-48.6%). Physical write bytes fell 96.5% primarily because Phase 8 removed
+pathological common writer flushes; that reduction is not credited to projection work. The single-run cgroup peak rose
+7.5% (240,168,960 to 258,064,384 bytes), so Phase 10 must remeasure resident memory as a multi-run integration series
+rather than treating this one run as a memory improvement. Evidence is under
+`.scratch/trace-pipeline-merge-performance/phase789-before-skywalking` and `phase789-final-skywalking`.
+
+A second acceptance series exercised one frozen mature production-picker selection in ten fresh Docker processes,
+strictly alternating five base and five optimized runs. Every run evaluated 33,353 complete traces, dropped 11,598
+after exact fragment-guard confirmation, and reproduced all three expected ledgers. The base and optimized coefficients
+of variation were 0.80%/0.78% for wall time and 0.75%/1.07% for CPU. Median wall time changed from 6.304 to 2.598 seconds
+(-58.8%), CPU from 6.551 to 2.638 seconds (-59.7%), allocated bytes from 524,554,048 to 343,743,000 (-34.5%), and
+allocations from 7,279,373 to 3,720,275 (-48.9%). Peak RSS rose 7.4%, within the 10% controlled tolerance; peak Go heap
+rose 22.1% and is carried into Phase 10 rather than hidden. The combined timing includes Phase 8 common-I/O gains, while
+the SDK microbench and allocation profile isolate the projection contribution. Alternating evidence is under
+`.scratch/trace-pipeline-merge-performance/phase7-controlled-alternating-v1`.
+
 ---
 
 ## Parallel Workstreams
@@ -355,14 +488,48 @@ plugin-framework optimization.
 
 **Exit gate.**
 
-- [ ] Each axis profiled with before/after evidence.
-- [ ] Disabled-mode baseline regression test passing within tolerance.
+- [x] Each axis profiled with before/after evidence.
+- [x] Disabled-mode baseline correctness and resource regression gates pass within the 10% median tolerance.
 
 **Dependencies.** None (parallel workstream).
 
 **Boundary rationale.** Independent of the plugin framework. Runs as a workstream that may overlap with any core
 phase. The "not credited as plugin optimization" invariant prevents scope-creep across phases.
 
+**Implementation and evidence.** The uncached sequential writer now buffers small writes and performs its durability
+sync plus cache-drop at close instead of flushing and advising the kernel after every `Write`. Sequential readers retain
+per-read cache advice because batching it produced a repeatable resident-memory regression; they also advise the whole
+file at close. Read-only files no longer issue an fsync on `Close`, and a file already synchronized by its sequential
+writer is not synchronized a second time. Trace and SIDX block writers now close both the sequential wrapper and the
+retained base file, making descriptor ownership explicit. The core and SIDX atomic publication barriers remain
+unchanged.
+
+Five fresh disabled-mode runs before and after the change used the identical selection SHA
+`45aa16460d7ca36fc0ddaa1bc1d2e73f45109dbaab86328012798d5011e60b7b`, 147,126 rows, byte-identical core/latency/
+start-time ledgers, and the two-CPU, 4 GiB container:
+
+| Metric | Before median | After median | Change | After CV |
+| --- | ---: | ---: | ---: | ---: |
+| Wall time | 7.312 s | 2.432 s | -66.7% | 0.53% |
+| CPU time | 7.340 s | 2.384 s | -67.5% | 0.48% |
+| Allocated bytes | 203,043,568 | 195,628,368 | -3.7% | 1.43% |
+| Allocations | 2,811,223 | 2,798,380 | -0.5% | 0.005% |
+| Physical write bytes | 958,722,048 | 40,251,392 | -95.8% | 0.0% |
+| Peak Go heap | 83,148,744 | 79,303,784 | -4.6% | 24.00% |
+| Peak RSS | 125,186,048 | 132,263,936 | +5.7% | 16.70% |
+
+The peak series contains one Go-GC outlier, but both medians remain within the fixed 10% regression tolerance; end RSS
+also fell 4.4%. An earlier 256 KiB read-advice batching attempt produced a +27.8% peak-RSS median and was rejected. The
+accepted implementation restores per-read advice, trading some syscall reduction for bounded residency.
+
+Syscall evidence isolates the accepted mechanism: `fadvise64` calls fell from 1,135,840 to 635,093 (-44.1%), writes from
+500,772 to 8,960 (-98.2%), and fsync calls from 1,356 to 15 (-98.9%), while the 49 `fdatasync` calls and six publication
+renames were unchanged. The remaining advice calls are the intentionally retained reader behavior. Before profiles
+attributed 61–69% cumulative CPU to `seqWriter.Write`, 42–44% to `Fadvise`, and 27–31% to `Flush`; the accepted five-run
+series still cuts CPU 67.5%. The two SIDX children retained approximately the same absolute time, so no SIDX-specific
+storage rewrite was justified. Evidence is under `.scratch/trace-pipeline-merge-performance/phase8-disabled-final-v5`
+and `phase8-strace-final-v3`.
+
 ---
 
 ### Phase 9 — Plugin-Local Benchmarks
@@ -377,9 +544,9 @@ fixes are kept separate from framework fixes.
 
 **Exit gate.**
 
-- [ ] Independent measurements for projected tag/span decoding, complete-trace latency calculation, error and status
-  rules, trace-ID hashing, regex/tag rules, verdict allocation, decision throughput across representative batch sizes.
-  *Every axis is measured (table below), but on SYNTHETIC batches, not the mature seed — see "Remaining gap".*
+- [x] Independent measurements for projected tag/span decoding, complete-trace latency calculation, error and status
+  rules, trace-ID hashing, regex/tag rules, verdict allocation, and decision throughput across representative batch
+  sizes use complete traces from the frozen mature seed.
 - [x] Each plugin-local cost attributed to a specific function call site.
 
 **Dependencies.** None (parallel workstream).
@@ -442,13 +609,52 @@ real capture, at the cost of drifting from the seed) or making the loader reacha
 framework change). Both are out of scope for the plugin-local workstream, so the item stays open deliberately rather
 than being closed on synthetic data.
 
-**Remaining gap (why this phase is not closed).** The hard invariant requires plugins to be measured "against
-representative complete-trace batches from the mature seed". These benchmarks build their batches synthetically in
-`benchBatch`/`benchEntries` — realistic in SHAPE (production tag keys, both first-party configs, complete traces) but
-not drawn from the frozen selection. The machinery to close this exists — `tracefixture.EvaluateSampler` already drives
-a sampler over complete generated traces via `buildSamplerBlock` — so the work is to add a seed-backed benchmark
-alongside the synthetic ones, not to build a fixture. Until then the first exit-gate item stays open and no
-production-ratio claim should be made from the numbers above.
+**Mature-seed benchmark.** `SamplerBatchBuilder` materializes complete logical traces in schedule order with only the
+requested projection. The opt-in benchmark reads the immutable mature source, frozen catalog/schedule, expected sampler
+artifact, and real plugin. Its preflight rejects malformed verdict lengths, nondeterministic decisions, input mutation,
+missing source traces, cancellation, and default-policy verdict drift. The test reproduces 74,576 evaluated traces,
+26,380 drops, and the authoritative 35.3733104484% ratio before any timing begins.
+
+The following values are medians of five runs at three full-fixture decisions per run on two CPUs. The normal policy
+cases use 512-trace complete batches; bytes and allocations are the verdict slices only (74,592 B/op and 146 allocs/op).
+
+| Mature-seed axis | Median ns/trace |
+| --- | ---: |
+| Complete-trace duration envelope | 305.2 |
+| Dedicated error column | 169.1 |
+| Trace-ID hash/sample | 40.24 |
+| Tag equals | 196.5 |
+| Tag regex | 240.8 |
+| HTTP status regex | 254.2 |
+| Default SkyWalking policy | 473.4 |
+| Projected span-body traversal | 17.12 |
+| Projected span-ID traversal | 13.64 |
+
+Batch-size evidence separates policy work from verdict allocation:
+
+| Complete traces/batch | 1 | 16 | 64 | 256 | 512 | 4,096 | 8,192 | 16,384 |
+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| Default policy, ns/trace | 531.9 | 508.1 | 499.8 | 493.9 | 482.9 | 500.2 | 483.0 | 462.9 |
+| Verdict-only, ns/trace | 20.52 | 6.261 | 5.614 | 5.314 | 5.419 | 5.195 | 5.252 | 5.158 |
+| Verdict allocations/op | 74,576 | 4,661 | 1,166 | 292 | 146 | 19 | 10 | 5 |
+
+The verdict buffer remains one boolean per trace and one allocation per batch; there is no hidden per-trace allocation.
+SkyWalking's default sampler deliberately requests no span bodies, so there is no honest plugin-local span parser to
+time. The two span rows above build the real seed with `Spans` or `SpanIDs` projection and measure traversal of every
+projected value; raw-column decode and arena ownership are measured at the Phase 7 merge boundary. This separation avoids
+inventing a non-production parser merely to populate a benchmark cell.
+The default-policy CPU profile attributes the real-seed work to `Sampler.hasSlowTrace`, `TagColumn.AtInto`,
+`DecodeTagValueInto`, `Sampler.hasErrorColumn`, and `hash/fnv.(*sum64a).Write`, matching the synthetic call-site study.
+Raw results, medians, and profiles are under
+`.scratch/trace-pipeline-merge-performance/phase9-seed-benchmark`.
+
+**Follow-up optimization disposition.** The plugin-local optimization follow-up is complete. It measured and rejected
+two additional rewrites: replacing the existing per-entry SIMD-assisted `IndexByte` calls with one scalar scan regressed
+the representative paths by 47-73%, while changing tag matching from rules-outer to entries-outer regressed them by
+28-34%. Refining the latter with precomputed rule operands did not recover the lost inlining. Both experiments were
+reverted, leaving the measured faster implementation unchanged. No plugin optimization or plugin branch remains to be
+integrated before Phase 10.
+
 
 ---
 
@@ -472,7 +678,7 @@ merge grace unchanged. No unfinished queued, running, or in-flight merge work.
 - [ ] No regression in pipeline-disabled baseline.
 - [ ] All proposed targets met (or explicitly accepted with quantified impact).
 
-**Dependencies.** Phase 4, Phase 6, Phase 7 (and Phase 8 / Phase 9 if those axes feed into the final run).
+**Dependencies.** Phases 4, 6, 7, 8, and 9; all are closed.
 
 **Boundary rationale.** Final acceptance gate. Only the targets frozen here become blocking.
 
@@ -504,22 +710,23 @@ Phase 8: Common Merge I/O
 Phase 9: Plugin-Local Benchmarks
 ```
 
-## Targets Becoming Blocking
+## Original Target Disposition
 
-These targets are proposals for review and are not yet frozen gates.
+The first targets were hypotheses about how much of the opening retain-all cost was removable framework allocation. The
+final controlled evidence preserves them as historical targets instead of silently reweighting them after measurement.
 
-| Metric | Current extra cost | Proposed first target |
-| --- | ---: | --- |
-| Allocated bytes | 121.9 MiB | Reduce by at least 50% |
-| Allocation count | 1.07 million | Reduce by at least 50% |
-| Peak Go heap | 91.5 MiB | Reduce by at least 30% |
-| Peak RSS | 98.4 MiB | Reduce by at least 30% |
-| Pipeline-disabled performance | Baseline | No regression greater than 5% |
-| Logical correctness | Lossless | No change allowed |
+| Metric | Opening retain-all median | Final retain-all median | Change | Original target | Disposition |
+| --- | ---: | ---: | ---: | ---: | --- |
+| Allocated bytes | 350,463,856 | 278,189,568 | -20.62% | -50% | Not met; projection/common-I/O residual |
+| Allocation count | 3,877,039 | 3,200,466 | -17.45% | -50% | Not met; projection/common-I/O residual |
+| Peak Go heap | 185,520,488 | 118,567,352 | -36.09% | -30% | Met |
+| Peak RSS | 191,930,368 | 172,855,296 | -9.94% | -30% | Not met; later-phase residual |
+| Logical correctness | Lossless | Lossless | No change | No change | Met |
 
-Until Phase 1 closes, no target is blocking. After Phase 4, the 50% allocation reduction and 30% heap/RSS reduction
-become blocking. After Phase 6, the deletion ratio near 35% becomes blocking. Wall-time and CPU targets remain
-**non-blocking** until CPU pinning and repeated runs reduce environmental variance below the current 9.87% CV.
+Phase 3 and Phase 4 close with this quantified acceptance. This does not waive final integration acceptance: Phase 10
+must report the residual against the then-current disabled baseline and either meet the final product budget or explicitly
+accept its measured impact. Wall-time and CPU deltas remain non-blocking and are never interpreted as a pipeline speedup
+solely because the retain-all median is lower.
 
 ## Validation Checklists (per phase)
 
diff --git a/docs/design/trace-pipeline-merge-performance-test.md b/docs/design/trace-pipeline-merge-performance-test.md
index 5311834d0..224c13d0b 100644
--- a/docs/design/trace-pipeline-merge-performance-test.md
+++ b/docs/design/trace-pipeline-merge-performance-test.md
@@ -129,6 +129,56 @@ That run was a framework and adaptive-budget validation, not the SkyWalking resu
 MERGE-plus-FINALIZE pilot is recorded below. Repeated processes are still required before drawing timing-regression
 conclusions; single runs prove integration and correctness rather than stable performance deltas.
 
+### Final Phase 1 and Phase 4 Acceptance
+
+The final controlled measurement suite is
+`.scratch/trace-pipeline-merge-performance/phase1-phase4-final-2c4g-v1/suite.json`; its diagram-first HTML report is in
+the same directory as `report.html`. The suite identifies source commit `7f685a1d`, source-patch SHA-256
+`6164eb5146b350a90c4d1beba153e31e534cd9ceedf8f3b5a48a32adcc7b7a0f`, benchmark binary SHA-256
+`76fbfec2817b338ed42ae125a6e3b57f6b75a7c101a006772922c768413b8fae`, fixture SHA-256
+`8c9289bed26d7696a44b4937c5670b2709707b03904cf9de3241d279d4081438`, and schedule SHA-256
+`f7b651db0fe965362696139d19bc9ec452269868bba236e3e3b5615830652bcd`.
+
+All five serialized disabled runs and all ten controlled alternating runs passed. The environment was the canonical
+two-CPU, 4 GiB Docker envelope with data CPU set `0-1`, `GOMAXPROCS=2`, swap disabled, a separate controller cgroup, one
+shard, and complete image, kernel, filesystem, storage-device, clone-method, plugin, and binary identities. Each
+controlled run captured pre-dispatch and post-introduction heap, allocation, block, and mutex profiles plus a controlled
+CPU profile. No required profile or environment field was missing.
+
+The controlled results are:
+
+| Variant | Wall median | Wall CV | CPU median | CPU CV | Allocated median | Allocations median | Peak heap median | Peak RSS median |
+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| Disabled | 7.312 s | 0.729% | 7.340 s | 0.782% | 203,043,568 B | 2,811,223 | 83,148,744 B | 125,186,048 B |
+| Retain-all | 6.640 s | 1.220% | 6.778 s | 0.592% | 278,189,568 B | 3,200,466 | 118,567,352 B | 172,855,296 B |
+
+Both series are stable enough to expose resource deltas. Retain-all remains 37.01% higher in allocated bytes, 13.85%
+higher in allocation count, 42.60% higher in peak heap, and 38.08% higher in peak RSS than the current disabled mode.
+The lower retain-all wall and CPU medians are not claimed as a speedup: filesystem work remains a confounding component,
+and this benchmark credits only attributable structural and resource changes.
+
+Against the opening retain-all medians, the final series reduced allocated bytes by 20.62%, allocation count by 17.45%,
+peak heap by 36.09%, and peak RSS by 9.94%. The original 50% allocation goals and 30% RSS goal were not met; the 30% heap
+goal was met. This is a quantified target disposition, not a reweighted pass. The remaining cold payload ownership,
+projection/decode, writer, and common merge work is assigned to the later projection and common-I/O phases.
+
+The exact-current-commit full-day retain-all report is
+`.scratch/trace-pipeline-merge-performance/phase4-final-2c4g-v2/pilot/report.json` at commit `742c2dc8`. It published
+all 3,219 writes, reproduced 286 ordinary MERGE rounds, and then completed one cooled FINALIZE. Ordinary input selections
+ranged from 8 to 15 parts, 8 to 147,126 rows, and 5,631 to 36,948,453 compressed bytes; 281 of the 286 selections had
+distinct byte sizes. All ordinary rounds contained hot input and made no sampler call. The cooled round selected 20
+mature parts, evaluated and retained all 74,576 complete traces and 325,570 rows in ten calls, and reconciled the core,
+`latency`, and `start_time` ledgers with zero drops, oversized bypasses, or lossless retries.
+
+The cooled selection's 190,169,855-byte metadata estimate retained the resource-derived 268,435,456-byte hard ceiling.
+The adaptive planner chose a 31,694,976-byte preferred decision limit and six planned batches. Runtime charging totaled
+307,138,095 bytes across decisions and peaked at 31,698,325 simultaneously staged bytes. This naturally triggers
+preferred byte-limit batching while demonstrating that the hard ceiling is not approached for this production-shaped
+day. Primary wall/CPU time was 96.27/55.68 seconds with 963,196,888 allocated bytes. Cooldown wall/CPU time was
+15.04/15.14 seconds with 480,141,576 allocated bytes. Cgroup peak memory was 296,116,224 bytes, or 6.9% of the 4 GiB
+container limit, and logical write amplification was 0.9639. Primary and cooldown CPU, heap, allocation, block, and mutex
+profiles are stored separately beside the report.
+
 ### Dropping-Output Oracle and Selectivity Matrix
 
 Dropping variants no longer reuse the lossless ledger gate. Before the measured data-node process starts, a separate
diff --git a/pkg/fs/local_file_system.go b/pkg/fs/local_file_system.go
index 61492e530..2e4a5673a 100644
--- a/pkg/fs/local_file_system.go
+++ b/pkg/fs/local_file_system.go
@@ -41,9 +41,11 @@ type localFileSystem struct {
 
 // LocalFile implements the File interface.
 type LocalFile struct {
-	file   *os.File
-	ioSize int
-	cached bool // Caching decision from upper layer
+	file      *os.File
+	ioSize    int
+	cached    bool // Caching decision from upper layer
+	writable  bool
+	seqSynced bool
 }
 
 // NewLocalFileSystem is used to create the Local File system.
@@ -78,6 +80,12 @@ func limit2IOSize(limit uint64) int {
 	return max(4*1024, min(256*1024, int(ioSize)))
 }
 
+func applyFadviseBestEffort(file *os.File, offset, length int64) {
+	if adviseErr := applyFadviseToFD(file.Fd(), offset, length); adviseErr != nil {
+		return
+	}
+}
+
 func readErrorHandle(operation string, err error, name string, size int) (int, error) {
 	switch {
 	case errors.Is(err, io.EOF):
@@ -150,8 +158,9 @@ func (fs *localFileSystem) CreateFile(name string, permission Mode) (File, error
 	switch {
 	case err == nil:
 		return &LocalFile{
-			file:   file,
-			ioSize: fs.ioSize,
+			file:     file,
+			ioSize:   fs.ioSize,
+			writable: true,
 		}, nil
 	case os.IsExist(err):
 		return nil, &FileSystemError{
@@ -520,6 +529,9 @@ func (fs *localFileSystem) CreateHardLink(srcPath, destPath string, filter func(
 // Write adds new data to the end of a file.
 func (file *LocalFile) Write(buffer []byte) (int, error) {
 	size, err := file.file.Write(buffer)
+	if size > 0 {
+		file.seqSynced = false
+	}
 	switch {
 	case err == nil:
 		return size, nil
@@ -547,6 +559,9 @@ func (file *LocalFile) Writev(iov *[][]byte) (int, error) {
 	var size int
 	for _, buffer := range *iov {
 		wsize, err := file.file.Write(buffer)
+		if wsize > 0 {
+			file.seqSynced = false
+		}
 		switch {
 		case err == nil:
 			size += wsize
@@ -573,8 +588,9 @@ func (file *LocalFile) Writev(iov *[][]byte) (int, error) {
 
 // SequentialWrite supports appending consecutive buffers to the end of the file.
 func (file *LocalFile) SequentialWrite() SeqWriter {
+	file.seqSynced = false
 	writer := generateWriter(file.file, file.ioSize)
-	return &seqWriter{writer: writer, file: file.file, fileName: file.file.Name(), skipFadvise: file.cached}
+	return &seqWriter{writer: writer, file: file.file, owner: file, fileName: file.file.Name(), skipFadvise: file.cached}
 }
 
 // SequentialRead is used to read the entire file using streaming read.
@@ -588,7 +604,7 @@ func (file *LocalFile) SequentialRead() SeqReader {
 	_, _ = file.file.Seek(0, 0)
 
 	reader := generateReader(file.file, file.ioSize)
-	return &seqReader{reader: reader, file: file.file, fileName: file.file.Name(), length: 0, skipFadvise: file.cached}
+	return &seqReader{reader: reader, file: file.file, fileName: file.file.Name(), skipFadvise: file.cached}
 }
 
 // Read is used to read a specified location of file.
@@ -647,8 +663,10 @@ func (file *LocalFile) Path() string {
 
 // Close is used to close File.
 func (file *LocalFile) Close() error {
-	if err := syncFile(file.file); err != nil {
-		return err
+	if file.writable && !file.seqSynced {
+		if err := syncFile(file.file); err != nil {
+			return err
+		}
 	}
 
 	if err := file.file.Close(); err != nil {
@@ -670,12 +688,10 @@ type seqReader struct {
 
 func (i *seqReader) Read(p []byte) (int, error) {
 	rsize, err := i.reader.Read(p)
-	if rsize > 0 && i.file != nil && !i.skipFadvise {
-		offset := i.length
-		// Apply fadvise directly without threshold checking since decision was made at upper layer
-		_ = applyFadviseToFD(i.file.Fd(), offset, int64(rsize))
-		i.length += int64(rsize)
-	} else if rsize > 0 {
+	if rsize > 0 {
+		if i.file != nil && !i.skipFadvise {
+			applyFadviseBestEffort(i.file, i.length, int64(rsize))
+		}
 		i.length += int64(rsize)
 	}
 	if err != nil {
@@ -692,7 +708,7 @@ func (i *seqReader) Path() string {
 func (i *seqReader) Close() error {
 	if i.file != nil {
 		if !i.skipFadvise {
-			_ = applyFadviseToFD(i.file.Fd(), 0, 0)
+			applyFadviseBestEffort(i.file, 0, 0)
 		}
 	}
 	releaseReader(i.reader)
@@ -702,6 +718,7 @@ func (i *seqReader) Close() error {
 type seqWriter struct {
 	writer      *bufio.Writer
 	file        *os.File
+	owner       *LocalFile
 	fileName    string
 	length      int64
 	skipFadvise bool
@@ -709,22 +726,9 @@ type seqWriter struct {
 
 func (w *seqWriter) Write(p []byte) (n int, err error) {
 	n, err = w.writer.Write(p)
-	if n > 0 && w.file != nil && !w.skipFadvise {
-		if flushErr := w.writer.Flush(); flushErr != nil {
-			return n, &FileSystemError{
-				Code:    flushError,
-				Message: fmt.Sprintf("Flush File error, directory: %s, error: %s", w.fileName, flushErr),
-			}
-		}
-
-		offset := w.length
-		// Apply fadvise directly without threshold checking since decision was made at upper layer
-		_ = applyFadviseToFD(w.file.Fd(), offset, int64(n))
-		w.length += int64(n)
-	} else if n > 0 {
+	if n > 0 {
 		w.length += int64(n)
 	}
-
 	if err != nil {
 		return n, &FileSystemError{
 			Code:    writeError,
@@ -762,6 +766,9 @@ func (w *seqWriter) Close() error {
 			Message: fmt.Sprintf("Sync File error, directory name: %s, error message: %s", w.fileName, syncErr),
 		}
 	}
+	if w.owner != nil {
+		w.owner.seqSynced = true
+	}
 	return nil
 }
 
diff --git a/pkg/fs/local_file_system_test.go b/pkg/fs/local_file_system_test.go
index d97012da1..bce1b561a 100644
--- a/pkg/fs/local_file_system_test.go
+++ b/pkg/fs/local_file_system_test.go
@@ -321,6 +321,35 @@ var _ = ginkgo.Describe("Local File System", func() {
 			gomega.Expect(closeErr).To(gomega.HaveOccurred())
 		})
 
+		ginkgo.It("SeqWriter buffers writes and synchronizes its owner once", func() {
+			localFile, ok := file.(*LocalFile)
+			gomega.Expect(ok).To(gomega.BeTrue())
+			seqWriter := file.SequentialWrite()
+			_, writeErr := seqWriter.Write([]byte("a"))
+			gomega.Expect(writeErr).ToNot(gomega.HaveOccurred())
+			gomega.Expect(localFile.seqSynced).To(gomega.BeFalse())
+			sizeBeforeClose, sizeErr := file.Size()
+			gomega.Expect(sizeErr).ToNot(gomega.HaveOccurred())
+			gomega.Expect(sizeBeforeClose).To(gomega.Equal(int64(0)), "small sequential writes must remain buffered")
+			gomega.Expect(seqWriter.Close()).To(gomega.Succeed())
+			gomega.Expect(localFile.seqSynced).To(gomega.BeTrue())
+			gomega.Expect(file.Close()).To(gomega.Succeed(), "base close must not repeat the sequential-writer sync")
+			persisted, readErr := os.ReadFile(fileName)
+			gomega.Expect(readErr).ToNot(gomega.HaveOccurred())
+			gomega.Expect(persisted).To(gomega.Equal([]byte("a")))
+		})
+
+		ginkgo.It("Read-only close does not enter the writable sync path", func() {
+			readPath := filepath.Join(dirName, "read-only")
+			gomega.Expect(os.WriteFile(readPath, []byte("data"), 0o600)).To(gomega.Succeed())
+			readFile, openErr := fs.OpenFile(readPath)
+			gomega.Expect(openErr).ToNot(gomega.HaveOccurred())
+			localReadFile, ok := readFile.(*LocalFile)
+			gomega.Expect(ok).To(gomega.BeTrue())
+			gomega.Expect(localReadFile.writable).To(gomega.BeFalse())
+			gomega.Expect(readFile.Close()).To(gomega.Succeed())
+		})
+
 		ginkgo.It("WriteAtomic leaves no .tmp on success", func() {
 			target := filepath.Join(dirName, "metadata.json")
 			n, err := fs.WriteAtomic([]byte(`{"v":1}`), target, 0o600)
diff --git a/pkg/pipeline/sdk/decode.go b/pkg/pipeline/sdk/decode.go
index 8d43e69ba..0319359e2 100644
--- a/pkg/pipeline/sdk/decode.go
+++ b/pkg/pipeline/sdk/decode.go
@@ -73,57 +73,83 @@ func (c *TagColumn) At(row int) (Value, error) {
 	return DecodeTagValue(c.ValueType, c.Values[row])
 }
 
+// AtInto decodes the value at the given span row into dst. Callers may reuse
+// dst across rows to avoid copying the Value and reallocating array storage.
+func (c *TagColumn) AtInto(row int, dst *Value) error {
+	if dst == nil {
+		return fmt.Errorf("tag %q: destination is nil", c.Name)
+	}
+	if row < 0 || row >= len(c.Values) {
+		return fmt.Errorf("tag %q: row %d out of range [0,%d)", c.Name, row, len(c.Values))
+	}
+	return DecodeTagValueInto(dst, c.ValueType, c.Values[row])
+}
+
 // DecodeTagValue decodes one marshaled tag value, as stored in the native trace
 // block, into a typed Value. It mirrors the engine's own per-row decode so a
 // plugin never needs to import banyand/trace internals. A nil raw value yields
 // a null Value.
 func DecodeTagValue(valueType valuetype.ValueType, raw []byte) (Value, error) {
+	var value Value
+	if err := DecodeTagValueInto(&value, valueType, raw); err != nil {
+		return Value{}, err
+	}
+	return value, nil
+}
+
+// DecodeTagValueInto decodes one marshaled tag value into dst. Existing array
+// capacity in dst is reused; all fields from a preceding value are reset.
+func DecodeTagValueInto(dst *Value, valueType valuetype.ValueType, raw []byte) error {
+	if dst == nil {
+		return fmt.Errorf("destination is nil")
+	}
+	strArr := dst.strArr[:0]
+	intArr := dst.intArr[:0]
+	*dst = Value{valueType: valueType, strArr: strArr, intArr: intArr}
 	if raw == nil {
-		return Value{valueType: valueType, null: true}, nil
+		dst.null = true
+		return nil
 	}
 	switch valueType {
 	case valuetype.ValueTypeStr:
-		return Value{valueType: valueType, str: string(raw)}, nil
+		dst.str = string(raw)
 	case valuetype.ValueTypeInt64:
 		if len(raw) != 8 {
-			return Value{}, fmt.Errorf("int64: expected 8 bytes, got %d", len(raw))
+			return fmt.Errorf("int64: expected 8 bytes, got %d", len(raw))
 		}
-		return Value{valueType: valueType, int64Val: convert.BytesToInt64(raw)}, nil
+		dst.int64Val = convert.BytesToInt64(raw)
 	case valuetype.ValueTypeFloat64:
 		if len(raw) != 8 {
-			return Value{}, fmt.Errorf("float64: expected 8 bytes, got %d", len(raw))
+			return fmt.Errorf("float64: expected 8 bytes, got %d", len(raw))
 		}
-		return Value{valueType: valueType, floatVal: convert.BytesToFloat64(raw)}, nil
+		dst.floatVal = convert.BytesToFloat64(raw)
 	case valuetype.ValueTypeBinaryData:
-		return Value{valueType: valueType, bytes: raw}, nil
+		dst.bytes = raw
 	case valuetype.ValueTypeTimestamp:
 		if len(raw) != 8 {
-			return Value{}, fmt.Errorf("timestamp: expected 8 bytes, got %d", len(raw))
+			return fmt.Errorf("timestamp: expected 8 bytes, got %d", len(raw))
 		}
-		return Value{valueType: valueType, int64Val: convert.BytesToInt64(raw)}, nil
+		dst.int64Val = convert.BytesToInt64(raw)
 	case valuetype.ValueTypeInt64Arr:
 		if len(raw)%8 != 0 {
-			return Value{}, fmt.Errorf("int64 array: length %d is not a multiple of 8", len(raw))
+			return fmt.Errorf("int64 array: length %d is not a multiple of 8", len(raw))
 		}
-		values := make([]int64, 0, len(raw)/8)
-		for i := 0; i < len(raw); i += 8 {
-			values = append(values, convert.BytesToInt64(raw[i:i+8]))
+		for offset := 0; offset < len(raw); offset += 8 {
+			dst.intArr = append(dst.intArr, convert.BytesToInt64(raw[offset:offset+8]))
 		}
-		return Value{valueType: valueType, intArr: values}, nil
 	case valuetype.ValueTypeStrArr:
-		var values []string
 		for idx := 0; idx < len(raw); {
 			end, next, err := vararray.UnmarshalVarArray(raw, idx)
 			if err != nil {
-				return Value{}, fmt.Errorf("str array: %w", err)
+				return fmt.Errorf("str array: %w", err)
 			}
-			values = append(values, string(raw[idx:end]))
+			dst.strArr = append(dst.strArr, string(raw[idx:end]))
 			idx = next
 		}
-		return Value{valueType: valueType, strArr: values}, nil
 	case valuetype.ValueTypeUnknown:
-		return Value{valueType: valueType, null: true}, nil
+		dst.null = true
 	default:
-		return Value{}, fmt.Errorf("unsupported value type: %d", valueType)
+		return fmt.Errorf("unsupported value type: %d", valueType)
 	}
+	return nil
 }
diff --git a/pkg/pipeline/sdk/sdk_test.go b/pkg/pipeline/sdk/sdk_test.go
index 7cff3a0bc..a0b1d01f8 100644
--- a/pkg/pipeline/sdk/sdk_test.go
+++ b/pkg/pipeline/sdk/sdk_test.go
@@ -126,6 +126,29 @@ func TestTagColumnAt(t *testing.T) {
 	require.Error(t, err, "row out of range must error")
 }
 
+func TestTagColumnAtIntoReusesAndResetsDestination(t *testing.T) {
+	arrayColumn := sdk.TagColumn{
+		Name:      "numbers",
+		ValueType: pbv1.ValueTypeInt64Arr,
+		Values:    [][]byte{int64Arr(7, 9)},
+	}
+	var value sdk.Value
+	require.NoError(t, arrayColumn.AtInto(0, &value))
+	assert.Equal(t, []int64{7, 9}, value.Int64Arr())
+
+	nullColumn := sdk.TagColumn{
+		Name:      "status",
+		ValueType: pbv1.ValueTypeStr,
+		Values:    [][]byte{nil},
+	}
+	require.NoError(t, nullColumn.AtInto(0, &value))
+	assert.True(t, value.IsNull())
+	assert.Empty(t, value.Int64Arr(), "reused destinations must not expose the preceding decoded value")
+
+	require.Error(t, nullColumn.AtInto(1, &value), "row out of range must error")
+	require.Error(t, nullColumn.AtInto(0, nil), "nil destinations must error")
+}
+
 func TestTraceBlockHelpers(t *testing.T) {
 	b := sdk.TraceBlock{
 		TraceID: "t-1",
diff --git a/plugins/skywalking/internal/tracesampler/sampler.go b/plugins/skywalking/internal/tracesampler/sampler.go
index 447ba8370..9f6450e9e 100644
--- a/plugins/skywalking/internal/tracesampler/sampler.go
+++ b/plugins/skywalking/internal/tracesampler/sampler.go
@@ -517,13 +517,10 @@ func (s *Sampler) Kind() sdk.Kind { return sdk.KindSampler }
 // error signal lives there), plus the span-id column only when a span-count rule
 // is configured.
 //
-// Spans stays false, so the verdict never reads span bodies. That is a bound on
-// what this plugin inspects, NOT on what the merge decodes: the engine sets
-// forceSlow whenever a projection names any tag (merger.go, finalizer.go), which
-// disables the raw-copy fast path, and the resulting decode reads the whole block
-// — span bodies and every tag, not just the projected ones. Enabling a sampler
-// therefore costs a full block decode per merge; keeping the projection small
-// bounds only this plugin's own work.
+// Spans stays false, so the verdict never reads span bodies. The merge can copy
+// a unique raw block unchanged while decoding only these projected columns for
+// evaluation. A trace split across physical blocks still takes the ordinary
+// decoded path because compaction must consolidate its output blocks.
 func (s *Sampler) Project() sdk.Projection {
 	return sdk.Projection{Tags: s.requiredTags}
 }
@@ -730,7 +727,9 @@ func (s *Sampler) hasSlowTrace(b *sdk.TraceBlock) (bool, error) {
 	fastScalars := startCol.ValueType == valuetype.ValueTypeTimestamp && durCol.ValueType == valuetype.ValueTypeInt64
 	var minStart, maxEnd int64
 	haveStart, haveEnd := false, false
+	var startValue, durationValue sdk.Value
 	for row := 0; row < rows; row++ {
+
 		if fastScalars {
 			start, startOK, startErr := scalarInt64(startCol, row, "timestamp")
 			if startErr != nil {
@@ -754,13 +753,11 @@ func (s *Sampler) hasSlowTrace(b *sdk.TraceBlock) (bool, error) {
 			}
 			continue
 		}
-		sv, sErr := startCol.At(row)
-		if sErr != nil {
+		if sErr := startCol.AtInto(row, &startValue); sErr != nil {
 			return false, sErr
 		}
-		dv, dErr := durCol.At(row)
-		if dErr != nil {
-			return false, dErr
+		if durationErr := durCol.AtInto(row, &durationValue); durationErr != nil {
+			return false, durationErr
 		}
 		// StartTimeTag must be a timestamp column, which BanyanDB stores as unix ns
 		// (write_standalone.go: GetTimestamp().AsTime().UnixNano()) — that is what makes
@@ -768,22 +765,22 @@ func (s *Sampler) hasSlowTrace(b *sdk.TraceBlock) (bool, error) {
 		// it carries no unit, and unlike DurationTag there is no nanos-per-unit to scale
 		// it by, so treating it as ns would silently mis-measure a millisecond column.
 		// Skipping the row instead makes it a can't-tell, which fails open.
-		if sv.IsNull() || sv.ValueType() != valuetype.ValueTypeTimestamp {
+		if startValue.IsNull() || startValue.ValueType() != valuetype.ValueTypeTimestamp {
 			continue
 		}
 		// A start with no duration still bounds the envelope's LEFT edge. Zipkin's
 		// duration is optional (incomplete and one-way spans carry none), so requiring
 		// both would let the earliest span drop out of minStart and measure the trace
 		// from a later one — understating the envelope and under-keeping slow traces.
-		start := sv.Int64()
+		start := startValue.Int64()
 		if !haveStart || start < minStart {
 			minStart, haveStart = start, true
 		}
 		// Duration is an int in the tag's own unit, scaled to ns here.
-		if dv.IsNull() || dv.ValueType() != valuetype.ValueTypeInt64 {
+		if durationValue.IsNull() || durationValue.ValueType() != valuetype.ValueTypeInt64 {
 			continue
 		}
-		if end := start + dv.Int64()*s.durationTagNanosPerUnit; !haveEnd || end > maxEnd {
+		if end := start + durationValue.Int64()*s.durationTagNanosPerUnit; !haveEnd || end > maxEnd {
 			maxEnd, haveEnd = end, true
 		}
 	}
@@ -1102,6 +1099,7 @@ func (s *Sampler) hasErrorColumn(b *sdk.TraceBlock) (bool, error) {
 	if col == nil {
 		return false, errNoErrorColumn
 	}
+
 	// Both fast paths are gated on the column's exact type, for the same reason
 	// as hasSlowTrace: only a type this rule actually reads may skip At.
 	switch col.ValueType {
@@ -1132,21 +1130,21 @@ func (s *Sampler) hasErrorColumn(b *sdk.TraceBlock) (bool, error) {
 		return false, nil
 	default:
 	}
+	var value sdk.Value
 	for row := range col.Values {
-		v, err := col.At(row)
-		if err != nil {
-			return false, err
+		if decodeErr := col.AtInto(row, &value); decodeErr != nil {
+			return false, decodeErr
 		}
-		if v.IsNull() {
+		if value.IsNull() {
 			continue
 		}
-		switch v.ValueType() {
+		switch value.ValueType() {
 		case valuetype.ValueTypeInt64:
-			if v.Int64() != 0 {
+			if value.Int64() != 0 {
 				return true, nil
 			}
 		case valuetype.ValueTypeStr:
-			if str := v.Str(); str == "true" || str == "1" {
+			if str := value.Str(); str == "true" || str == "1" {
 				return true, nil
 			}
 		default: