diff --git a/src/client/inc/tscBulkWrite.h b/src/client/inc/tscBulkWrite.h index 3ecc9f6478c990e6b734bd1453da027b29df7ee3..c0b4a51e6ae48ce34b5607c714ec6cd8159e7658 100644 --- a/src/client/inc/tscBulkWrite.h +++ b/src/client/inc/tscBulkWrite.h @@ -16,8 +16,6 @@ #ifndef TDENGINE_TSCBULKWRITE_H #define TDENGINE_TSCBULKWRITE_H -#include -#include #ifdef __cplusplus extern "C" { #endif diff --git a/src/client/src/tscBulkWrite.c b/src/client/src/tscBulkWrite.c index 2683a90a7b98595ca74eb89341949b212fe243ed..bc72dd6664f9345c79b403f686644292efbe99a1 100644 --- a/src/client/src/tscBulkWrite.c +++ b/src/client/src/tscBulkWrite.c @@ -151,7 +151,7 @@ SArray* dispatcherPollAll(SAsyncBulkWriteDispatcher* dispatcher) { } pthread_mutex_lock(&dispatcher->mutex); - SArray* statements = taosArrayInit(0, sizeof(SSqlObj*)); + SArray* statements = taosArrayInit(atomic_load_32(&dispatcher->bufferSize), sizeof(SSqlObj*)); if (statements == NULL) { pthread_mutex_unlock(&dispatcher->mutex); tscError("failed to poll all items: out of memory"); @@ -166,8 +166,7 @@ SArray* dispatcherPollAll(SAsyncBulkWriteDispatcher* dispatcher) { } // get the SSqlObj* from the node. - SSqlObj* item; - memcpy(&item, node->data, sizeof(SSqlObj*)); + SSqlObj* item = *((SSqlObj **) node->data); listNodeFree(node); atomic_fetch_sub_32(&dispatcher->bufferSize, 1); atomic_fetch_sub_32(&dispatcher->currentSize, statementGetInsertionRows(item));