Skip to content

Commit 6a57181

Browse files
authored
Revert "s3fifo add ghost fifo (#21653)" main branch (#21854)
revert s3fifo for main branch Approved by: @XuPeng-SH, @reusee, @LeftHandCold, @fengttt, @zhangxu19830126
1 parent fcc5b27 commit 6a57181

22 files changed

+259
-707
lines changed

cmd/mo-service/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (c *Config) setDefaultValue() error {
301301

302302
func (c *Config) initMetaCache() {
303303
if c.MetaCache.MemoryCapacity > 0 {
304-
objectio.InitMetaCache(int64(c.MetaCache.MemoryCapacity), c.MetaCache.DisableS3Fifo)
304+
objectio.InitMetaCache(int64(c.MetaCache.MemoryCapacity))
305305
}
306306
}
307307

pkg/embed/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func (c *ServiceConfig) setDefaultValue() error {
279279

280280
func (c *ServiceConfig) initMetaCache() {
281281
if c.MetaCache.MemoryCapacity > 0 {
282-
objectio.InitMetaCache(int64(c.MetaCache.MemoryCapacity), c.MetaCache.DisableS3Fifo)
282+
objectio.InitMetaCache(int64(c.MetaCache.MemoryCapacity))
283283
}
284284
}
285285

pkg/fileservice/cache.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type CacheConfig struct {
4343
RemoteCacheEnabled bool `toml:"remote-cache-enabled"`
4444
RPC morpc.Config `toml:"rpc"`
4545
CheckOverlaps bool `toml:"check-overlaps"`
46-
DisableS3Fifo bool `toml:"disable-s3fifo"`
4746

4847
QueryClient client.QueryClient `json:"-"`
4948
KeyRouterFactory KeyRouterFactory[pb.CacheKey] `json:"-"`

pkg/fileservice/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func Test_readCache(t *testing.T) {
3232
slowCacheReadThreshold = time.Second
3333

3434
size := int64(128)
35-
m := NewMemCache(fscache.ConstCapacity(size), nil, nil, "", false)
35+
m := NewMemCache(fscache.ConstCapacity(size), nil, nil, "")
3636
defer m.Close(ctx)
3737

3838
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*3)

pkg/fileservice/disk_cache.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ func NewDiskCache(
6060
asyncLoad bool,
6161
cacheDataAllocator CacheDataAllocator,
6262
name string,
63-
disable_s3fifo bool,
6463
) (ret *DiskCache, err error) {
6564

6665
err = os.MkdirAll(path, 0755)
@@ -120,7 +119,6 @@ func NewDiskCache(
120119
)
121120
}
122121
},
123-
disable_s3fifo,
124122
),
125123
}
126124
ret.updatingPaths.Cond = sync.NewCond(new(sync.Mutex))

pkg/fileservice/disk_cache_test.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestDiskCache(t *testing.T) {
4545
})
4646

4747
// new
48-
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
48+
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
4949
assert.Nil(t, err)
5050
defer cache.Close(ctx)
5151

