You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "git-hulk (via GitHub)" <gi...@apache.org> on 2024/12/04 09:01:15 UTC

Re: [PR] feat: skip block cache deallocation to make shutdown fast [kvrocks]

git-hulk commented on code in PR #2683:
URL: https://github.com/apache/kvrocks/pull/2683#discussion_r1869004329


##########
tests/gocase/unit/config/config_test.go:
##########
@@ -320,3 +320,25 @@ func TestGenerateConfigsMatrix(t *testing.T) {
 	require.Contains(t, configsMatrix, util.KvrocksServerConfigs{"txn-context-enabled": "no", "resp3-enabled": "yes"})
 	require.Contains(t, configsMatrix, util.KvrocksServerConfigs{"txn-context-enabled": "no", "resp3-enabled": "no"})
 }
+
+
+func TestGetConfigSkipBlockCacheDeallocationOnClose(t *testing.T) {
+	srv := util.StartServer(t, map[string]string{
+		"skip-block-cache-deallocation-on-close": "yes",
+	})
+	defer srv.Close()
+
+	ctx := context.Background()
+	rdb := srv.NewClient()
+	defer func() { require.NoError(t, rdb.Close()) }()
+	val := rdb.ConfigGet(ctx, "skip-block-cache-deallocation-on-close").Val()
+	require.EqualValues(t, "yes", val["skip-block-cache-deallocation-on-close"])
+
+	// default value "no"
+	srv1 := util.StartServer(t, map[string]string{})
+	defer srv1.Close()
+
+	rdb = srv1.NewClient()
+	val = rdb.ConfigGet(ctx, "skip-block-cache-deallocation-on-close").Val()
+	require.EqualValues(t, "no", val["skip-block-cache-deallocation-on-close"])
+}

Review Comment:
   ```suggestion
   func TestGetConfigSkipBlockCacheDeallocationOnClose(t *testing.T) {
   	srv := util.StartServer(t, map[string]string{
   		"skip-block-cache-deallocation-on-close": "yes",
   	})
   	defer srv.Close()
   
   	ctx := context.Background()
   	rdb := srv.NewClient()
   	defer func() { require.NoError(t, rdb.Close()) }()
   	val := rdb.ConfigGet(ctx, "skip-block-cache-deallocation-on-close").Val()
   	require.EqualValues(t, "yes", val["skip-block-cache-deallocation-on-close"])
   
   	// default value "no"
   	srv1 := util.StartServer(t, map[string]string{})
   	defer srv1.Close()
   
   	rdb = srv1.NewClient()
   	val = rdb.ConfigGet(ctx, "skip-block-cache-deallocation-on-close").Val()
   	require.EqualValues(t, "no", val["skip-block-cache-deallocation-on-close"])
   }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org