提交 1f7a9e67 编写于 作者: weixin_48148422's avatar weixin_48148422

subscribe: minor improvement

revise progress persistent file format to reduce file size.
example: print out number of rows consumed
上级 35976735
...@@ -265,7 +265,7 @@ static int tscLoadSubscriptionProgress(SSub* pSub) { ...@@ -265,7 +265,7 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
return 0; return 0;
} }
int64_t uid, key; int64_t uid, key;
sscanf(buf, "uid=%" SCNd64 ",progress=%" SCNd64, &uid, &key); sscanf(buf, "%" SCNd64 ":%" SCNd64, &uid, &key);
progress[i].uid = uid; progress[i].uid = uid;
progress[i].key = key; progress[i].key = key;
} }
...@@ -300,7 +300,7 @@ void tscSaveSubscriptionProgress(void* sub) { ...@@ -300,7 +300,7 @@ void tscSaveSubscriptionProgress(void* sub) {
for (int i = 0; i < pSub->numOfMeters; i++) { for (int i = 0; i < pSub->numOfMeters; i++) {
int64_t uid = pSub->progress[i].uid; int64_t uid = pSub->progress[i].uid;
TSKEY key = pSub->progress[i].key; TSKEY key = pSub->progress[i].key;
fprintf(fp, "uid=%" PRId64 ",progress=%" PRId64 "\n", uid, key); fprintf(fp, "%" PRId64 ":%" PRId64 "\n", uid, key);
} }
fclose(fp); fclose(fp);
......
...@@ -11,9 +11,10 @@ void print_result(TAOS_RES* res, int blockFetch) { ...@@ -11,9 +11,10 @@ void print_result(TAOS_RES* res, int blockFetch) {
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
int num_fields = taos_num_fields(res); int num_fields = taos_num_fields(res);
TAOS_FIELD* fields = taos_fetch_fields(res); TAOS_FIELD* fields = taos_fetch_fields(res);
int nRows = 0;
if (blockFetch) { if (blockFetch) {
int nRows = taos_fetch_block(res, &row); nRows = taos_fetch_block(res, &row);
for (int i = 0; i < nRows; i++) { for (int i = 0; i < nRows; i++) {
char temp[256]; char temp[256];
taos_print_row(temp, row + i, fields, num_fields); taos_print_row(temp, row + i, fields, num_fields);
...@@ -24,8 +25,11 @@ void print_result(TAOS_RES* res, int blockFetch) { ...@@ -24,8 +25,11 @@ void print_result(TAOS_RES* res, int blockFetch) {
char temp[256]; char temp[256];
taos_print_row(temp, row, fields, num_fields); taos_print_row(temp, row, fields, num_fields);
puts(temp); puts(temp);
nRows++;
} }
} }
printf("%d rows consumed.\n", nRows);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册