[TD-5018]<fix>: taosdemo prompt if the batch is too large to insert data. (#6737)
This commit is contained in:
parent
7f2e888bbc
commit
4e9433020c
|
@ -4834,7 +4834,7 @@ static int64_t generateStbRowData(
|
||||||
dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
|
dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
|
||||||
"%"PRId64",", rand_bigint());
|
"%"PRId64",", rand_bigint());
|
||||||
} else {
|
} else {
|
||||||
errorPrint( "No support data type: %s\n", stbInfo->columns[i].dataType);
|
errorPrint( "Not support data type: %s\n", stbInfo->columns[i].dataType);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4842,6 +4842,7 @@ static int64_t generateStbRowData(
|
||||||
dataLen -= 1;
|
dataLen -= 1;
|
||||||
dataLen += snprintf(pstr + dataLen, maxLen - dataLen, ")");
|
dataLen += snprintf(pstr + dataLen, maxLen - dataLen, ")");
|
||||||
|
|
||||||
|
verbosePrint("%s() LN%d, dataLen:%"PRId64"\n", __func__, __LINE__, dataLen);
|
||||||
verbosePrint("%s() LN%d, recBuf:\n\t%s\n", __func__, __LINE__, recBuf);
|
verbosePrint("%s() LN%d, recBuf:\n\t%s\n", __func__, __LINE__, recBuf);
|
||||||
|
|
||||||
return strlen(recBuf);
|
return strlen(recBuf);
|
||||||
|
@ -5094,24 +5095,25 @@ static int32_t generateStbDataTail(
|
||||||
} else {
|
} else {
|
||||||
tsRand = false;
|
tsRand = false;
|
||||||
}
|
}
|
||||||
verbosePrint("%s() LN%d batch=%u\n", __func__, __LINE__, batch);
|
verbosePrint("%s() LN%d batch=%u buflen=%"PRId64"\n",
|
||||||
|
__func__, __LINE__, batch, remainderBufLen);
|
||||||
|
|
||||||
int32_t k = 0;
|
int32_t k = 0;
|
||||||
for (k = 0; k < batch;) {
|
for (k = 0; k < batch;) {
|
||||||
char data[MAX_DATA_SIZE];
|
char data[MAX_DATA_SIZE];
|
||||||
memset(data, 0, MAX_DATA_SIZE);
|
memset(data, 0, MAX_DATA_SIZE);
|
||||||
|
|
||||||
int64_t retLen = 0;
|
int64_t lenOfRow = 0;
|
||||||
|
|
||||||
if (tsRand) {
|
if (tsRand) {
|
||||||
retLen = generateStbRowData(superTblInfo, data,
|
lenOfRow = generateStbRowData(superTblInfo, data,
|
||||||
startTime + getTSRandTail(
|
startTime + getTSRandTail(
|
||||||
superTblInfo->timeStampStep, k,
|
superTblInfo->timeStampStep, k,
|
||||||
superTblInfo->disorderRatio,
|
superTblInfo->disorderRatio,
|
||||||
superTblInfo->disorderRange)
|
superTblInfo->disorderRange)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
retLen = getRowDataFromSample(
|
lenOfRow = getRowDataFromSample(
|
||||||
data,
|
data,
|
||||||
remainderBufLen < MAX_DATA_SIZE ? remainderBufLen : MAX_DATA_SIZE,
|
remainderBufLen < MAX_DATA_SIZE ? remainderBufLen : MAX_DATA_SIZE,
|
||||||
startTime + superTblInfo->timeStampStep * k,
|
startTime + superTblInfo->timeStampStep * k,
|
||||||
|
@ -5119,14 +5121,14 @@ static int32_t generateStbDataTail(
|
||||||
pSamplePos);
|
pSamplePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retLen > remainderBufLen) {
|
if (lenOfRow > remainderBufLen) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr += snprintf(pstr , retLen + 1, "%s", data);
|
pstr += snprintf(pstr , lenOfRow + 1, "%s", data);
|
||||||
k++;
|
k++;
|
||||||
len += retLen;
|
len += lenOfRow;
|
||||||
remainderBufLen -= retLen;
|
remainderBufLen -= lenOfRow;
|
||||||
|
|
||||||
verbosePrint("%s() LN%d len=%"PRIu64" k=%u \nbuffer=%s\n",
|
verbosePrint("%s() LN%d len=%"PRIu64" k=%u \nbuffer=%s\n",
|
||||||
__func__, __LINE__, len, k, buffer);
|
__func__, __LINE__, len, k, buffer);
|
||||||
|
@ -5915,11 +5917,14 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
startTs = taosGetTimestampMs();
|
startTs = taosGetTimestampMs();
|
||||||
|
|
||||||
if (recOfBatch == 0) {
|
if (recOfBatch == 0) {
|
||||||
errorPrint("[%d] %s() LN%d try inserting records of batch is %d\n",
|
errorPrint("[%d] %s() LN%d Failed to insert records of batch %d\n",
|
||||||
pThreadInfo->threadID, __func__, __LINE__,
|
pThreadInfo->threadID, __func__, __LINE__,
|
||||||
recOfBatch);
|
batchPerTbl);
|
||||||
errorPrint("%s\n", "\tPlease check if the batch or the buffer length is proper value!\n");
|
errorPrint("\tIf the batch is %d, the length of the SQL to insert a row must be less then %"PRId64"\n",
|
||||||
goto free_of_interlace;
|
batchPerTbl, maxSqlLen / batchPerTbl);
|
||||||
|
errorPrint("\tPlease check if the buffer length(%"PRId64") or batch(%d) is set with proper value!\n",
|
||||||
|
maxSqlLen, batchPerTbl);
|
||||||
|
goto free_of_interlace;
|
||||||
}
|
}
|
||||||
int64_t affectedRows = execInsert(pThreadInfo, recOfBatch);
|
int64_t affectedRows = execInsert(pThreadInfo, recOfBatch);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue