Merge pull request #5423 from taosdata/hotfix/TD-3238
[TD-3238]<hotfix>: fix time < 1970-01-01 coredump
This commit is contained in:
commit
d6c7cd07d4
|
@ -283,12 +283,37 @@ typedef struct {
|
||||||
#define keyCol(pCols) (&((pCols)->cols[0])) // Key column
|
#define keyCol(pCols) (&((pCols)->cols[0])) // Key column
|
||||||
#define dataColsTKeyAt(pCols, idx) ((TKEY *)(keyCol(pCols)->pData))[(idx)]
|
#define dataColsTKeyAt(pCols, idx) ((TKEY *)(keyCol(pCols)->pData))[(idx)]
|
||||||
#define dataColsKeyAt(pCols, idx) tdGetKey(dataColsTKeyAt(pCols, idx))
|
#define dataColsKeyAt(pCols, idx) tdGetKey(dataColsTKeyAt(pCols, idx))
|
||||||
#define dataColsTKeyFirst(pCols) (((pCols)->numOfRows == 0) ? TKEY_INVALID : dataColsTKeyAt(pCols, 0))
|
static FORCE_INLINE TKEY dataColsTKeyFirst(SDataCols *pCols) {
|
||||||
#define dataColsKeyFirst(pCols) (((pCols)->numOfRows == 0) ? TSDB_DATA_TIMESTAMP_NULL : dataColsKeyAt(pCols, 0))
|
if (pCols->numOfRows) {
|
||||||
#define dataColsTKeyLast(pCols) \
|
return dataColsTKeyAt(pCols, 0);
|
||||||
(((pCols)->numOfRows == 0) ? TKEY_INVALID : dataColsTKeyAt(pCols, (pCols)->numOfRows - 1))
|
} else {
|
||||||
#define dataColsKeyLast(pCols) \
|
return TKEY_INVALID;
|
||||||
(((pCols)->numOfRows == 0) ? TSDB_DATA_TIMESTAMP_NULL : dataColsKeyAt(pCols, (pCols)->numOfRows - 1))
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE TSKEY dataColsKeyFirst(SDataCols *pCols) {
|
||||||
|
if (pCols->numOfRows) {
|
||||||
|
return dataColsKeyAt(pCols, 0);
|
||||||
|
} else {
|
||||||
|
return TSDB_DATA_TIMESTAMP_NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE TKEY dataColsTKeyLast(SDataCols *pCols) {
|
||||||
|
if (pCols->numOfRows) {
|
||||||
|
return dataColsTKeyAt(pCols, pCols->numOfRows - 1);
|
||||||
|
} else {
|
||||||
|
return TKEY_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE TSKEY dataColsKeyLast(SDataCols *pCols) {
|
||||||
|
if (pCols->numOfRows) {
|
||||||
|
return dataColsKeyAt(pCols, pCols->numOfRows - 1);
|
||||||
|
} else {
|
||||||
|
return TSDB_DATA_TIMESTAMP_NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows);
|
SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows);
|
||||||
void tdResetDataCols(SDataCols *pCols);
|
void tdResetDataCols(SDataCols *pCols);
|
||||||
|
|
|
@ -15,7 +15,13 @@
|
||||||
#include "tsdbint.h"
|
#include "tsdbint.h"
|
||||||
|
|
||||||
#define TSDB_MAX_SUBBLOCKS 8
|
#define TSDB_MAX_SUBBLOCKS 8
|
||||||
#define TSDB_KEY_FID(key, days, precision) ((key) / tsMsPerDay[(precision)] / (days))
|
static FORCE_INLINE int TSDB_KEY_FID(TSKEY key, int32_t days, int8_t precision) {
|
||||||
|
if (key < 0) {
|
||||||
|
return (int)(-((-key) / tsMsPerDay[precision] / days + 1));
|
||||||
|
} else {
|
||||||
|
return (int)((key / tsMsPerDay[precision] / days));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SRtn rtn; // retention snapshot
|
SRtn rtn; // retention snapshot
|
||||||
|
|
Loading…
Reference in New Issue