From 213e8b89208f60efc2a321bd7f1c57c4b06882c6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 26 Apr 2023 17:58:23 +0800 Subject: [PATCH] log: disable some logs. --- source/client/test/clientTests.cpp | 45 +++++++++++---------- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 12 +++++- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 055ac450dc..65f115618f 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -165,7 +165,7 @@ void* queryThread(void* arg) { int32_t numOfThreads = 1; void tmq_commit_cb_print(tmq_t* pTmq, int32_t code, void* param) { - printf("auto commit success, code:%d\n\n\n\n", code); +// printf("auto commit success, code:%d\n", code); } void* doConsumeData(void* param) { @@ -1053,19 +1053,24 @@ TEST(clientCase, sub_db_test) { } TEST(clientCase, sub_tb_test) { - taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg"); + taos_options(TSDB_OPTION_CONFIGDIR, "/home/tests/dir/cfg/"); - TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("vm116", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); tmq_conf_t* conf = tmq_conf_new(); + + int64_t ts = taosGetTimestampMs(); + char consumerGroupid[128] = {0}; + sprintf(consumerGroupid, "group_id_%"PRId64, ts); + tmq_conf_set(conf, "enable.auto.commit", "true"); - tmq_conf_set(conf, "auto.commit.interval.ms", "1000"); - tmq_conf_set(conf, "group.id", "cgrpName45"); + tmq_conf_set(conf, "auto.commit.interval.ms", "2000"); + tmq_conf_set(conf, "group.id", consumerGroupid); tmq_conf_set(conf, "td.connect.user", "root"); tmq_conf_set(conf, "td.connect.pass", "taosdata"); tmq_conf_set(conf, "auto.offset.reset", "earliest"); - tmq_conf_set(conf, "experimental.snapshot.enable", "true"); + tmq_conf_set(conf, "experimental.snapshot.enable", "false"); tmq_conf_set(conf, "msg.with.table.name", "true"); tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); @@ -1074,7 +1079,7 @@ TEST(clientCase, sub_tb_test) { // 创建订阅 topics 列表 tmq_list_t* topicList = tmq_list_new(); - tmq_list_append(topicList, "topic_t2"); + tmq_list_append(topicList, "topic_t1"); // 启动订阅 tmq_subscribe(tmq, topicList); @@ -1093,15 +1098,15 @@ TEST(clientCase, sub_tb_test) { while (1) { TAOS_RES* pRes = tmq_consumer_poll(tmq, timeout); if (pRes) { - char buf[1024]; + char buf[128]; - const char* topicName = tmq_get_topic_name(pRes); - const char* dbName = tmq_get_db_name(pRes); - int32_t vgroupId = tmq_get_vgroup_id(pRes); - - printf("topic: %s\n", topicName); - printf("db: %s\n", dbName); - printf("vgroup id: %d\n", vgroupId); +// const char* topicName = tmq_get_topic_name(pRes); +// const char* dbName = tmq_get_db_name(pRes); +// int32_t vgroupId = tmq_get_vgroup_id(pRes); +// +// printf("topic: %s\n", topicName); +// printf("db: %s\n", dbName); +// printf("vgroup id: %d\n", vgroupId); while (1) { TAOS_ROW row = taos_fetch_row(pRes); @@ -1111,16 +1116,14 @@ TEST(clientCase, sub_tb_test) { fields = taos_fetch_fields(pRes); numOfFields = taos_field_count(pRes); - precision = taos_result_precision(pRes); - taos_print_row(buf, row, fields, numOfFields); totalRows += 1; - printf("precision: %d, row content: %s\n", precision, buf); + if (totalRows % 100000 == 0) { + taos_print_row(buf, row, fields, numOfFields); + printf("row content: %s\n", buf); + } } taos_free_result(pRes); - // if ((++count) > 1) { - // break; - // } } else { break; } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index da08bd01ac..a318b9886e 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -113,8 +113,16 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); if (code != 0) { - if (terrno != 0) code = terrno; - dGError("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr()); + if (terrno != 0) { + code = terrno; + } + + if (code == TSDB_CODE_WAL_LOG_NOT_EXIST) { + dGDebug("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr()); + } else { + dGError("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr()); + } + vmSendRsp(pMsg, code); } -- GitLab