enh: support wider range for future timestamp
This commit is contained in:
parent
ba34b7477f
commit
25148268e6
|
@ -43,6 +43,7 @@ extern int32_t tsMaxNumOfDistinctResults;
|
|||
extern int32_t tsCompatibleModel;
|
||||
extern bool tsPrintAuth;
|
||||
extern int64_t tsTickPerMin[3];
|
||||
extern int64_t tsMaxKeyByPrecision[3];
|
||||
extern int32_t tsCountAlwaysReturnValue;
|
||||
|
||||
// queue & threads
|
||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
|||
|
||||
#define TSKEY int64_t
|
||||
#define TSKEY_MIN INT64_MIN
|
||||
#define TSKEY_MAX (INT64_MAX - 1)
|
||||
#define TSKEY_MAX INT64_MAX
|
||||
#define TSKEY_INITIAL_VAL TSKEY_MIN
|
||||
|
||||
#define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle
|
||||
|
|
|
@ -141,6 +141,15 @@ bool tsDeployOnSnode = true;
|
|||
*/
|
||||
int64_t tsTickPerMin[] = {60000L, 60000000L, 60000000000L};
|
||||
|
||||
/**
|
||||
* @brief max key by precision
|
||||
* approximately calculation:
|
||||
* ms: 3600*1000*8765*1000 // 1970 + 1000 years
|
||||
* us: 3600*1000000*8765*1000 // 1970 + 1000 years
|
||||
* ns: 3600*1000000000*8765*292 // 1970 + 292 years
|
||||
*/
|
||||
int64_t tsMaxKeyByPrecision[] = {31556995200000L, 31556995200000000L, 9214646400000000000L};
|
||||
|
||||
// lossy compress 6
|
||||
char tsLossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty
|
||||
// can close lossy compress.
|
||||
|
|
|
@ -495,6 +495,10 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
|
|||
pCommitter->commitFid = tsdbKeyFid(pCommitter->nextKey, pCommitter->minutes, pCommitter->precision);
|
||||
tsdbFidKeyRange(pCommitter->commitFid, pCommitter->minutes, pCommitter->precision, &pCommitter->minKey,
|
||||
&pCommitter->maxKey);
|
||||
#if 0
|
||||
ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey);
|
||||
#endif
|
||||
|
||||
pCommitter->nextKey = TSKEY_MAX;
|
||||
|
||||
// Reader
|
||||
|
|
|
@ -505,8 +505,8 @@ int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision) {
|
|||
}
|
||||
|
||||
void tsdbFidKeyRange(int32_t fid, int32_t minutes, int8_t precision, TSKEY *minKey, TSKEY *maxKey) {
|
||||
*minKey = fid * minutes * tsTickPerMin[precision];
|
||||
*maxKey = *minKey + minutes * tsTickPerMin[precision] - 1;
|
||||
*minKey = tsTickPerMin[precision] * fid * minutes;
|
||||
*maxKey = *minKey + tsTickPerMin[precision] * minutes - 1;
|
||||
}
|
||||
|
||||
int32_t tsdbFidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int64_t now) {
|
||||
|
|
|
@ -97,7 +97,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
|
|||
STsdbKeepCfg *pCfg = &pTsdb->keepCfg;
|
||||
TSKEY now = taosGetTimestamp(pCfg->precision);
|
||||
TSKEY minKey = now - tsTickPerMin[pCfg->precision] * pCfg->keep2;
|
||||
TSKEY maxKey = now + tsTickPerMin[pCfg->precision] * pCfg->days;
|
||||
TSKEY maxKey = tsMaxKeyByPrecision[pCfg->precision];
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
// pMsg->length = htonl(pMsg->length);
|
||||
|
|
Loading…
Reference in New Issue