提交 0eb724fc 编写于 作者: Z zhaoyanggh

remove assert

上级 9ef8f245
...@@ -383,10 +383,8 @@ typedef struct SSuperTable_S { ...@@ -383,10 +383,8 @@ typedef struct SSuperTable_S {
uint32_t tagSampleCount; uint32_t tagSampleCount;
uint32_t tagUsePos; uint32_t tagUsePos;
#if STMT_BIND_PARAM_BATCH == 1
// bind param batch // bind param batch
char *sampleBindBatchArray; char *sampleBindBatchArray;
#endif
// statistics // statistics
uint64_t totalInsertRows; uint64_t totalInsertRows;
uint64_t totalAffectedRows; uint64_t totalAffectedRows;
...@@ -525,13 +523,9 @@ typedef struct SThreadInfo_S { ...@@ -525,13 +523,9 @@ typedef struct SThreadInfo_S {
TAOS_STMT *stmt; TAOS_STMT *stmt;
int64_t * bind_ts; int64_t * bind_ts;
#if STMT_BIND_PARAM_BATCH == 1
int64_t *bind_ts_array; int64_t *bind_ts_array;
char * bindParams; char * bindParams;
char * is_null; char * is_null;
#else
char *sampleBindArray;
#endif
int threadID; int threadID;
char db_name[TSDB_DB_NAME_LEN]; char db_name[TSDB_DB_NAME_LEN];
...@@ -579,7 +573,6 @@ typedef struct SThreadInfo_S { ...@@ -579,7 +573,6 @@ typedef struct SThreadInfo_S {
} threadInfo; } threadInfo;
/* ************ Global variables ************ */ /* ************ Global variables ************ */
extern char * g_dupstr;
extern char * g_aggreFuncDemo[]; extern char * g_aggreFuncDemo[];
extern char * g_aggreFunc[]; extern char * g_aggreFunc[];
extern SArguments g_args; extern SArguments g_args;
......
...@@ -18,10 +18,8 @@ ...@@ -18,10 +18,8 @@
#include "demo.h" #include "demo.h"
/***** Global variables ******/ /***** Global variables ******/
extern char *g_sampleDataBuf; extern char * g_sampleDataBuf;
#if STMT_BIND_PARAM_BATCH == 1 extern char * g_sampleBindBatchArray;
extern char *g_sampleBindBatchArray;
#endif
extern int32_t * g_randint; extern int32_t * g_randint;
extern uint32_t *g_randuint; extern uint32_t *g_randuint;
extern int64_t * g_randbigint; extern int64_t * g_randbigint;
...@@ -43,7 +41,7 @@ extern char * g_rand_current_buff; ...@@ -43,7 +41,7 @@ extern char * g_rand_current_buff;
extern char * g_rand_phase_buff; extern char * g_rand_phase_buff;
extern char * g_randdouble_buff; extern char * g_randdouble_buff;
/***** Declare functions *****/ /***** Declare functions *****/
void init_rand_data(); int init_rand_data();
char * rand_bool_str(); char * rand_bool_str();
int32_t rand_bool(); int32_t rand_bool();
char * rand_tinyint_str(); char * rand_tinyint_str();
......
...@@ -16,10 +16,8 @@ ...@@ -16,10 +16,8 @@
#include "demoData.h" #include "demoData.h"
#include "demo.h" #include "demo.h"
char *g_sampleDataBuf = NULL; char * g_sampleDataBuf = NULL;
#if STMT_BIND_PARAM_BATCH == 1 char * g_sampleBindBatchArray = NULL;
char *g_sampleBindBatchArray = NULL;
#endif
int32_t * g_randint = NULL; int32_t * g_randint = NULL;
uint32_t *g_randuint = NULL; uint32_t *g_randuint = NULL;
int64_t * g_randbigint = NULL; int64_t * g_randbigint = NULL;
...@@ -267,47 +265,128 @@ double rand_double() { ...@@ -267,47 +265,128 @@ double rand_double() {
return g_randdouble[cursor]; return g_randdouble[cursor];
} }
void init_rand_data() { int init_rand_data() {
int32_t code = -1;
g_randint_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand); g_randint_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand);
assert(g_randint_buff); if (NULL == g_randint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
INT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_rand_voltage_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand); g_rand_voltage_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand);
assert(g_rand_voltage_buff); if (NULL == g_randint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
INT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randbigint_buff = calloc(1, BIGINT_BUFF_LEN * g_args.prepared_rand); g_randbigint_buff = calloc(1, BIGINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randbigint_buff); if (NULL == g_randbigint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
BIGINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randsmallint_buff = calloc(1, SMALLINT_BUFF_LEN * g_args.prepared_rand); g_randsmallint_buff = calloc(1, SMALLINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randsmallint_buff); if (NULL == g_randsmallint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
SMALLINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randtinyint_buff = calloc(1, TINYINT_BUFF_LEN * g_args.prepared_rand); g_randtinyint_buff = calloc(1, TINYINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randtinyint_buff); if (NULL == g_randtinyint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
TINYINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randbool_buff = calloc(1, BOOL_BUFF_LEN * g_args.prepared_rand); g_randbool_buff = calloc(1, BOOL_BUFF_LEN * g_args.prepared_rand);
assert(g_randbool_buff); if (NULL == g_randbool_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
BOOL_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randfloat_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand); g_randfloat_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand);
assert(g_randfloat_buff); if (NULL == g_randfloat_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
FLOAT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_rand_current_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand); g_rand_current_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand);
assert(g_rand_current_buff); if (NULL == g_rand_current_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
FLOAT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_rand_phase_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand); g_rand_phase_buff = calloc(1, FLOAT_BUFF_LEN * g_args.prepared_rand);
assert(g_rand_phase_buff); if (NULL == g_rand_phase_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
FLOAT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randdouble_buff = calloc(1, DOUBLE_BUFF_LEN * g_args.prepared_rand); g_randdouble_buff = calloc(1, DOUBLE_BUFF_LEN * g_args.prepared_rand);
assert(g_randdouble_buff); if (NULL == g_randdouble_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
DOUBLE_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randuint_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand); g_randuint_buff = calloc(1, INT_BUFF_LEN * g_args.prepared_rand);
assert(g_randuint_buff); if (NULL == g_randuint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
INT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randutinyint_buff = calloc(1, TINYINT_BUFF_LEN * g_args.prepared_rand); g_randutinyint_buff = calloc(1, TINYINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randutinyint_buff); if (NULL == g_randutinyint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
TINYINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randusmallint_buff = calloc(1, SMALLINT_BUFF_LEN * g_args.prepared_rand); g_randusmallint_buff = calloc(1, SMALLINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randusmallint_buff); if (NULL == g_randusmallint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
SMALLINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randubigint_buff = calloc(1, BIGINT_BUFF_LEN * g_args.prepared_rand); g_randubigint_buff = calloc(1, BIGINT_BUFF_LEN * g_args.prepared_rand);
assert(g_randubigint_buff); if (NULL == g_randubigint_buff) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
BIGINT_BUFF_LEN * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randint = calloc(1, sizeof(int32_t) * g_args.prepared_rand); g_randint = calloc(1, sizeof(int32_t) * g_args.prepared_rand);
assert(g_randint); if (NULL == g_randint) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(int32_t) * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randuint = calloc(1, sizeof(uint32_t) * g_args.prepared_rand); g_randuint = calloc(1, sizeof(uint32_t) * g_args.prepared_rand);
assert(g_randuint); if (NULL == g_randuint) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(uint32_t) * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randbigint = calloc(1, sizeof(int64_t) * g_args.prepared_rand); g_randbigint = calloc(1, sizeof(int64_t) * g_args.prepared_rand);
assert(g_randbigint); if (NULL == g_randbigint) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(int64_t) * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randubigint = calloc(1, sizeof(uint64_t) * g_args.prepared_rand); g_randubigint = calloc(1, sizeof(uint64_t) * g_args.prepared_rand);
assert(g_randubigint); if (NULL == g_randubigint) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(uint64_t) * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randfloat = calloc(1, sizeof(float) * g_args.prepared_rand); g_randfloat = calloc(1, sizeof(float) * g_args.prepared_rand);
assert(g_randfloat); if (NULL == g_randfloat) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(float) * g_args.prepared_rand);
goto end_init_rand_data;
}
g_randdouble = calloc(1, sizeof(double) * g_args.prepared_rand); g_randdouble = calloc(1, sizeof(double) * g_args.prepared_rand);
assert(g_randdouble); if (NULL == g_randdouble) {
errorPrint("failed to allocate %" PRId64 " size memory\n",
sizeof(double) * g_args.prepared_rand);
goto end_init_rand_data;
}
for (int i = 0; i < g_args.prepared_rand; i++) { for (int i = 0; i < g_args.prepared_rand; i++) {
g_randint[i] = (int)(taosRandom() % RAND_MAX - (RAND_MAX >> 1)); g_randint[i] = (int)(taosRandom() % RAND_MAX - (RAND_MAX >> 1));
...@@ -350,4 +429,7 @@ void init_rand_data() { ...@@ -350,4 +429,7 @@ void init_rand_data() {
(taosRandom() % 2 > 0.5 ? 1 : -1); (taosRandom() % 2 > 0.5 ? 1 : -1);
sprintf(g_randdouble_buff + i * DOUBLE_BUFF_LEN, "%f", g_randdouble[i]); sprintf(g_randdouble_buff + i * DOUBLE_BUFF_LEN, "%f", g_randdouble[i]);
} }
code = 0;
end_init_rand_data:
return code;
} }
\ No newline at end of file
此差异已折叠。
...@@ -95,8 +95,6 @@ int main(int argc, char *argv[]) { ...@@ -95,8 +95,6 @@ int main(int argc, char *argv[]) {
} else { } else {
testCmdLine(); testCmdLine();
} }
if (g_dupstr) free(g_dupstr);
} }
postFreeResource(); postFreeResource();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册