From 23527898e75932ff292e7a4f9602be1c6dc3f2f1 Mon Sep 17 00:00:00 2001 From: localvar Date: Mon, 6 Jan 2020 10:43:15 +0800 Subject: [PATCH] fix issue in single meter subscription. --- src/system/detail/src/vnodeShell.c | 6 +++++- tests/examples/c/subscribe.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/system/detail/src/vnodeShell.c b/src/system/detail/src/vnodeShell.c index 66cc16d9df..0b7420664d 100644 --- a/src/system/detail/src/vnodeShell.c +++ b/src/system/detail/src/vnodeShell.c @@ -494,7 +494,11 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) { pMsg += sizeof(int32_t); *((int64_t*)pMsg) = htobe64(pQInfo->pObj->uid); pMsg += sizeof(int64_t); - *((TSKEY*)pMsg) = htobe64(pQInfo->query.lastKey); + if (pQInfo->pointsRead > 0) { + *((TSKEY*)pMsg) = htobe64(pQInfo->query.lastKey + 1); + } else { + *((TSKEY*)pMsg) = htobe64(pQInfo->query.lastKey); + } pMsg += sizeof(TSKEY); } diff --git a/tests/examples/c/subscribe.c b/tests/examples/c/subscribe.c index 80efa71dc2..a36de8e010 100644 --- a/tests/examples/c/subscribe.c +++ b/tests/examples/c/subscribe.c @@ -63,6 +63,11 @@ int main(int argc, char *argv[]) { keep = 0; continue; } + if (strncmp(argv[i], "-sql=", 5) == 0) { + sql = argv[i] + 5; + topic = "test-custom"; + continue; + } } // init TAOS -- GitLab