Repository: dragonflyoss/Dragonfly2
Pull request #1002 (2022-01-17 13:08:01)

feat: update submodule charts
<!--- Provide a general summary of your changes in the Title above -->

## Description
- Update submodule charts.
<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation Update (if none of the other choices apply)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] Code compiles correctly.
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.


codecov-commenter: # [Codecov](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) Report
> Merging [#1002](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) (d929e18) into [main](https://codecov.io/gh/dragonflyoss/Dragonfly2/commit/bec343a5a71814cbd19ae9d5775cf59af5d86d68?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) (bec343a) will **increase** coverage by `0.08%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002/graphs/tree.svg?width=650&height=150&src=pr&token=PUICJYSAT7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss)](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss)

```diff
@@            Coverage Diff             @@
##             main    #1002      +/-   ##
==========================================
+ Coverage   45.78%   45.87%   +0.08%     
==========================================
  Files         130      130              
  Lines        9131     9131              
==========================================
+ Hits         4181     4189       +8     
+ Misses       4479     4471       -8     
  Partials      471      471              
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `45.87% <ø> (+0.08%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss) | Coverage Δ | |
|---|---|---|
| [client/daemon/peer/peertask\_conductor.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2xpZW50L2RhZW1vbi9wZWVyL3BlZXJ0YXNrX2NvbmR1Y3Rvci5nbw==) | `57.14% <0.00%> (+0.36%)` | :arrow_up: |
| [client/daemon/peer/piece\_broker.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2xpZW50L2RhZW1vbi9wZWVyL3BpZWNlX2Jyb2tlci5nbw==) | `88.88% <0.00%> (+3.70%)` | :arrow_up: |
| [cdn/supervisor/progress/progress.go](https://codecov.io/gh/dragonflyoss/Dragonfly2/pull/1002/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dragonflyoss#diff-Y2RuL3N1cGVydmlzb3IvcHJvZ3Jlc3MvcHJvZ3Jlc3MuZ28=) | `97.01% <0.00%> (+5.97%)` | :arrow_up: |


Patch:
diff --git a/cmd/dependency/dependency.go b/cmd/dependency/dependency.go
index 2f953106..5a5e723b 100644
--- a/cmd/dependency/dependency.go
+++ b/cmd/dependency/dependency.go
@@ -105,7 +105,7 @@ func InitMonitor(verbose bool, pprofPort int, otelOption base.TelemetryOption) f
 				pprofPort, _ = freeport.GetFreePort()
 			}
 
-			debugAddr := fmt.Sprintf("%s:%d", iputils.IPv4, pprofPort)
+			debugAddr := fmt.Sprintf(":%d", pprofPort)
 			viewer.SetConfiguration(viewer.WithAddr(debugAddr))
 
 			logger.With("pprof", fmt.Sprintf("http://%s/debug/pprof", debugAddr),
diff --git a/deploy/helm-charts b/deploy/helm-charts
index df61df4e..a61569ec 160000
--- a/deploy/helm-charts
+++ b/deploy/helm-charts
@@ -1,1 +1,1 @@
-Subproject commit df61df4e6607fbaa43743152f9744ad065602d14
+Subproject commit a61569eccf3df87a7a4185b7784c2670c59e8179
diff --git a/docs/en/deployment/configuration/cdn.yaml b/docs/en/deployment/configuration/cdn.yaml
index 48aae45f..5f2f8d35 100644
--- a/docs/en/deployment/configuration/cdn.yaml
+++ b/docs/en/deployment/configuration/cdn.yaml
@@ -105,17 +105,15 @@ plugins:
               cleanRatio: 3
               intervalThreshold: 2h0m0s
 
-# Console shows log on console
-# default: false
+# console shows log on console
 console: false
 
-# Whether to enable debug level logger and enable pprof
-# default: false
+# whether to enable debug level logger and enable pprof
 verbose: false
 
 # listen port for pprof, only valid when the verbose option is true
 # default is -1. If it is 0, pprof will use a random port.
-pprofPort: -1
+pprof-port: -1
 
 # jaeger endpoint url, like: http://jaeger.dragonfly.svc:14268/api/traces
 jaeger: ""
diff --git a/docs/en/deployment/configuration/dfget.yaml b/docs/en/deployment/configuration/dfget.yaml
index 2d2efbfc..620e4f24 100644
--- a/docs/en/deployment/configuration/dfget.yaml
+++ b/docs/en/deployment/configuration/dfget.yaml
@@ -30,6 +30,19 @@ dataDir: ""
 # default is false
 keepStorage: true
 
+# console shows log on console
+console: false
+
+# whether to enable debug level logger and enable pprof
+verbose: false
+
+# listen port for pprof, only valid when the verbose option is true
+# default is -1. If it is 0, pprof will use a random port.
+pprof-port: -1
+
+# jaeger endpoint url, like: http://jaeger.dragonfly.svc:14268/api/traces
+jaeger: ""
+
 # all addresses of all schedulers
 # the schedulers of all daemons should be same in one region or zone.
 # daemon will send tasks to a fixed scheduler by hashing the task url and meta data
@@ -53,13 +66,6 @@ scheduler:
     - type: tcp
       addr: 127.0.0.1:8002
 
-# when enable, pprof will be enabled
-verbose: true
-
-# telemetry config
-# jaeger url, like: http://jaeger.dragonfly.svc:14268/api/traces
-jaeger: ""
-
 # current host info used for scheduler
 host:
   # tcp service listen address
diff --git a/docs/en/deployment/configuration/manager.yaml b/docs/en/deployment/configuration/manager.yaml
index 2d689a06..7f316ec0 100644
--- a/docs/en/deployment/configuration/manager.yaml
+++ b/docs/en/deployment/configuration/manager.yaml
@@ -48,3 +48,16 @@ database:
 # metrics:
 #  # metrics service address
 #  addr: ":8000"
+
+# console shows log on console
+console: false
+
+# whether to enable debug level logger and enable pprof
+verbose: false
+
+# listen port for pprof, only valid when the verbose option is true
+# default is -1. If it is 0, pprof will use a random port.
+pprof-port: -1
+
+# jaeger endpoint url, like: http://jaeger.dragonfly.svc:14268/api/traces
+jaeger: ""
diff --git a/docs/en/deployment/configuration/scheduler.yaml b/docs/en/deployment/configuration/scheduler.yaml
index a53b56a1..1e0c6335 100644
--- a/docs/en/deployment/configuration/scheduler.yaml
+++ b/docs/en/deployment/configuration/scheduler.yaml
@@ -109,12 +109,12 @@ metrics:
 # console shows log on console
 console: false
 
-# Whether to enable debug level logger and enable pprof
+# whether to enable debug level logger and enable pprof
 verbose: false
 
 # listen port for pprof, only valid when the verbose option is true
 # default is -1. If it is 0, pprof will use a random port.
-pprofPort: -1
+pprof-port: -1
 
 # jaeger endpoint url, like: http://jaeger.dragonfly.svc:14268/api/traces
 jaeger: ""
diff --git a/docs/zh-CN/deployment/configuration/cdn.yaml b/docs/zh-CN/deployment/configuration/cdn.yaml
index 1e92355d..be87fe99 100644
--- a/docs/zh-CN/deployment/configuration/cdn.yaml
+++ b/docs/zh-CN/deployment/configuration/cdn.yaml
@@ -112,17 +112,14 @@ plugins:
               cleanRatio: 3
               intervalThreshold: 2h0m0s
 
-# 是否在控制台程序中显示日志
-# 默认值：false
+# console 是否在控制台程序中显示日志
 console: false
 
-# 是否使用调试级别的日志、是否启用 pprof
-# 默认值：false
+# verbose 是否使用调试级别的日志、是否启用 pprof。
 verbose: false
 
-# pprof 监听的端口，仅在 verbose 为 true 时可用
-# 默认值：-1（表示不启动），为 0 时使用随机值
-pprofPort: -1
+# pprof-port pprof 监听的端口，仅在 verbose 为 true 时可用
+pprof-port: -1
 
 # jaeger 地址
 # 默认使用空字符串（不配置 jaeger）, 例如: http://jaeger.dragonfly.svc:14268/api/traces
diff --git a/docs/zh-CN/deployment/configuration/dfget.yaml b/docs/zh-CN/deployment/configuration/dfget.yaml
index be956093..ccc395f5 100644
--- a/docs/zh-CN/deployment/configuration/dfget.yaml
+++ b/docs/zh-CN/deployment/configuration/dfget.yaml
@@ -30,6 +30,19 @@ dataDir: ""
 # 默认为 false
 keepStorage: true
 
+# console 是否在控制台程序中显示日志
+console: false
+
+# verbose 是否使用调试级别的日志、是否启用 pprof。
+verbose: false
+
+# pprof-port pprof 监听的端口，仅在 verbose 为 true 时可用
+pprof-port: -1
+
+# jaeger 地址
+# 默认使用空字符串（不配置 jaeger）, 例如: http://jaeger.dragonfly.svc:14268/api/traces
+jaeger: ""
+
 # 调度器地址
 # 尽量使用同一个地区的调度器.
 # daemon 将会根据 task id 来进行一致性 hash 来选择所有配置的调度器
@@ -52,13 +65,6 @@ scheduler:
     - type: tcp
       addr: 127.0.0.1:8002
 
-# 是否开启 verbose 日志模式
-verbose: true
-
-# 遥测配置
-# jaeger 地址, 例如: http://jaeger.dragonfly.svc:14268/api/traces
-jaeger: ""
-
 # 用于注册到调度器的 daemon 信息
 host:
   # 服务监听地址
diff --git a/docs/zh-CN/deployment/configuration/manager.yaml b/docs/zh-CN/deployment/configuration/manager.yaml
index 0a7f1355..b4c87cbc 100644
--- a/docs/zh-CN/deployment/configuration/manager.yaml
+++ b/docs/zh-CN/deployment/configuration/manager.yaml
@@ -47,3 +47,16 @@ database:
 # metrics:
 #  # 数据服务地址
 #  addr: ":8000"
+
+# console 是否在控制台程序中显示日志
+console: false
+
+# verbose 是否使用调试级别的日志、是否启用 pprof。
+verbose: false
+
+# pprof-port pprof 监听的端口，仅在 verbose 为 true 时可用
+pprof-port: -1
+
+# jaeger 地址
+# 默认使用空字符串（不配置 jaeger）, 例如: http://jaeger.dragonfly.svc:14268/api/traces
+jaeger: ""
diff --git a/docs/zh-CN/deployment/configuration/scheduler.yaml b/docs/zh-CN/deployment/configuration/scheduler.yaml
index d9ae8ec5..7b0344db 100644
--- a/docs/zh-CN/deployment/configuration/scheduler.yaml
+++ b/docs/zh-CN/deployment/configuration/scheduler.yaml
@@ -104,14 +104,14 @@ metrics:
   # 开机收集 peer host 数据
   enablePeerHost: false
 
-# Console 是否在控制台程序中显示日志
+# console 是否在控制台程序中显示日志
 console: false
 
 # verbose 是否使用调试级别的日志、是否启用 pprof。
 verbose: false
 
-# pprofPort pprof 监听的端口，仅在 verbose 为 true 时可用
-pprofPort: -1
+# pprof-port pprof 监听的端口，仅在 verbose 为 true 时可用
+pprof-port: -1
 
 # jaeger 地址
 # 默认使用空字符串（不配置 jaeger）, 例如: http://jaeger.dragonfly.svc:14268/api/traces
diff --git a/pkg/sync/kmutex.go b/pkg/sync/kmutex.go
deleted file mode 100644
index 833bc570..00000000
--- a/pkg/sync/kmutex.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *     Copyright 2020 The Dragonfly Authors
- *
- * Licensed 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 sync
-
-import (
-	"sync"
-)
-
-type Kmutex struct {
-	m *sync.Map
-}
-
-func NewKmutex() *Kmutex {
-	m := sync.Map{}
-	return &Kmutex{&m}
-}
-
-func (k *Kmutex) Lock(key interface{}) {
-	m := sync.Mutex{}
-	rm, _ := k.m.LoadOrStore(key, &m)
-	mu := rm.(*sync.Mutex)
-	mu.Lock()
-}
-
-func (k *Kmutex) Unlock(key interface{}) {
-	rm, ok := k.m.Load(key)
-	if !ok {
-		return
-	}
-
-	mu := rm.(*sync.Mutex)
-	k.m.Delete(key)
-	mu.Unlock()
-}
diff --git a/pkg/sync/krwmutex.go b/pkg/sync/krwmutex.go
deleted file mode 100644
index fe3b5743..00000000
--- a/pkg/sync/krwmutex.go
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *     Copyright 2020 The Dragonfly Authors
- *
- * Licensed 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 sync
-
-import (
-	"sync"
-)
-
-type Krwmutex struct {
-	m *sync.Map
-}
-
-func NewKrwmutex() *Krwmutex {
-	m := sync.Map{}
-	return &Krwmutex{&m}
-}
-
-func (k *Krwmutex) Lock(key interface{}) {
-	m := sync.RWMutex{}
-	rm, _ := k.m.LoadOrStore(key, &m)
-	mu := rm.(*sync.RWMutex)
-	mu.Lock()
-}
-
-func (k *Krwmutex) Unlock(key interface{}) {
-	rm, ok := k.m.Load(key)
-	if !ok {
-		return
-	}
-
-	mu := rm.(*sync.RWMutex)
-	k.m.Delete(key)
-	mu.Unlock()
-}
-
-func (k *Krwmutex) RLock(key interface{}) {
-	m := sync.RWMutex{}
-	rm, _ := k.m.LoadOrStore(key, &m)
-	mu := rm.(*sync.RWMutex)
-	mu.RLock()
-}
-
-func (k *Krwmutex) RUnlock(key interface{}) {
-	rm, ok := k.m.Load(key)
-	if !ok {
-		return
-	}
-
-	mu := rm.(*sync.RWMutex)
-	k.m.Delete(key)
-	mu.RUnlock()
-}
diff --git a/scheduler/service/service.go b/scheduler/service/service.go
index 0bcb15ce..6f9170c7 100644
--- a/scheduler/service/service.go
+++ b/scheduler/service/service.go
@@ -24,7 +24,6 @@ import (
 	"d7y.io/dragonfly/v2/pkg/rpc/base"
 	"d7y.io/dragonfly/v2/pkg/rpc/base/common"
 	rpcscheduler "d7y.io/dragonfly/v2/pkg/rpc/scheduler"
-	pkgsync "d7y.io/dragonfly/v2/pkg/sync"
 	"d7y.io/dragonfly/v2/scheduler/config"
 	"d7y.io/dragonfly/v2/scheduler/metrics"
 	"d7y.io/dragonfly/v2/scheduler/resource"
@@ -58,9 +57,6 @@ type service struct {
 
 	// Dynamic config
 	dynconfig config.DynconfigInterface
-
-	// Key map mutex
-	kmu *pkgsync.Krwmutex
 }
 
 func New(
@@ -78,7 +74,6 @@ func New(
 		callback:  callback,
 		config:    cfg,
 		dynconfig: dynconfig,
-		kmu:       pkgsync.NewKrwmutex(),
 	}
 }
 
@@ -92,9 +87,6 @@ func (s *service) CDN() resource.CDN {
 
 func (s *service) RegisterTask(ctx context.Context, req *rpcscheduler.PeerTaskRequest) (*resource.Task, error) {
 	task := resource.NewTask(idgen.TaskID(req.Url, req.UrlMeta), req.Url, s.config.Scheduler.BackSourceCount, req.UrlMeta)
-
-	s.kmu.Lock(task.ID)
-	defer s.kmu.Unlock(task.ID)
 	task, ok := s.resource.TaskManager().LoadOrStore(task)
 	if ok && (task.FSM.Is(resource.TaskStateRunning) || task.FSM.Is(resource.TaskStateSucceeded)) {
 		// Task is healthy and can be reused


Test patch:
diff --git a/pkg/sync/kmutex_test.go b/pkg/sync/kmutex_test.go
deleted file mode 100644
index 6154fce3..00000000
--- a/pkg/sync/kmutex_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *     Copyright 2020 The Dragonfly Authors
- *
- * Licensed 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 sync
-
-import (
-	"testing"
-	"time"
-)
-
-func TestKmutex_Lock(t *testing.T) {
-	k := NewKmutex()
-	done := time.After(time.Second)
-
-	k.Lock("foo")
-	foo := make(chan struct{})
-	go func() {
-		k.Lock("foo")
-		close(foo)
-	}()
-
-	k.Lock("bar")
-	bar := make(chan struct{})
-	go func() {
-		k.Lock("bar")
-		close(bar)
-	}()
-
-	k.Lock("baz")
-	baz := make(chan struct{})
-	go func() {
-		k.Lock("baz")
-		close(baz)
-	}()
-
-	select {
-	case <-bar:
-	case <-baz:
-	case <-foo:
-	case <-done:
-		t.Fatal("kmutex is not unlocked")
-	default:
-	}
-
-	k.Unlock("foo")
-	select {
-	case <-bar:
-	case <-baz:
-	case <-done:
-		t.Fatal("bar and baz are not unlocked")
-	case <-foo:
-		k.Unlock("foo")
-	}
-
-	k.Unlock("bar")
-	select {
-	case <-foo:
-	case <-baz:
-	case <-done:
-		t.Fatal("foo and baz are not unlocked")
-	case <-bar:
-		k.Unlock("bar")
-	}
-
-	k.Unlock("baz")
-	select {
-	case <-foo:
-	case <-bar:
-	case <-done:
-		t.Fatal("foo and bar are not unlocked")
-	case <-baz:
-		k.Unlock("baz")
-	}
-}
diff --git a/pkg/sync/krwmutex_test.go b/pkg/sync/krwmutex_test.go
deleted file mode 100644
index 615f51bf..00000000
--- a/pkg/sync/krwmutex_test.go
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- *     Copyright 2020 The Dragonfly Authors
- *
- * Licensed 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 sync
-
-import (
-	"testing"
-	"time"
-)
-
-func TestKrwmutex_Lock(t *testing.T) {
-	k := NewKrwmutex()
-	done := time.After(time.Second)
-
-	k.Lock("foo")
-	foo := make(chan struct{})
-	go func() {
-		k.Lock("foo")
-		close(foo)
-	}()
-
-	k.Lock("bar")
-	bar := make(chan struct{})
-	go func() {
-		k.Lock("bar")
-		close(bar)
-	}()
-
-	k.Lock("baz")
-	baz := make(chan struct{})
-	go func() {
-		k.Lock("baz")
-		close(baz)
-	}()
-
-	select {
-	case <-bar:
-	case <-baz:
-	case <-foo:
-	case <-done:
-		t.Fatal("kmutex is not unlocked")
-	default:
-	}
-
-	k.Unlock("foo")
-	select {
-	case <-bar:
-	case <-baz:
-	case <-done:
-		t.Fatal("bar and baz are not unlocked")
-	case <-foo:
-		k.Unlock("foo")
-	}
-
-	k.Unlock("bar")
-	select {
-	case <-foo:
-	case <-baz:
-	case <-done:
-		t.Fatal("foo and baz are not unlocked")
-	case <-bar:
-		k.Unlock("bar")
-	}
-
-	k.Unlock("baz")
-	select {
-	case <-foo:
-	case <-bar:
-	case <-done:
-		t.Fatal("foo and bar are not unlocked")
-	case <-baz:
-		k.Unlock("baz")
-	}
-}
-
-func TestKrwmutex_RLock(t *testing.T) {
-	k := NewKrwmutex()
-	done := time.After(time.Second)
-
-	k.Lock("foo")
-	foo := make(chan struct{})
-	go func() {
-		k.RLock("foo")
-		close(foo)
-	}()
-
-	k.Lock("bar")
-	bar := make(chan struct{})
-	go func() {
-		k.RLock("bar")
-		close(bar)
-	}()
-
-	k.Lock("baz")
-	baz := make(chan struct{})
-	go func() {
-		k.RLock("baz")
-		close(baz)
-	}()
-
-	select {
-	case <-bar:
-	case <-baz:
-	case <-foo:
-	case <-done:
-		t.Fatal("kmutex is not unlocked")
-	default:
-	}
-
-	k.Unlock("foo")
-	select {
-	case <-bar:
-	case <-baz:
-	case <-done:
-		t.Fatal("bar and baz are not unlocked")
-	case <-foo:
-		k.RUnlock("foo")
-	}
-
-	k.Unlock("bar")
-	select {
-	case <-foo:
-	case <-baz:
-	case <-done:
-		t.Fatal("foo and baz are not unlocked")
-	case <-bar:
-		k.RUnlock("bar")
-	}
-
-	k.Unlock("baz")
-	select {
-	case <-foo:
-	case <-bar:
-	case <-done:
-		t.Fatal("foo and bar are not unlocked")
-	case <-baz:
-		k.RUnlock("baz")
-	}
-}