Skip to content

Commit

Permalink
Merge branch 'release/v0.5.0'
Browse files Browse the repository at this point in the history
* release/v0.5.0:
  Skip flaky test in integration tests
  Update Go versions in GitHub CI workflow
  fix: Data race when getting stats in embedded mode
  fix: Duplicate redis client leak
  chore: update README.md
  • Loading branch information
buraksezer committed Dec 19, 2023
2 parents 02a9324 + 0902e59 commit 8f7dde1
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
go: [ '1.17', '1.18' ]
go: [ '1.20', '1.21' ]

runs-on: ${{ matrix.os }}

Expand Down
3 changes: 3 additions & 0 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
)

func TestIntegration_NodesJoinOrLeftDuringQuery(t *testing.T) {
// TODO: https://github.com/buraksezer/olric/issues/227
t.Skip("TestIntegration_NodesJoinOrLeftDuringQuery: flaky test")

newConfig := func() *config.Config {
c := config.New("local")
c.PartitionCount = config.DefaultPartitionCount
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/balancer/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (b *Balancer) scanPartition(sign uint64, part *partitions.Partition, owners

part.Map().Range(func(rawName, rawFragment interface{}) bool {
f := rawFragment.(partitions.Fragment)
if f.Length() == 0 {
if f.Stats().Length == 0 {
return false
}
name := strings.TrimPrefix(rawName.(string), "dmap.")
Expand Down
1 change: 0 additions & 1 deletion internal/cluster/partitions/fragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
type Fragment interface {
Name() string
Stats() storage.Stats
Length() int
Move(*Partition, string, []discovery.Member) error
Compaction() (bool, error)
Destroy() error
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/partitions/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (p *Partition) Length() int {
var length int
p.Map().Range(func(_, tmp interface{}) bool {
u := tmp.(Fragment)
length += u.Length()
length += u.Stats().Length
// Continue scanning.
return true
})
Expand Down
4 changes: 0 additions & 4 deletions internal/cluster/partitions/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func (tf *testFragment) Name() string {
return "test-data-structure"
}

func (tf *testFragment) Length() int {
return tf.length
}

func (tf *testFragment) Move(_ *Partition, _ string, _ []discovery.Member) error {
return nil
}
Expand Down
10 changes: 3 additions & 7 deletions internal/dmap/fragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type fragment struct {
}

func (f *fragment) Stats() storage.Stats {
f.RLock()
defer f.RUnlock()

return f.storage.Stats()
}

Expand Down Expand Up @@ -70,13 +73,6 @@ func (f *fragment) Name() string {
return "DMap"
}

func (f *fragment) Length() int {
f.RLock()
defer f.RUnlock()

return f.storage.Stats().Length
}

func (f *fragment) Move(part *partitions.Partition, name string, owners []discovery.Member) error {
f.Lock()
defer f.Unlock()
Expand Down
6 changes: 0 additions & 6 deletions internal/testutil/mockfragment/mockfragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ func (f *MockFragment) Name() string {
return "Mock-DMap"
}

func (f *MockFragment) Length() int {
f.RLock()
defer f.RUnlock()
return len(f.m)
}

func (f *MockFragment) Put(key string, value interface{}) {
f.Lock()
defer f.Unlock()
Expand Down

0 comments on commit 8f7dde1

Please sign in to comment.