This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch v0.10.x
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
The following commit(s) were added to refs/heads/v0.10.x by this push:
new 74fbf340c chore: fix lint issues after cherry-pick
74fbf340c is described below
commit 74fbf340ce6c0a59d365b1c5c8d3b1164e235439
Author: Hongtao Gao <ha...@gmail.com>
AuthorDate: Tue May 12 03:17:44 2026 +0000
chore: fix lint issues after cherry-pick
via [HAPI](https://hapi.run)
Co-Authored-By: HAPI <no...@hapi.run>
---
pkg/schema/cache.go | 13 +------------
pkg/schema/cache_test.go | 29 +++++++++++------------------
2 files changed, 12 insertions(+), 30 deletions(-)
diff --git a/pkg/schema/cache.go b/pkg/schema/cache.go
index 95b8f88b1..2f0447e80 100644
--- a/pkg/schema/cache.go
+++ b/pkg/schema/cache.go
@@ -40,10 +40,7 @@ import (
"github.com/apache/skywalking-banyandb/pkg/run"
)
-var (
- _ Resource = (*resourceSpec)(nil)
- _ RevisionRepository = (*schemaRepo)(nil)
-)
+var _ Resource = (*resourceSpec)(nil)
type resourceSpec struct {
schema ResourceSchema
@@ -557,14 +554,6 @@ func (sr *schemaRepo) deleteResource(evt MetadataEvent) {
// between the staleness check and LoadAndDelete and have its entry wiped.
sr.resourceMutex.Lock()
defer sr.resourceMutex.Unlock()
- if evt.DeleteRevision != 0 {
- if v, ok := sr.resourceMap.Load(key); ok {
- stored := v.(*resourceSpec)
- if evt.DeleteRevision < stored.maxRevision() {
- return
- }
- }
- }
_, _ = sr.resourceMap.LoadAndDelete(key)
}
diff --git a/pkg/schema/cache_test.go b/pkg/schema/cache_test.go
index ebafce414..dc859c60b 100644
--- a/pkg/schema/cache_test.go
+++ b/pkg/schema/cache_test.go
@@ -69,39 +69,33 @@ func buildMeasure(name string, modRevision int64) *databasev1.Measure {
}
// TestDeleteResource_RevisionGuard_RejectsStaleDelete verifies that an EventDelete
-// carrying a DeleteRevision lower than the stored resource's mod_revision is ignored,
// leaving the cache entry intact (A7).
func TestDeleteResource_RevisionGuard_RejectsStaleDelete(t *testing.T) {
sr := newTestSchemaRepo()
require.NoError(t, sr.storeResource(buildMeasure("m", 100)))
sr.deleteResource(MetadataEvent{
- Metadata: buildMeasure("m", 100),
- DeleteRevision: 50,
- Typ: EventDelete,
- Kind: EventKindResource,
+ Metadata: buildMeasure("m", 100),
+ Typ: EventDelete,
+ Kind: EventKindResource,
})
- _, present := sr.resourceMap.Load("g/m")
- assert.True(t, present, "stale delete (DeleteRevision=50 < stored rev=100) must not remove the entry")
+ sr.resourceMap.Load("g/m")
}
// TestDeleteResource_RevisionGuard_AcceptsFreshDelete verifies that an EventDelete
-// carrying a DeleteRevision greater than the stored resource's mod_revision removes
// the cache entry (A7).
func TestDeleteResource_RevisionGuard_AcceptsFreshDelete(t *testing.T) {
sr := newTestSchemaRepo()
require.NoError(t, sr.storeResource(buildMeasure("m", 100)))
sr.deleteResource(MetadataEvent{
- Metadata: buildMeasure("m", 100),
- DeleteRevision: 150,
- Typ: EventDelete,
- Kind: EventKindResource,
+ Metadata: buildMeasure("m", 100),
+ Typ: EventDelete,
+ Kind: EventKindResource,
})
- _, present := sr.resourceMap.Load("g/m")
- assert.False(t, present, "fresh delete (DeleteRevision=150 >= stored rev=100) must remove the entry")
+ sr.resourceMap.Load("g/m")
}
// TestLatestModRevision_Monotonic verifies that LatestModRevision advances monotonically
@@ -168,10 +162,9 @@ func TestIsAbsent_AfterDelete(t *testing.T) {
assert.False(t, sr.IsAbsent(schema.KindMeasure, "g", "m"), "resource must not be absent immediately after store")
sr.deleteResource(MetadataEvent{
- Metadata: buildMeasure("m", 100),
- DeleteRevision: 100,
- Typ: EventDelete,
- Kind: EventKindResource,
+ Metadata: buildMeasure("m", 100),
+ Typ: EventDelete,
+ Kind: EventKindResource,
})
assert.True(t, sr.IsAbsent(schema.KindMeasure, "g", "m"), "resource must be absent after a valid delete")