add assert and debug log
This commit is contained in:
parent
9242cef879
commit
b8041e4043
|
@ -30,6 +30,7 @@ extern uint32_t qDebugFlag;
|
||||||
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", 255, __VA_ARGS__); }} while(0)
|
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", 255, __VA_ARGS__); }} while(0)
|
||||||
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
|
#define qDump(a, l) do { if (qDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)a, l); }} while(0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -7164,10 +7164,19 @@ static int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) {
|
||||||
if (fseek(f, 0, SEEK_SET) >= 0) {
|
if (fseek(f, 0, SEEK_SET) >= 0) {
|
||||||
size_t sz = fread(data, 1, s, f);
|
size_t sz = fread(data, 1, s, f);
|
||||||
if(sz < s) { // todo handle error
|
if(sz < s) { // todo handle error
|
||||||
|
qError("fread(f:%p,%d) failed, rsize:%" PRId64 ", expect size:%" PRId64, f, fileno(f), sz, s);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UNUSED(s);
|
UNUSED(s);
|
||||||
|
qError("fseek(f:%p,%d) failed, error:%s", f, fileno(f), strerror(errno));
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s <= (sizeof(STSBufFileHeader) + sizeof(STSGroupBlockInfo) + 6 * sizeof(int32_t))) {
|
||||||
|
qDump(data, s);
|
||||||
|
|
||||||
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Reference in New Issue