@@ -130,7 +130,7 @@ func TestDiskCache(t *testing.T) {
130130
testRead(cache)
131131

132132
// new cache instance and read
133-
cache, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
133+
cache, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
134134
assert.Nil(t, err)
135135
defer cache.Close(ctx)
136136

@@ -139,7 +139,7 @@ func TestDiskCache(t *testing.T) {
139139
assert.Equal(t, 1, numWritten)
140140

141141
// new cache instance and update
142-
cache, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
142+
cache, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
143143
assert.Nil(t, err)
144144
defer cache.Close(ctx)
145145

@@ -159,7 +159,7 @@ func TestDiskCacheWriteAgain(t *testing.T) {
159159
var counterSet perfcounter.CounterSet
160160
ctx = perfcounter.WithCounterSet(ctx, &counterSet)
161161

162-
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(4096), nil, false, nil, "", false)
162+
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(4096), nil, false, nil, "")
163163
assert.Nil(t, err)
164164
defer cache.Close(ctx)
165165

@@ -224,7 +224,7 @@ func TestDiskCacheWriteAgain(t *testing.T) {
224224
func TestDiskCacheFileCache(t *testing.T) {
225225
dir := t.TempDir()
226226
ctx := context.Background()
227-
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
227+
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
228228
assert.Nil(t, err)
229229
defer cache.Close(ctx)
230230

@@ -284,7 +284,7 @@ func TestDiskCacheDirSize(t *testing.T) {
284284

285285
dir := t.TempDir()
286286
capacity := 1 << 20
287-
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(int64(capacity)), nil, false, nil, "", false)
287+
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(int64(capacity)), nil, false, nil, "")
288288
assert.Nil(t, err)
289289
defer cache.Close(ctx)
290290

@@ -347,7 +347,6 @@ func benchmarkDiskCacheWriteThenRead(
347347
false,
348348
nil,
349349
"",
350-
false,
351350
)
352351
if err != nil {
353352
b.Fatal(err)
@@ -443,7 +442,6 @@ func benchmarkDiskCacheReadRandomOffsetAtLargeFile(
443442
false,
444443
nil,
445444
"",
446-
false,
447445
)
448446
if err != nil {
449447
b.Fatal(err)
@@ -515,7 +513,6 @@ func BenchmarkDiskCacheMultipleIOEntries(b *testing.B) {
515513
false,
516514
nil,
517515
"",
518-
false,
519516
)
520517
if err != nil {
521518
b.Fatal(err)
@@ -587,7 +584,7 @@ func TestDiskCacheClearFiles(t *testing.T) {
587584
assert.Nil(t, err)
588585
numFiles := len(files)
589586

590-
_, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
587+
_, err = NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
591588
assert.Nil(t, err)
592589

593590
files, err = filepath.Glob(filepath.Join(dir, "*"))
@@ -601,7 +598,7 @@ func TestDiskCacheClearFiles(t *testing.T) {
601598
func TestDiskCacheBadWrite(t *testing.T) {
602599
dir := t.TempDir()
603600
ctx := context.Background()
604-
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "", false)
601+
cache, err := NewDiskCache(ctx, dir, fscache.ConstCapacity(1<<20), nil, false, nil, "")
605602
assert.Nil(t, err)
606603

607604
written, err := cache.writeFile(
@@ -636,7 +633,6 @@ func TestDiskCacheGlobalSizeHint(t *testing.T) {
636633
false,
637634
nil,
638635
"test",
639-
false,
640636
)
641637
assert.Nil(t, err)
642638
defer cache.Close(ctx)
@@ -669,7 +665,7 @@ func TestDiskCacheGlobalSizeHint(t *testing.T) {
669665

670666
func TestDiskCacheSetFromFile(t *testing.T) {
671667
ctx := context.Background()
672-
cache, err := NewDiskCache(ctx, t.TempDir(), fscache.ConstCapacity(1<<30), nil, false, nil, "", false)
668+
cache, err := NewDiskCache(ctx, t.TempDir(), fscache.ConstCapacity(1<<30), nil, false, nil, "")
673669
require.Nil(t, err)
674670
defer cache.Close(ctx)
675671

@@ -694,7 +690,7 @@ func TestDiskCacheSetFromFile(t *testing.T) {
694690

695691
func TestDiskCacheQuotaExceeded(t *testing.T) {
696692
ctx := context.Background()
697-
cache, err := NewDiskCache(ctx, t.TempDir(), fscache.ConstCapacity(3), nil, false, nil, "", false)
693+
cache, err := NewDiskCache(ctx, t.TempDir(), fscache.ConstCapacity(3), nil, false, nil, "")
698694
require.Nil(t, err)
699695
defer cache.Close(ctx)
700696

pkg/fileservice/fifocache/bench2_test.go

Lines changed: 0 additions & 130 deletions
This file was deleted.

pkg/fileservice/fifocache/bench_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
func BenchmarkSequentialSet(b *testing.B) {
2727
ctx := context.Background()
2828
size := 65536
29-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
29+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
3030
nElements := size * 16
3131
b.ResetTimer()
3232
for i := 0; i < b.N; i++ {
@@ -37,7 +37,7 @@ func BenchmarkSequentialSet(b *testing.B) {
3737
func BenchmarkParallelSet(b *testing.B) {
3838
ctx := context.Background()
3939
size := 65536
40-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
40+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
4141
nElements := size * 16
4242
b.ResetTimer()
4343
b.RunParallel(func(pb *testing.PB) {
@@ -50,7 +50,7 @@ func BenchmarkParallelSet(b *testing.B) {
5050
func BenchmarkGet(b *testing.B) {
5151
ctx := context.Background()
5252
size := 65536
53-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
53+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
5454
nElements := size * 16
5555
for i := 0; i < nElements; i++ {
5656
cache.Set(ctx, i, i, int64(1+i%3))
@@ -64,7 +64,7 @@ func BenchmarkGet(b *testing.B) {
6464
func BenchmarkParallelGet(b *testing.B) {
6565
ctx := context.Background()
6666
size := 65536
67-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
67+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
6868
nElements := size * 16
6969
for i := 0; i < nElements; i++ {
7070
cache.Set(ctx, i, i, int64(1+i%3))
@@ -80,7 +80,7 @@ func BenchmarkParallelGet(b *testing.B) {
8080
func BenchmarkParallelGetOrSet(b *testing.B) {
8181
ctx := context.Background()
8282
size := 65536
83-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
83+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
8484
nElements := size * 16
8585
b.ResetTimer()
8686
b.RunParallel(func(pb *testing.PB) {
@@ -97,7 +97,7 @@ func BenchmarkParallelGetOrSet(b *testing.B) {
9797
func BenchmarkParallelEvict(b *testing.B) {
9898
ctx := context.Background()
9999
size := 65536
100-
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil, false)
100+
cache := New[int, int](fscache.ConstCapacity(int64(size)), ShardInt[int], nil, nil, nil)
101101
nElements := size * 16
102102
b.ResetTimer()
103103
b.RunParallel(func(pb *testing.PB) {

0 commit comments

Comments
 (0)