From 2873ecbb79921811db7f1ee7f6969b9aca9dd709 Mon Sep 17 00:00:00 2001 From: Burak Sezer Date: Sun, 5 Feb 2023 12:38:20 +0300 Subject: [PATCH 1/5] chore: update README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e7703694..a088f7f4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ See [Docker](#docker) and [Samples](#samples) sections to get started! Join our [Discord server!](https://discord.gg/ahK7Vjr8We) -The current production version is [v0.5.0](https://github.com/buraksezer/olric/tree/release/v0.5.0#olric-) +The current production version is [v0.5.4](https://github.com/buraksezer/olric/tree/release/v0.5.0#olric-) ### About versions @@ -45,7 +45,7 @@ This document only covers `v0.5.x` and later. See v0.4.x documents [here](https: * Supports replication by default (with sync and async options), * Quorum-based voting for replica control (Read/Write quorums), * Supports atomic operations, -* Implements an iterator on distributed maps, +* Provides an iterator on distributed maps, * Provides a plugin interface for service discovery daemons, * Provides a locking primitive which inspired by [SETNX of Redis](https://redis.io/commands/setnx#design-pattern-locking-with-codesetnxcode), @@ -152,7 +152,7 @@ It's good at distributed caching and publish/subscribe messaging. * Supports replication by default (with sync and async options), * Quorum-based voting for replica control, * Thread-safe by default, -* Supports [distributed queries](#query) on keys, +* Provides an iterator on distributed maps, * Provides a plugin interface for service discovery daemons and cloud providers, * Provides a locking primitive which inspired by [SETNX of Redis](https://redis.io/commands/setnx#design-pattern-locking-with-codesetnxcode), * Provides a drop-in replacement of Redis' Publish-Subscribe messaging feature. @@ -174,7 +174,7 @@ You also feel free to open an issue on GitHub to report bugs and share feature r With a correctly configured Golang environment: ``` -go install github.com/buraksezer/olric/cmd/olricd@v0.5.0 +go install github.com/buraksezer/olric/cmd/olricd@v0.5.4 ``` Now you can start using Olric: @@ -190,7 +190,7 @@ See [Configuration](#configuration) section to create your cluster properly. You can launch `olricd` Docker container by running the following command. ```bash -docker run -p 3320:3320 olricio/olricd:v0.5.0 +docker run -p 3320:3320 olricio/olricd:v0.5.4 ``` This command will pull olricd Docker image and run a new Olric Instance. You should know that the container exposes @@ -212,7 +212,7 @@ OK With olricd, you can create an Olric cluster with a few commands. This is how to install olricd: ```bash -go install github.com/buraksezer/olric/cmd/olricd@v0.5.0 +go install github.com/buraksezer/olric/cmd/olricd@v0.5.4 ``` Let's create a cluster with the following: @@ -281,7 +281,7 @@ this repository. `EmbeddedClient` provides a client implementation for [embedded Obviously, you can use `ClusterClient` for your embedded-member deployments. But it's good to use `EmbeddedClient` provides a better performance due to localization of the queries. -See the client documentation on [pkg.go.dev](https://pkg.go.dev/github.com/buraksezer/olric@v0.5.0) +See the client documentation on [pkg.go.dev](https://pkg.go.dev/github.com/buraksezer/olric@v0.5.4) ## Cluster Events From 6d225363b2eb0b5c5cfee0ad66a28d60f282c5af Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 28 Mar 2023 14:14:26 +0200 Subject: [PATCH 2/5] fix: Duplicate redis client leak --- internal/server/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/server/client.go b/internal/server/client.go index c3f648c5..ac001dd8 100644 --- a/internal/server/client.go +++ b/internal/server/client.go @@ -72,6 +72,12 @@ func (c *Client) Get(addr string) *redis.Client { c.mu.Lock() defer c.mu.Unlock() + // Need to check again, because another goroutine may have updated clients + // between our calls to RUnlock and Lock. + if rc, ok = c.clients[addr]; ok { + return rc + } + opt := c.config.RedisOptions() opt.Addr = addr rc = redis.NewClient(opt) From 737b588c3dcc10730a261e0684e0c525a3153e99 Mon Sep 17 00:00:00 2001 From: Burak Sezer Date: Thu, 13 Apr 2023 18:29:08 +0300 Subject: [PATCH 3/5] fix: Data race when getting stats in embedded mode --- internal/cluster/balancer/balancer.go | 2 +- internal/cluster/partitions/fragment.go | 1 - internal/cluster/partitions/partition.go | 2 +- internal/cluster/partitions/partition_test.go | 4 ---- internal/dmap/fragment.go | 10 +++------- internal/testutil/mockfragment/mockfragment.go | 6 ------ 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/internal/cluster/balancer/balancer.go b/internal/cluster/balancer/balancer.go index 58746a66..03748edc 100644 --- a/internal/cluster/balancer/balancer.go +++ b/internal/cluster/balancer/balancer.go @@ -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.") diff --git a/internal/cluster/partitions/fragment.go b/internal/cluster/partitions/fragment.go index 56d8d1af..ff6e19bb 100644 --- a/internal/cluster/partitions/fragment.go +++ b/internal/cluster/partitions/fragment.go @@ -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 diff --git a/internal/cluster/partitions/partition.go b/internal/cluster/partitions/partition.go index 6b9bf31c..72cfad7b 100644 --- a/internal/cluster/partitions/partition.go +++ b/internal/cluster/partitions/partition.go @@ -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 }) diff --git a/internal/cluster/partitions/partition_test.go b/internal/cluster/partitions/partition_test.go index a63e11f9..b413cc1c 100644 --- a/internal/cluster/partitions/partition_test.go +++ b/internal/cluster/partitions/partition_test.go @@ -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 } diff --git a/internal/dmap/fragment.go b/internal/dmap/fragment.go index 59591482..d5e4e1b2 100644 --- a/internal/dmap/fragment.go +++ b/internal/dmap/fragment.go @@ -39,6 +39,9 @@ type fragment struct { } func (f *fragment) Stats() storage.Stats { + f.RLock() + defer f.RUnlock() + return f.storage.Stats() } @@ -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() diff --git a/internal/testutil/mockfragment/mockfragment.go b/internal/testutil/mockfragment/mockfragment.go index b8a46f9b..4c726946 100644 --- a/internal/testutil/mockfragment/mockfragment.go +++ b/internal/testutil/mockfragment/mockfragment.go @@ -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() From 9e7696a9fa4227af7a024461a937cf7b98993ce5 Mon Sep 17 00:00:00 2001 From: Burak Sezer Date: Tue, 19 Dec 2023 22:20:58 +0300 Subject: [PATCH 4/5] Update Go versions in GitHub CI workflow The Go versions in the continuous integration workflow have been updated from '1.17', '1.18' to '1.20', '1.21'. This is to ensure that our Github workflows are functioning with the latest versions of the language, contributing to maintaining the codebase up-to-date. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 460e339d..ba603b9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} From 0902e5957200e2098610072adf5e4d23995347bf Mon Sep 17 00:00:00 2001 From: Burak Sezer Date: Tue, 19 Dec 2023 22:21:25 +0300 Subject: [PATCH 5/5] Skip flaky test in integration tests Temporarily skipping the flaky test 'TestIntegration_NodesJoinOrLeftDuringQuery' in 'integration_test.go' file. This is pending a fix for the referenced issue (https://github.com/buraksezer/olric/issues/227) as documented in the TODO comment. --- integration_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration_test.go b/integration_test.go index f0d8c435..f1c6812a 100644 --- a/integration_test.go +++ b/integration_test.go @@ -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