diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md index 3f93f69f0f..e7cefc1d7a 100644 --- a/docs/en/12-taos-sql/14-stream.md +++ b/docs/en/12-taos-sql/14-stream.md @@ -80,7 +80,7 @@ If a stream is created with PARTITION BY clause and SUBTABLE clause, the name of CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m); ``` -IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name(Starting from 3.2.3.0, in order to avoid the expression in subtable being unable to distinguish between different subtables, add '_groupId' to the end of subtable name). +IN PARTITION clause, 'tbname', representing each subtable name of source supertable, is given alias 'tname'. And 'tname' is used in SUBTABLE clause. In SUBTABLE clause, each auto created subtable will concat 'new-' and source subtable name as their name(Starting from 3.2.3.0, in order to avoid the expression in subtable being unable to distinguish between different subtables, add '_stableName_groupId' to the end of subtable name). If the output length exceeds the limitation of TDengine(192), the name will be truncated. If the generated name is occupied by some other table, the creation and writing of the new subtable will be failed. diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md index 5691716ce8..3d48116ec8 100644 --- a/docs/zh/12-taos-sql/14-stream.md +++ b/docs/zh/12-taos-sql/14-stream.md @@ -91,7 +91,7 @@ SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WIN CREATE STREAM avg_vol_s INTO avg_vol SUBTABLE(CONCAT('new-', tname)) AS SELECT _wstart, count(*), avg(voltage) FROM meters PARTITION BY tbname tname INTERVAL(1m); ``` -PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名(从3.2.3.0开始,为了避免 sutable 中的表达式无法区分各个子表,即误将多个相同时间线写入一个子表,在指定的子表名后面加上 _groupId)。 +PARTITION 子句中,为 tbname 定义了一个别名 tname, 在PARTITION 子句中的别名可以用于 SUBTABLE 子句中的表达式计算,在上述示例中,流新创建的子表将以前缀 'new-' 连接原表名作为表名(从3.2.3.0开始,为了避免 sutable 中的表达式无法区分各个子表,即误将多个相同时间线写入一个子表,在指定的子表名后面加上 __stableName_groupId)。 注意,子表名的长度若超过 TDengine 的限制,将被截断。若要生成的子表名已经存在于另一超级表,由于 TDengine 的子表名是唯一的,因此对应新子表的创建以及数据的写入将会失败。 @@ -190,7 +190,7 @@ T3 时刻,最新事件到达,T 向后推移超过了第二个窗口关闭的 TDengine 对于过期数据提供两种处理方式,由 IGNORE EXPIRED 选项指定: -1. 重新计算,即 IGNORE EXPIRED 0:从 TSDB 中重新查找对应窗口的所有数据并重新计算得到最新结果 +1. 增量计算,即 IGNORE EXPIRED 0。 2. 直接丢弃,即 IGNORE EXPIRED 1:默认配置,忽略过期数据 diff --git a/include/client/taos.h b/include/client/taos.h index 45dc85f6d9..46e4e7633b 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -282,7 +282,7 @@ typedef enum tmq_res_t { TMQ_RES_INVALID = -1, TMQ_RES_DATA = 1, TMQ_RES_TABLE_META = 2, - TMQ_RES_METADATA = 3, + TMQ_RES_METADATA = 3 } tmq_res_t; typedef struct tmq_topic_assignment { diff --git a/include/common/tcommon.h b/include/common/tcommon.h index d28477ae40..a5a805ff40 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -144,6 +144,7 @@ enum { TMQ_MSG_TYPE__EP_RSP, TMQ_MSG_TYPE__POLL_DATA_META_RSP, TMQ_MSG_TYPE__WALINFO_RSP, + TMQ_MSG_TYPE__POLL_BATCH_META_RSP, }; enum { diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 139ace0fca..3c6136b624 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -158,19 +158,20 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_MAX, } EShowType; -#define TSDB_ALTER_TABLE_ADD_TAG 1 -#define TSDB_ALTER_TABLE_DROP_TAG 2 -#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3 -#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4 -#define TSDB_ALTER_TABLE_ADD_COLUMN 5 -#define TSDB_ALTER_TABLE_DROP_COLUMN 6 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7 -#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8 -#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 -#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11 -#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12 -#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13 +#define TSDB_ALTER_TABLE_ADD_TAG 1 +#define TSDB_ALTER_TABLE_DROP_TAG 2 +#define TSDB_ALTER_TABLE_UPDATE_TAG_NAME 3 +#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4 +#define TSDB_ALTER_TABLE_ADD_COLUMN 5 +#define TSDB_ALTER_TABLE_DROP_COLUMN 6 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES 7 +#define TSDB_ALTER_TABLE_UPDATE_TAG_BYTES 8 +#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 +#define TSDB_ALTER_TABLE_ADD_TAG_INDEX 11 +#define TSDB_ALTER_TABLE_DROP_TAG_INDEX 12 +#define TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS 13 +#define TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION 14 #define TSDB_FILL_NONE 0 #define TSDB_FILL_NULL 1 @@ -2321,10 +2322,10 @@ int32_t tDeserializeSVArbHeartBeatRsp(void* buf, int32_t bufLen, SVArbHeartBeatR void tFreeSVArbHeartBeatRsp(SVArbHeartBeatRsp* pRsp); typedef struct { - char* arbToken; + char* arbToken; int64_t arbTerm; - char* member0Token; - char* member1Token; + char* member0Token; + char* member1Token; } SVArbCheckSyncReq; int32_t tSerializeSVArbCheckSyncReq(void* buf, int32_t bufLen, SVArbCheckSyncReq* pReq); @@ -2344,9 +2345,9 @@ int32_t tDeserializeSVArbCheckSyncRsp(void* buf, int32_t bufLen, SVArbCheckSyncR void tFreeSVArbCheckSyncRsp(SVArbCheckSyncRsp* pRsp); typedef struct { - char* arbToken; - int64_t arbTerm; - char* memberToken; + char* arbToken; + int64_t arbTerm; + char* memberToken; } SVArbSetAssignedLeaderReq; int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq); @@ -2715,8 +2716,8 @@ typedef struct { int64_t lastTs; SArray* pVgroupVerList; // 3.3.0.0 - SArray* pCols; // array of SField - int64_t smaId; + SArray* pCols; // array of SField + int64_t smaId; } SCMCreateStreamReq; typedef struct { @@ -2763,6 +2764,7 @@ typedef struct { int32_t autoCommitInterval; int8_t resetOffsetCfg; int8_t enableReplay; + int8_t enableBatchMeta; } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2783,6 +2785,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc tlen += taosEncodeFixedI32(buf, pReq->autoCommitInterval); tlen += taosEncodeFixedI8(buf, pReq->resetOffsetCfg); tlen += taosEncodeFixedI8(buf, pReq->enableReplay); + tlen += taosEncodeFixedI8(buf, pReq->enableBatchMeta); return tlen; } @@ -2807,6 +2810,7 @@ static FORCE_INLINE void* tDeserializeSCMSubscribeReq(void* buf, SCMSubscribeReq buf = taosDecodeFixedI32(buf, &pReq->autoCommitInterval); buf = taosDecodeFixedI8(buf, &pReq->resetOffsetCfg); buf = taosDecodeFixedI8(buf, &pReq->enableReplay); + buf = taosDecodeFixedI8(buf, &pReq->enableBatchMeta); return buf; } @@ -2995,6 +2999,7 @@ typedef struct { int tEncodeSVCreateTbBatchReq(SEncoder* pCoder, const SVCreateTbBatchReq* pReq); int tDecodeSVCreateTbBatchReq(SDecoder* pCoder, SVCreateTbBatchReq* pReq); +void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq* pReq); typedef struct { int32_t code; @@ -3584,7 +3589,7 @@ static FORCE_INLINE void tqOffsetResetToData(STqOffsetVal* pOffsetVal, int64_t u pOffsetVal->type = TMQ_OFFSET__SNAPSHOT_DATA; pOffsetVal->uid = uid; pOffsetVal->ts = ts; - if(IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)){ + if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) { taosMemoryFree(pOffsetVal->primaryKey.pData); } pOffsetVal->primaryKey = primaryKey; @@ -3684,10 +3689,10 @@ typedef struct { char* ast; int64_t deleteMark; int64_t lastTs; - int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0 + int64_t normSourceTbUid; // the Uid of source tb if its a normal table, otherwise 0 SArray* pVgroupVerList; int8_t recursiveTsma; - char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma + char baseTsmaName[TSDB_TABLE_FNAME_LEN]; // base tsma name for recursively created tsma } SMCreateSmaReq; int32_t tSerializeSMCreateSmaReq(void* buf, int32_t bufLen, SMCreateSmaReq* pReq); @@ -3912,11 +3917,12 @@ typedef struct { STqOffsetVal reqOffset; int8_t enableReplay; int8_t sourceExcluded; + int8_t enableBatchMeta; } SMqPollReq; int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); int32_t tDeserializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); -void tDestroySMqPollReq(SMqPollReq *pReq); +void tDestroySMqPollReq(SMqPollReq* pReq); typedef struct { int32_t vgId; @@ -3960,7 +3966,7 @@ typedef struct { int32_t tEncodeMqMetaRsp(SEncoder* pEncoder, const SMqMetaRsp* pRsp); int32_t tDecodeMqMetaRsp(SDecoder* pDecoder, SMqMetaRsp* pRsp); -void tDeleteMqMetaRsp(SMqMetaRsp *pRsp); +void tDeleteMqMetaRsp(SMqMetaRsp* pRsp); #define MQ_DATA_RSP_VERSION 100 @@ -3997,6 +4003,20 @@ int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const void* pRsp); int32_t tDecodeSTaosxRsp(SDecoder* pDecoder, void* pRsp); void tDeleteSTaosxRsp(void* pRsp); +typedef struct SMqBatchMetaRsp { + SMqRspHead head; // not serialize + STqOffsetVal rspOffset; + SArray* batchMetaLen; + SArray* batchMetaReq; + void* pMetaBuff; // not serialize + uint32_t metaBuffLen; // not serialize +} SMqBatchMetaRsp; + +int32_t tEncodeMqBatchMetaRsp(SEncoder* pEncoder, const SMqBatchMetaRsp* pRsp); +int32_t tDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp); +int32_t tSemiDecodeMqBatchMetaRsp(SDecoder* pDecoder, SMqBatchMetaRsp* pRsp); +void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp* pRsp); + typedef struct { SMqRspHead head; char cgroup[TSDB_CGROUP_LEN]; @@ -4307,9 +4327,9 @@ int32_t tSerializeSViewMetaRsp(void* buf, int32_t bufLen, const SViewMetaRsp* pR int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp); void tFreeSViewMetaRsp(SViewMetaRsp* pRsp); typedef struct { - char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name - bool fetchingWithTsmaName; // if we are fetching with tsma name -}STableTSMAInfoReq; + char name[TSDB_TABLE_FNAME_LEN]; // table name or tsma name + bool fetchingWithTsmaName; // if we are fetching with tsma name +} STableTSMAInfoReq; int32_t tSerializeTableTSMAInfoReq(void* buf, int32_t bufLen, const STableTSMAInfoReq* pReq); int32_t tDeserializeTableTSMAInfoReq(void* buf, int32_t bufLen, STableTSMAInfoReq* pReq); @@ -4332,15 +4352,15 @@ typedef struct { int32_t version; int64_t interval; int8_t unit; - SArray* pFuncs; // SArray - SArray* pTags; // SArray - SArray* pUsedCols; // SArray + SArray* pFuncs; // SArray + SArray* pTags; // SArray + SArray* pUsedCols; // SArray char* ast; int64_t streamUid; int64_t reqTs; int64_t rspTs; - int64_t delayDuration; // ms + int64_t delayDuration; // ms bool fillHistoryFinished; } STableTSMAInfo; @@ -4351,10 +4371,10 @@ void tFreeTableTSMAInfo(void* p); void tFreeAndClearTableTSMAInfo(void* p); void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp* pRsp); -#define STSMAHbRsp STableTSMAInfoRsp -#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp +#define STSMAHbRsp STableTSMAInfoRsp +#define tSerializeTSMAHbRsp tSerializeTableTSMAInfoRsp #define tDeserializeTSMAHbRsp tDeserializeTableTSMAInfoRsp -#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp +#define tFreeTSMAHbRsp tFreeTableTSMAInfoRsp typedef struct SStreamProgressReq { int64_t streamId; @@ -4380,7 +4400,7 @@ int32_t tDeserializeSStreamProgressRsp(void* buf, int32_t bufLen, SStreamProgres typedef struct SDropCtbWithTsmaSingleVgReq { SVgroupInfo vgInfo; - SArray* pTbs; // SVDropTbReq + SArray* pTbs; // SVDropTbReq } SMDropTbReqsOnSingleVg; int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder* pEncoder, const SMDropTbReqsOnSingleVg* pReq); @@ -4388,7 +4408,7 @@ int32_t tDecodeSMDropTbReqOnSingleVg(SDecoder* pDecoder, SMDropTbReqsOnSingleVg* void tFreeSMDropTbReqOnSingleVg(void* p); typedef struct SDropTbsReq { - SArray* pVgReqs; // SMDropTbReqsOnSingleVg + SArray* pVgReqs; // SMDropTbReqsOnSingleVg } SMDropTbsReq; int32_t tSerializeSMDropTbsReq(void* buf, int32_t bufLen, const SMDropTbsReq* pReq); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index fe20639c77..9b557500f0 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -201,7 +201,7 @@ void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded); void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset); -SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); +SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo); diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 31091928c9..d0bf2e2dd4 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -104,6 +104,8 @@ typedef struct SNodeAllocator SNodeAllocator; int32_t nodesInitAllocatorSet(); void nodesDestroyAllocatorSet(); int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId); +int32_t nodesSimAcquireAllocator(int64_t allocatorId); +int32_t nodesSimReleaseAllocator(int64_t allocatorId); int32_t nodesAcquireAllocator(int64_t allocatorId); int32_t nodesReleaseAllocator(int64_t allocatorId); int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId); diff --git a/include/os/osAtomic.h b/include/os/osAtomic.h index 48b7b8c56f..97bb6f53ba 100644 --- a/include/os/osAtomic.h +++ b/include/os/osAtomic.h @@ -114,6 +114,12 @@ int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val); int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val); void *atomic_fetch_xor_ptr(void *ptr, void *val); +#ifdef _MSC_VER +#define tmemory_barrier(order) MemoryBarrier() +#else +#define tmemory_barrier(order) __sync_synchronize() +#endif + #ifdef __cplusplus } #endif diff --git a/include/util/tbuffer.inc b/include/util/tbuffer.inc index f0137ee978..2c1405d6c5 100644 --- a/include/util/tbuffer.inc +++ b/include/util/tbuffer.inc @@ -177,7 +177,7 @@ static int32_t tBufferReaderInit(SBufferReader *reader, uint32_t offset, SBuffer } static FORCE_INLINE int32_t tBufferGet(SBufferReader *reader, uint32_t size, void *data) { - if (reader->offset < 0 || reader->offset + size > reader->buffer->size) { + if (reader->offset + size > reader->buffer->size) { return TSDB_CODE_OUT_OF_RANGE; } if (data) { diff --git a/include/util/tencode.h b/include/util/tencode.h index 596fa2b4d3..b8da040689 100644 --- a/include/util/tencode.h +++ b/include/util/tencode.h @@ -77,6 +77,7 @@ typedef struct { #define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) #define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) #define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE)) +#define TD_CODER_REMAIN_CAPACITY(CODER) ((CODER)->size - (CODER)->pos) #define tEncodeSize(E, S, SIZE, RET) \ do { \ diff --git a/include/util/tutil.h b/include/util/tutil.h index 54ce6fc849..c049949590 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -119,7 +119,7 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen, #define TSDB_CHECK_CODE(CODE, LINO, LABEL) \ do { \ - if ((CODE)) { \ + if (TSDB_CODE_SUCCESS != (CODE)) { \ LINO = __LINE__; \ goto LABEL; \ } \ diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 9507472df0..577b7d7ac4 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -44,6 +44,7 @@ enum { RES_TYPE__TMQ, RES_TYPE__TMQ_META, RES_TYPE__TMQ_METADATA, + RES_TYPE__TMQ_BATCH_META, }; #define SHOW_VARIABLES_RESULT_COLS 3 @@ -51,10 +52,11 @@ enum { #define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE) -#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) -#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) -#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) -#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) +#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY) +#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ) +#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META) +#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA) +#define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)res == RES_TYPE__TMQ_BATCH_META) typedef struct SAppInstInfo SAppInstInfo; @@ -241,6 +243,11 @@ typedef struct { STaosxRsp rsp; } SMqTaosxRspObj; +typedef struct { + SMqRspObjCommon common; + SMqBatchMetaRsp rsp; +} SMqBatchMetaRspObj; + typedef struct SReqRelInfo { uint64_t userRefId; uint64_t prevRefId; diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index ce3af827e1..9e5bd21b0a 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -89,24 +89,28 @@ static void deregisterRequest(SRequestObj *pRequest) { "current:%d, app current:%d", pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst); - if (pRequest->pQuery && pRequest->pQuery->pRoot) { - if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && - (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) { - tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); - atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); - reqType = SLOW_LOG_TYPE_INSERT; - } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { - tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 - "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", - duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, - pRequest->metric.planCostUs, pRequest->metric.execCostUs); + if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) { + if (pRequest->pQuery && pRequest->pQuery->pRoot) { + if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->pQuery->pRoot->type && + (0 == ((SVnodeModifyOpStmt *)pRequest->pQuery->pRoot)->sqlNodeType)) { + tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 + "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, + pRequest->metric.planCostUs, pRequest->metric.execCostUs); + atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration); + reqType = SLOW_LOG_TYPE_INSERT; + } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { + tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64 + "us, planCost:%" PRId64 "us, exec:%" PRId64 "us", + duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs, + pRequest->metric.planCostUs, pRequest->metric.execCostUs); - atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); - reqType = SLOW_LOG_TYPE_QUERY; - } + atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration); + reqType = SLOW_LOG_TYPE_QUERY; + } + } + + nodesSimReleaseAllocator(pRequest->allocatorRefId); } if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType || QUERY_NODE_INSERT_STMT == pRequest->stmtType) { @@ -492,7 +496,10 @@ void doDestroyRequest(void *p) { } taosMemoryFree(pRequest->body.interParam); - qDestroyQuery(pRequest->pQuery); + if (TSDB_CODE_SUCCESS == nodesSimAcquireAllocator(pRequest->allocatorRefId)) { + qDestroyQuery(pRequest->pQuery); + nodesSimReleaseAllocator(pRequest->allocatorRefId); + } nodesDestroyAllocator(pRequest->allocatorRefId); taosMemoryFreeClear(pRequest->effectiveUser); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index ba7f65c52b..da5da044a7 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -301,7 +301,7 @@ void taos_close(TAOS *taos) { } int taos_errno(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return terrno; } @@ -313,7 +313,7 @@ int taos_errno(TAOS_RES *res) { } const char *taos_errstr(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return (const char *)tstrerror(terrno); } @@ -354,6 +354,10 @@ void taos_free_result(TAOS_RES *res) { SMqMetaRspObj *pRspObj = (SMqMetaRspObj *)res; tDeleteMqMetaRsp(&pRspObj->metaRsp); taosMemoryFree(pRspObj); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj *pBtRspObj = (SMqBatchMetaRspObj *)res; + tDeleteMqBatchMetaRsp(&pBtRspObj->rsp); + taosMemoryFree(pBtRspObj); } } @@ -371,7 +375,7 @@ void taos_kill_query(TAOS *taos) { } int taos_field_count(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -382,7 +386,7 @@ int taos_field_count(TAOS_RES *res) { int taos_num_fields(TAOS_RES *res) { return taos_field_count(res); } TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { - if (taos_num_fields(res) == 0 || TD_RES_TMQ_META(res)) { + if (taos_num_fields(res) == 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } @@ -437,7 +441,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { pResultInfo->current += 1; return pResultInfo->row; } - } else if (TD_RES_TMQ_META(res)) { + } else if (TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } else { // assert to avoid un-initialization error @@ -548,7 +552,7 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) } int *taos_fetch_lengths(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return NULL; } @@ -557,7 +561,7 @@ int *taos_fetch_lengths(TAOS_RES *res) { } TAOS_ROW *taos_result_block(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -625,7 +629,7 @@ const char *taos_get_client_info() { return version; } // return int32_t int taos_affected_rows(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -636,7 +640,7 @@ int taos_affected_rows(TAOS_RES *res) { // return int64_t int64_t taos_affected_rows64(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -646,7 +650,7 @@ int64_t taos_affected_rows64(TAOS_RES *res) { } int taos_result_precision(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return TSDB_TIME_PRECISION_MILLI; } @@ -686,7 +690,7 @@ int taos_select_db(TAOS *taos, const char *db) { } void taos_stop_query(TAOS_RES *res) { - if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res)) { + if (res == NULL || TD_RES_TMQ(res) || TD_RES_TMQ_META(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return; } @@ -694,7 +698,7 @@ void taos_stop_query(TAOS_RES *res) { } bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return true; } SReqResultInfo *pResultInfo = tscGetCurResInfo(res); @@ -719,7 +723,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { } int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -761,7 +765,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { *numOfRows = 0; *pData = NULL; - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } @@ -797,7 +801,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { } int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) { - if (res == NULL || TD_RES_TMQ_META(res)) { + if (res == NULL || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return 0; } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index c5069d46aa..ce404092b0 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -26,9 +26,13 @@ #define LOG_ID_TAG "connId:0x%" PRIx64 ",reqId:0x%" PRIx64 #define LOG_ID_VALUE *(int64_t*)taos, pRequest->requestId +#define TMQ_META_VERSION "1.0" + +static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); + static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); } -static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, +static cJSON* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t, SColCmprWrapper* pColCmprRow) { int8_t buildDefaultCompress = 0; if (pColCmprRow->nCols <= 0) { @@ -122,9 +126,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch } cJSON_AddItemToObject(json, "tags", tags); - string = cJSON_PrintUnformatted(json); - cJSON_Delete(json); - return string; + return json; } static int32_t setCompressOption(cJSON* json, uint32_t para) { @@ -151,7 +153,7 @@ static int32_t setCompressOption(cJSON* json, uint32_t para) { } return 0; } -static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { +static cJSON* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { SMAlterStbReq req = {0}; cJSON* json = NULL; char* string = NULL; @@ -199,6 +201,26 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { } break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + SFieldWithOptions* field = taosArrayGet(req.pFields, 0); + cJSON* colName = cJSON_CreateString(field->name); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(field->type); + cJSON_AddItemToObject(json, "colType", colType); + + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || + field->type == TSDB_DATA_TYPE_GEOMETRY) { + int32_t length = field->bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } else if (field->type == TSDB_DATA_TYPE_NCHAR) { + int32_t length = (field->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + setCompressOption(json, field->compress); + break; + } case TSDB_ALTER_TABLE_DROP_TAG: case TSDB_ALTER_TABLE_DROP_COLUMN: { TAOS_FIELD* field = taosArrayGet(req.pFields, 0); @@ -245,18 +267,16 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { default: break; } - string = cJSON_PrintUnformatted(json); end: - cJSON_Delete(json); tFreeSMAltertbReq(&req); - return string; + return json; } -static char* processCreateStb(SMqMetaRsp* metaRsp) { +static cJSON* processCreateStb(SMqMetaRsp* metaRsp) { SVCreateStbReq req = {0}; SDecoder coder; - char* string = NULL; + cJSON* pJson = NULL; uDebug("create stable data:%p", metaRsp); // decode and process req @@ -267,17 +287,17 @@ static char* processCreateStb(SMqMetaRsp* metaRsp) { if (tDecodeSVCreateStbReq(&coder, &req) < 0) { goto _err; } - string = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr); + pJson = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr); _err: - uDebug("create stable return, sql json:%s", string); + uDebug("create stable return, sql json:%s", cJSON_PrintUnformatted(pJson)); tDecoderClear(&coder); - return string; + return pJson; } -static char* processAlterStb(SMqMetaRsp* metaRsp) { +static cJSON* processAlterStb(SMqMetaRsp* metaRsp) { SVCreateStbReq req = {0}; SDecoder coder; - char* string = NULL; + cJSON* pJson = NULL; uDebug("alter stable data:%p", metaRsp); // decode and process req @@ -288,11 +308,11 @@ static char* processAlterStb(SMqMetaRsp* metaRsp) { if (tDecodeSVCreateStbReq(&coder, &req) < 0) { goto _err; } - string = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); + pJson = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); _err: - uDebug("alter stable return, sql json:%s", string); + uDebug("alter stable return, sql json:%s", cJSON_PrintUnformatted(pJson)); tDecoderClear(&coder); - return string; + return pJson; } static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { @@ -385,7 +405,7 @@ end: taosArrayDestroy(pTagVals); } -static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { +static cJSON* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { char* string = NULL; cJSON* json = cJSON_CreateObject(); if (json == NULL) { @@ -410,16 +430,14 @@ static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) { cJSON_AddItemToArray(createList, create); } cJSON_AddItemToObject(json, "createList", createList); - string = cJSON_PrintUnformatted(json); - cJSON_Delete(json); - return string; + return json; } -static char* processCreateTable(SMqMetaRsp* metaRsp) { +static cJSON* processCreateTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVCreateTbBatchReq req = {0}; SVCreateTbReq* pCreateReq; - char* string = NULL; + cJSON* pJson = NULL; // decode uDebug("create table data:%p", metaRsp); void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead)); @@ -433,25 +451,18 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) { if (req.nReqs > 0) { pCreateReq = req.pReqs; if (pCreateReq->type == TSDB_CHILD_TABLE) { - string = buildCreateCTableJson(req.pReqs, req.nReqs); + pJson = buildCreateCTableJson(req.pReqs, req.nReqs); } else if (pCreateReq->type == TSDB_NORMAL_TABLE) { - string = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, + pJson = buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE, &pCreateReq->colCmpr); } } _exit: - uDebug("create table return, sql json:%s", string); - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - taosMemoryFreeClear(pCreateReq->sql); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + uDebug("create table return, sql json:%s", cJSON_PrintUnformatted(pJson)); + tDeleteSVCreateTbBatchReq(&req); tDecoderClear(&decoder); - return string; + return pJson; } static char* processAutoCreateTable(STaosxRsp* rsp) { @@ -480,7 +491,9 @@ static char* processAutoCreateTable(STaosxRsp* rsp) { goto _exit; } } - string = buildCreateCTableJson(pCreateReq, rsp->createTableNum); + cJSON* pJson = buildCreateCTableJson(pCreateReq, rsp->createTableNum); + string = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); _exit: uDebug("auto created table return, sql json:%s", string); for (int i = 0; i < rsp->createTableNum; i++) { @@ -495,7 +508,7 @@ _exit: return string; } -static char* processAlterTable(SMqMetaRsp* metaRsp) { +static cJSON* processAlterTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVAlterTbReq vAlterTbReq = {0}; char* string = NULL; @@ -546,6 +559,25 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { } break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); + cJSON_AddItemToObject(json, "colName", colName); + cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); + cJSON_AddItemToObject(json, "colType", colType); + + if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY || + vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { + int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } else if (vAlterTbReq.type == TSDB_DATA_TYPE_NCHAR) { + int32_t length = (vAlterTbReq.bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(json, "colLength", cbytes); + } + setCompressOption(json, vAlterTbReq.compress); + break; + } case TSDB_ALTER_TABLE_DROP_COLUMN: { cJSON* colName = cJSON_CreateString(vAlterTbReq.colName); cJSON_AddItemToObject(json, "colName", colName); @@ -620,19 +652,16 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { default: break; } - string = cJSON_PrintUnformatted(json); _exit: - uDebug("alter table return, sql json:%s", string); - cJSON_Delete(json); + uDebug("alter table return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } -static char* processDropSTable(SMqMetaRsp* metaRsp) { +static cJSON* processDropSTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVDropStbReq req = {0}; - char* string = NULL; cJSON* json = NULL; uDebug("processDropSTable data:%p", metaRsp); @@ -657,18 +686,15 @@ static char* processDropSTable(SMqMetaRsp* metaRsp) { cJSON* tableName = cJSON_CreateString(req.name); cJSON_AddItemToObject(json, "tableName", tableName); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDropSTable return, sql json:%s", string); - cJSON_Delete(json); + uDebug("processDropSTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } -static char* processDeleteTable(SMqMetaRsp* metaRsp) { +static cJSON* processDeleteTable(SMqMetaRsp* metaRsp) { SDeleteRes req = {0}; SDecoder coder = {0}; cJSON* json = NULL; - char* string = NULL; uDebug("processDeleteTable data:%p", metaRsp); // decode and process req @@ -696,18 +722,15 @@ static char* processDeleteTable(SMqMetaRsp* metaRsp) { cJSON* sqlJson = cJSON_CreateString(sql); cJSON_AddItemToObject(json, "sql", sqlJson); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDeleteTable return, sql json:%s", string); - cJSON_Delete(json); + uDebug("processDeleteTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&coder); - return string; + return json; } -static char* processDropTable(SMqMetaRsp* metaRsp) { +static cJSON* processDropTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; SVDropTbBatchReq req = {0}; - char* string = NULL; cJSON* json = NULL; uDebug("processDropTable data:%p", metaRsp); @@ -741,12 +764,10 @@ static char* processDropTable(SMqMetaRsp* metaRsp) { } cJSON_AddItemToObject(json, "tableNameList", tableNameList); - string = cJSON_PrintUnformatted(json); _exit: - uDebug("processDropTable return, json sql:%s", string); - cJSON_Delete(json); + uDebug("processDropTable return, json sql:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); - return string; + return json; } static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { @@ -1121,13 +1142,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { end: uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + tDeleteSVCreateTbBatchReq(&req); taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); @@ -1803,6 +1818,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, fields, pSW->nCols, true, err, ERR_MSG_LEN); taosMemoryFree(fields); + taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; @@ -1995,6 +2011,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqDst, fields, pSW->nCols, true, err, ERR_MSG_LEN); taosMemoryFree(fields); + taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; @@ -2025,38 +2042,85 @@ end: return code; } +static cJSON* processSimpleMeta(SMqMetaRsp* pMetaRsp) { + if (pMetaRsp->resMsgType == TDMT_VND_CREATE_STB) { + return processCreateStb(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_STB) { + return processAlterStb(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_STB) { + return processDropSTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_CREATE_TABLE) { + return processCreateTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_TABLE) { + return processAlterTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(pMetaRsp); + } else if (pMetaRsp->resMsgType == TDMT_VND_DELETE) { + return processDeleteTable(pMetaRsp); + } + + return NULL; +} +static char* processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp) { + SDecoder coder; + SMqBatchMetaRsp rsp = {0}; + tDecoderInit(&coder, pMsgRsp->pMetaBuff, pMsgRsp->metaBuffLen); + if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { + goto _end; + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddStringToObject(pJson, "tmq_meta_version", TMQ_META_VERSION); + cJSON* pMetaArr = cJSON_CreateArray(); + int32_t num = taosArrayGetSize(rsp.batchMetaReq); + for (int32_t i = 0; i < num; i++) { + int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); + void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); + SDecoder metaCoder = {0}; + SMqMetaRsp metaRsp = {0}; + tDecoderInit(&metaCoder, POINTER_SHIFT(tmpBuf, sizeof(SMqRspHead)), len - sizeof(SMqRspHead)); + if(tDecodeMqMetaRsp(&metaCoder, &metaRsp) < 0 ) { + goto _end; + } + cJSON* pItem = processSimpleMeta(&metaRsp); + tDeleteMqMetaRsp(&metaRsp); + cJSON_AddItemToArray(pMetaArr, pItem); + } + + cJSON_AddItemToObject(pJson, "metas", pMetaArr); + tDeleteMqBatchMetaRsp(&rsp); + char* fullStr = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); + return fullStr; + +_end: + cJSON_Delete(pJson); + tDeleteMqBatchMetaRsp(&rsp); + return NULL; +} + char* tmq_get_json_meta(TAOS_RES* res) { if (res == NULL) return NULL; uDebug("tmq_get_json_meta res:%p", res); - if (!TD_RES_TMQ_META(res) && !TD_RES_TMQ_METADATA(res)) { + if (!TD_RES_TMQ_META(res) && !TD_RES_TMQ_METADATA(res) && !TD_RES_TMQ_BATCH_META(res)) { return NULL; } if (TD_RES_TMQ_METADATA(res)) { SMqTaosxRspObj* pMetaDataRspObj = (SMqTaosxRspObj*)res; return processAutoCreateTable(&pMetaDataRspObj->rsp); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBatchMetaRspObj = (SMqBatchMetaRspObj*)res; + return processBatchMetaToJson(&pBatchMetaRspObj->rsp); } SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_STB) { - return processCreateStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_STB) { - return processAlterStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_STB) { - return processDropSTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_TABLE) { - return processCreateTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_TABLE) { - return processAlterTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { - return processDropTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { - return processDropTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DELETE) { - return processDeleteTable(&pMetaRspObj->metaRsp); - } - - return NULL; + cJSON* pJson = processSimpleMeta(&pMetaRspObj->metaRsp); + char* string = cJSON_PrintUnformatted(pJson); + cJSON_Delete(pJson); + return string; } void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } @@ -2147,6 +2211,12 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data* raw) { } raw->raw_type = RES_TYPE__TMQ_METADATA; uDebug("tmq get raw type metadata:%p", raw); + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBtMetaRspObj = (SMqBatchMetaRspObj*)res; + raw->raw = pBtMetaRspObj->rsp.pMetaBuff; + raw->raw_len = pBtMetaRspObj->rsp.metaBuffLen; + raw->raw_type = RES_TYPE__TMQ_BATCH_META; + uDebug("tmq get raw batch meta:%p", raw); } else { uError("tmq get raw error type:%d", *(int8_t*)res); terrno = TSDB_CODE_TMQ_INVALID_MSG; @@ -2163,32 +2233,74 @@ void tmq_free_raw(tmq_raw_data raw) { memset(terrMsg, 0, ERR_MSG_LEN); } +static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { + if (type == TDMT_VND_CREATE_STB) { + return taosCreateStb(taos, buf, len); + } else if (type == TDMT_VND_ALTER_STB) { + return taosCreateStb(taos, buf, len); + } else if (type == TDMT_VND_DROP_STB) { + return taosDropStb(taos, buf, len); + } else if (type == TDMT_VND_CREATE_TABLE) { + return taosCreateTable(taos, buf, len); + } else if (type == TDMT_VND_ALTER_TABLE) { + return taosAlterTable(taos, buf, len); + } else if (type == TDMT_VND_DROP_TABLE) { + return taosDropTable(taos, buf, len); + } else if (type == TDMT_VND_DELETE) { + return taosDeleteData(taos, buf, len); + } else if (type == RES_TYPE__TMQ) { + return tmqWriteRawDataImpl(taos, buf, len); + } else if (type == RES_TYPE__TMQ_METADATA) { + return tmqWriteRawMetaDataImpl(taos, buf, len); + } else if (type == RES_TYPE__TMQ_BATCH_META) { + return tmqWriteBatchMetaDataImpl(taos, buf, len); + } + return TSDB_CODE_INVALID_PARA; +} + int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) { if (!taos) { - goto end; + return TSDB_CODE_INVALID_PARA; } - if (raw.raw_type == TDMT_VND_CREATE_STB) { - return taosCreateStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_ALTER_STB) { - return taosCreateStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DROP_STB) { - return taosDropStb(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_CREATE_TABLE) { - return taosCreateTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_ALTER_TABLE) { - return taosAlterTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DROP_TABLE) { - return taosDropTable(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == TDMT_VND_DELETE) { - return taosDeleteData(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == RES_TYPE__TMQ) { - return tmqWriteRawDataImpl(taos, raw.raw, raw.raw_len); - } else if (raw.raw_type == RES_TYPE__TMQ_METADATA) { - return tmqWriteRawMetaDataImpl(taos, raw.raw, raw.raw_len); - } - -end: - terrno = TSDB_CODE_INVALID_PARA; - return terrno; + return writeRawImpl(taos, raw.raw, raw.raw_len, raw.raw_type); +} + +static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen) { + if (taos == NULL || meta == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + SMqBatchMetaRsp rsp = {0}; + SDecoder coder; + int32_t code = TSDB_CODE_SUCCESS; + + // decode and process req + tDecoderInit(&coder, meta, metaLen); + if (tDecodeMqBatchMetaRsp(&coder, &rsp) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + int32_t num = taosArrayGetSize(rsp.batchMetaReq); + for (int32_t i = 0; i < num; i++) { + int32_t len = *(int32_t*)taosArrayGet(rsp.batchMetaLen, i); + void* tmpBuf = taosArrayGetP(rsp.batchMetaReq, i); + SDecoder metaCoder = {0}; + SMqMetaRsp metaRsp = {0}; + tDecoderInit(&metaCoder, POINTER_SHIFT(tmpBuf, sizeof(SMqRspHead)), len - sizeof(SMqRspHead)); + if (tDecodeMqMetaRsp(&metaCoder, &metaRsp) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + code = writeRawImpl(taos, metaRsp.metaRsp, metaRsp.metaRspLen, metaRsp.resMsgType); + tDeleteMqMetaRsp(&metaRsp); + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } + } + +_end: + tDeleteMqBatchMetaRsp(&rsp); + errno = code; + return code; } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6225cf703c..6eb7abe0eb 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -939,7 +939,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions)); for (int32_t i = 0; i < pReq.numOfColumns; ++i) { SField *pField = taosArrayGet(pColumns, i); - SFieldWithOptions fieldWithOption; + SFieldWithOptions fieldWithOption = {0}; setFieldWithOptions(&fieldWithOption, pField); setDefaultOptionsForField(&fieldWithOption); taosArrayPush(pReq.pColumns, &fieldWithOption); diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index f715f32556..bc0e560178 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -233,7 +233,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); - if (needConverTime) { + if (needConverTime && info->currSTableMeta != NULL) { kvTs.i = convertTimePrecision(kvTs.i, TSDB_TIME_PRECISION_NANO, info->currSTableMeta->tableInfo.precision); } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 3141e21f26..8a44227852 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -71,6 +71,7 @@ struct tmq_conf_t { char* pass; tmq_commit_cb* commitCb; void* commitCbUserParam; + int8_t enableBatchMeta; }; struct tmq_t { @@ -87,6 +88,7 @@ struct tmq_t { uint64_t consumerId; tmq_commit_cb* commitCb; void* commitCbUserParam; + int8_t enableBatchMeta; // status SRWLatch lock; @@ -171,9 +173,10 @@ typedef struct { uint64_t reqId; SEpSet* pEpset; union { - SMqDataRsp dataRsp; - SMqMetaRsp metaRsp; - STaosxRsp taosxRsp; + SMqDataRsp dataRsp; + SMqMetaRsp metaRsp; + STaosxRsp taosxRsp; + SMqBatchMetaRsp batchMetaRsp; }; } SMqPollRspWrapper; @@ -268,6 +271,7 @@ tmq_conf_t* tmq_conf_new() { conf->autoCommit = true; conf->autoCommitInterval = DEFAULT_AUTO_COMMIT_INTERVAL; conf->resetOffset = TMQ_OFFSET__RESET_LATEST; + conf->enableBatchMeta = false; return conf; } @@ -397,6 +401,11 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value return TMQ_CONF_OK; } + if (strcasecmp(key, "msg.enable.batchmeta") == 0) { + conf->enableBatchMeta = (taosStr2int64(value) != 0) ? true : false; + return TMQ_CONF_OK; + } + return TMQ_CONF_UNKNOWN; } @@ -635,6 +644,11 @@ static void asyncCommitFromResult(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_c pTopicName = pRspObj->common.topic; vgId = pRspObj->common.vgId; offsetVal = pRspObj->rsp.common.rspOffset; + } else if (TD_RES_TMQ_BATCH_META(pRes)) { + SMqBatchMetaRspObj* pBtRspObj = (SMqBatchMetaRspObj*)pRes; + pTopicName = pBtRspObj->common.topic; + vgId = pBtRspObj->common.vgId; + offsetVal = pBtRspObj->rsp.rspOffset; } else { code = TSDB_CODE_TMQ_INVALID_MSG; goto end; @@ -858,7 +872,10 @@ void tmqSendHbReq(void* param, void* tmrId) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); int64_t transporterId = 0; - asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + int32_t code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); + if (code != 0) { + tscError("tmqSendHbReq asyncSendMsgToServer failed"); + } OVER: tDestroySMqHbReq(&req); @@ -934,7 +951,11 @@ static void tmqFreeRspWrapper(SMqRspWrapper* rspWrapper) { SMqPollRspWrapper* pRsp = (SMqPollRspWrapper*)rspWrapper; taosMemoryFreeClear(pRsp->pEpset); tDeleteSTaosxRsp(&pRsp->taosxRsp); - } + } else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SMqPollRspWrapper* pRsp = (SMqPollRspWrapper*)rspWrapper; + taosMemoryFreeClear(pRsp->pEpset); + tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); + } } void tmqClearUnhandleMsg(tmq_t* tmq) { @@ -1112,6 +1133,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->resetOffsetCfg = conf->resetOffset; pTmq->replayEnable = conf->replayEnable; pTmq->sourceExcluded = conf->sourceExcluded; + pTmq->enableBatchMeta = conf->enableBatchMeta; if (conf->replayEnable) { pTmq->autoCommit = false; } @@ -1189,6 +1211,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { req.autoCommitInterval = tmq->autoCommitInterval; req.resetOffsetCfg = tmq->resetOffsetCfg; req.enableReplay = tmq->replayEnable; + req.enableBatchMeta = tmq->enableBatchMeta; for (int32_t i = 0; i < sz; i++) { char* topic = taosArrayGetP(container, i); @@ -1220,12 +1243,15 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(buf); goto FAIL; } SMqSubscribeCbParam param = {.rspErr = 0}; if (tsem_init(¶m.rspSem, 0, 0) != 0) { code = TSDB_CODE_TSC_INTERNAL_ERROR; + taosMemoryFree(buf); + taosMemoryFree(sendInfo); goto FAIL; } @@ -1245,10 +1271,6 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { goto FAIL; } - // avoid double free if msg is sent - buf = NULL; - sendInfo = NULL; - tsem_wait(¶m.rspSem); tsem_destroy(¶m.rspSem); @@ -1260,7 +1282,10 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while ((code = syncAskEp(tmq)) != 0) { if (retryCnt++ > MAX_RETRY_COUNT || code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { - tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes", tmq->consumerId); + tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry more than 2 minutes, code:%s", tmq->consumerId, strerror(code)); + if(code == TSDB_CODE_MND_CONSUMER_NOT_EXIST) { + code = 0; + } goto FAIL; } @@ -1284,8 +1309,6 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { FAIL: taosArrayDestroyP(req.topicNames, taosMemoryFree); - taosMemoryFree(buf); - taosMemoryFree(sendInfo); return code; } @@ -1358,7 +1381,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if(pMsg->pData == NULL){ tscError("consumer:0x%" PRIx64 " msg discard from vgId:%d, since msg is NULL", tmq->consumerId, vgId); - goto FAIL; + code = TSDB_CODE_TSC_INTERNAL_ERROR; + goto END; } int32_t msgEpoch = ((SMqRspHead*)pMsg->pData)->epoch; @@ -1387,7 +1411,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); @@ -1403,7 +1427,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->metaRsp, pMsg->pData, sizeof(SMqRspHead)); @@ -1414,10 +1438,23 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); taosReleaseRef(tmqMgmt.rsetId, refId); code = TSDB_CODE_OUT_OF_MEMORY; - goto FAIL; + goto END; } tDecoderClear(&decoder); memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead)); + } else if (rspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SDecoder decoder; + tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); + if(tSemiDecodeMqBatchMetaRsp(&decoder, &pRspWrapper->batchMetaRsp) < 0){ + tDecoderClear(&decoder); + taosReleaseRef(tmqMgmt.rsetId, refId); + code = TSDB_CODE_OUT_OF_MEMORY; + goto FAIL; + } + tDecoderClear(&decoder); + memcpy(&pRspWrapper->batchMetaRsp, pMsg->pData, sizeof(SMqRspHead)); + tscDebug("consumer:0x%" PRIx64 " recv poll batchmeta rsp, vgId:%d, reqId:0x%" PRIx64, tmq->consumerId, vgId, + requestId); } else { // invalid rspType tscError("consumer:0x%" PRIx64 " invalid rsp msg received, type:%d ignored", tmq->consumerId, rspType); } @@ -1600,6 +1637,7 @@ void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqCl pReq->reqId = generateRequestId(); pReq->enableReplay = tmq->replayEnable; pReq->sourceExcluded = tmq->sourceExcluded; + pReq->enableBatchMeta = tmq->enableBatchMeta; } SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { @@ -1616,6 +1654,20 @@ SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { return pRspObj; } +SMqBatchMetaRspObj* tmqBuildBatchMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { + SMqBatchMetaRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqBatchMetaRspObj)); + if(pRspObj == NULL) { + return NULL; + } + pRspObj->common.resType = RES_TYPE__TMQ_BATCH_META; + tstrncpy(pRspObj->common.topic, pWrapper->topicHandle->topicName, TSDB_TOPIC_FNAME_LEN); + tstrncpy(pRspObj->common.db, pWrapper->topicHandle->db, TSDB_DB_FNAME_LEN); + pRspObj->common.vgId = pWrapper->vgHandle->vgId; + + memcpy(&pRspObj->rsp, &pWrapper->batchMetaRsp, sizeof(SMqBatchMetaRsp)); + tscDebug("build batchmeta Rsp from wrapper"); + return pRspObj; +} void changeByteEndian(char* pData){ char* p = pData; @@ -1744,6 +1796,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p pParam = taosMemoryMalloc(sizeof(SMqPollCbParam)); if (pParam == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFreeClear(msg); goto FAIL; } @@ -1755,6 +1808,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFreeClear(msg); goto FAIL; } @@ -1781,7 +1835,6 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p return 0; FAIL: - taosMemoryFreeClear(msg); return tmqPollCb(pParam, NULL, code); } @@ -1887,8 +1940,6 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { terrno = pRspWrapper->code; tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(pRspWrapper->code)); - taosFreeQitem(pRspWrapper); - return NULL; } else { if (pRspWrapper->code == TSDB_CODE_VND_INVALID_VGROUP_ID) { // for vnode transform askEp(tmq, NULL, false, true); @@ -2006,6 +2057,42 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tmqFreeRspWrapper(pRspWrapper); taosFreeQitem(pRspWrapper); } + } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_BATCH_META_RSP) { + SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; + int32_t consumerEpoch = atomic_load_32(&tmq->epoch); + + tscDebug("consumer:0x%" PRIx64 " process meta rsp", tmq->consumerId); + + if (pollRspWrapper->batchMetaRsp.head.epoch == consumerEpoch) { + taosWLockLatch(&tmq->lock); + SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); + pollRspWrapper->vgHandle = pVg; + pollRspWrapper->topicHandle = getTopicInfo(tmq, pollRspWrapper->topicName); + if (pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL) { + tscError("consumer:0x%" PRIx64 " get vg or topic error, topic:%s vgId:%d", tmq->consumerId, + pollRspWrapper->topicName, pollRspWrapper->vgId); + tmqFreeRspWrapper(pRspWrapper); + taosFreeQitem(pRspWrapper); + taosWUnLockLatch(&tmq->lock); + return NULL; + } + + // build rsp + void* pRsp = NULL; + updateVgInfo(pVg, &pollRspWrapper->batchMetaRsp.rspOffset, &pollRspWrapper->batchMetaRsp.rspOffset, + pollRspWrapper->batchMetaRsp.head.walsver, pollRspWrapper->batchMetaRsp.head.walever, + tmq->consumerId, true); + pRsp = tmqBuildBatchMetaRspFromWrapper(pollRspWrapper); + taosFreeQitem(pRspWrapper); + taosWUnLockLatch(&tmq->lock); + return pRsp; + } else { + tscInfo("consumer:0x%" PRIx64 " vgId:%d msg discard since epoch mismatch: msg epoch %d, consumer epoch %d", + tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->batchMetaRsp.head.epoch, consumerEpoch); + setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); + tmqFreeRspWrapper(pRspWrapper); + taosFreeQitem(pRspWrapper); + } } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_META_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)pRspWrapper; int32_t consumerEpoch = atomic_load_32(&tmq->epoch); @@ -2217,6 +2304,8 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) { return TMQ_RES_TABLE_META; } else if (TD_RES_TMQ_METADATA(res)) { return TMQ_RES_METADATA; + } else if (TD_RES_TMQ_BATCH_META(res)) { + return TMQ_RES_TABLE_META; } else { return TMQ_RES_INVALID; } @@ -2226,7 +2315,7 @@ const char* tmq_get_topic_name(TAOS_RES* res) { if (res == NULL) { return NULL; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return strchr(((SMqRspObjCommon*)res)->topic, '.') + 1; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2241,7 +2330,7 @@ const char* tmq_get_db_name(TAOS_RES* res) { return NULL; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return strchr(((SMqRspObjCommon*)res)->db, '.') + 1; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2255,7 +2344,7 @@ int32_t tmq_get_vgroup_id(TAOS_RES* res) { if (res == NULL) { return -1; } - if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { + if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res) || TD_RES_TMQ_BATCH_META(res)) { return ((SMqRspObjCommon*)res)->vgId; } else if (TD_RES_TMQ_META(res)) { SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; @@ -2282,6 +2371,11 @@ int64_t tmq_get_vgroup_offset(TAOS_RES* res) { if (pRspObj->metaRsp.rspOffset.type == TMQ_OFFSET__LOG) { return pRspObj->metaRsp.rspOffset.version; } + } else if (TD_RES_TMQ_BATCH_META(res)) { + SMqBatchMetaRspObj* pBtRspObj = (SMqBatchMetaRspObj*)res; + if (pBtRspObj->rsp.rspOffset.type == TMQ_OFFSET__LOG) { + return pBtRspObj->rsp.rspOffset.version; + } } else { tscError("invalid tmq type:%d", *(int8_t*)res); } @@ -2559,6 +2653,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { if (tSerializeSMqAskEpReq(pReq, tlen, &req) < 0) { tscError("consumer:0x%" PRIx64 ", tSerializeSMqAskEpReq %d failed", pTmq->consumerId, tlen); code = TSDB_CODE_INVALID_PARA; + taosMemoryFree(pReq); goto FAIL; } @@ -2566,6 +2661,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { if (pParam == NULL) { tscError("consumer:0x%" PRIx64 ", failed to malloc subscribe param", pTmq->consumerId); code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pReq); goto FAIL; } @@ -2576,6 +2672,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pReq); goto FAIL; } @@ -2597,8 +2694,6 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) { } FAIL: - taosMemoryFreeClear(pParam); - taosMemoryFreeClear(pReq); askEpCb(pParam, NULL, code); } @@ -2705,7 +2800,6 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - taosMemoryFree(pParam); return 0; } @@ -2809,8 +2903,6 @@ int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* ep int64_t transporterId = 0; code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(buf); - taosMemoryFree(sendInfo); tsem_destroy(&pParam->sem); taosMemoryFree(pParam); return code; @@ -3067,6 +3159,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a sendInfo->requestId = req.reqId; sendInfo->requestObjRefId = 0; sendInfo->param = pParam; + sendInfo->paramFreeFp = taosMemoryFree; sendInfo->fp = tmqGetWalInfoCb; sendInfo->msgType = TDMT_VND_TMQ_VG_WALINFO; @@ -3078,8 +3171,6 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId); code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(pParam); - taosMemoryFree(msg); goto end; } } @@ -3235,8 +3326,6 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_ int64_t transporterId = 0; code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); if (code != 0) { - taosMemoryFree(msg); - taosMemoryFree(sendInfo); tsem_destroy(&pParam->sem); taosMemoryFree(pParam); return code; diff --git a/source/common/src/tcol.c b/source/common/src/tcol.c index fc9dd1fb4c..ba36558587 100644 --- a/source/common/src/tcol.c +++ b/source/common/src/tcol.c @@ -131,6 +131,7 @@ const char* columnEncodeStr(uint8_t type) { encode = TSDB_COLUMN_ENCODE_DISABLED; break; default: + encode = TSDB_COLUMN_ENCODE_UNKNOWN; break; } return encode; @@ -157,8 +158,8 @@ const char* columnCompressStr(uint16_t type) { case TSDB_COLVAL_COMPRESS_DISABLED: compress = TSDB_COLUMN_COMPRESS_DISABLED; break; - default: + compress = TSDB_COLUMN_COMPRESS_UNKNOWN; break; } return compress; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 8d3db72fb5..fb97c011fa 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -383,7 +383,9 @@ static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, c if (IS_VAR_DATA_TYPE(schema->columns[i].type)) { payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); payloadSize += tPutU32v(payload + payloadSize, colValArray[colValIndex].value.nData); - memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + if (colValArray[colValIndex].value.nData > 0) { + memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + } payloadSize += colValArray[colValIndex].value.nData; } else { payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 84b89883c6..2594d7c424 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -768,11 +768,22 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) if (tEncodeCStr(&encoder, pReq->name) < 0) return -1; if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1; + + // if (pReq->alterType == ) for (int32_t i = 0; i < pReq->numOfFields; ++i) { - SField *pField = taosArrayGet(pReq->pFields, i); - if (tEncodeI8(&encoder, pField->type) < 0) return -1; - if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; - if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { + SFieldWithOptions *pField = taosArrayGet(pReq->pFields, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + if (tEncodeU32(&encoder, pField->compress) < 0) return -1; + + } else { + SField *pField = taosArrayGet(pReq->pFields, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + } } if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1; @@ -802,13 +813,28 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq } for (int32_t i = 0; i < pReq->numOfFields; ++i) { - SField field = {0}; - if (tDecodeI8(&decoder, &field.type) < 0) return -1; - if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (taosArrayPush(pReq->pFields, &field) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; + if (pReq->alterType == TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION) { + + taosArrayDestroy(pReq->pFields); + pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SFieldWithOptions)); + SFieldWithOptions field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (tDecodeU32(&decoder, &field.compress) < 0) return -1; + if (taosArrayPush(pReq->pFields, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } else { + SField field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (taosArrayPush(pReq->pFields, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } } } @@ -5620,18 +5646,36 @@ int32_t tSerializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq * } int32_t tDeserializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *pReq) { + int32_t code = 0; SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; + if (tStartDecode(&decoder) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } - if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->compactId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } + + if (tDecodeI32(&decoder, &pReq->vgId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } + + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) { + code = TSDB_CODE_MSG_DECODE_ERROR; + goto _exit; + } tEndDecode(&decoder); + +_exit: tDecoderClear(&decoder); - return 0; + return code; } int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeConfigReq *pReq) { @@ -7242,6 +7286,7 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { pHead->vgId = htonl(pReq->head.vgId); pHead->contLen = htonl(tlen + headLen); } + if (tEncodeI8(&encoder, pReq->enableBatchMeta) < 0) return -1; return tlen + headLen; } @@ -7271,6 +7316,12 @@ int32_t tDeserializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { if (tDecodeI8(&decoder, &pReq->sourceExcluded) < 0) return -1; } + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->enableBatchMeta) < 0) return -1; + } else { + pReq->enableBatchMeta = false; + } + tEndDecode(&decoder); tDecoderClear(&decoder); @@ -8405,6 +8456,18 @@ int tDecodeSVCreateTbBatchReq(SDecoder *pCoder, SVCreateTbBatchReq *pReq) { return 0; } +void tDeleteSVCreateTbBatchReq(SVCreateTbBatchReq *pReq) { + for (int32_t iReq = 0; iReq < pReq->nReqs; iReq++) { + SVCreateTbReq *pCreateReq = pReq->pReqs + iReq; + taosMemoryFreeClear(pCreateReq->sql); + taosMemoryFreeClear(pCreateReq->comment); + if (pCreateReq->type == TSDB_CHILD_TABLE) { + taosArrayDestroy(pCreateReq->ctb.tagName); + pCreateReq->ctb.tagName = NULL; + } + } +} + int tEncodeSVCreateTbRsp(SEncoder *pCoder, const SVCreateTbRsp *pRsp) { if (tStartEncode(pCoder) < 0) return -1; @@ -8759,6 +8822,13 @@ int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) { if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1; if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1; break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->type) < 0) return -1; + if (tEncodeI8(pEncoder, pReq->flags) < 0) return -1; + if (tEncodeI32v(pEncoder, pReq->bytes) < 0) return -1; + if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1; + break; default: break; } @@ -8814,6 +8884,12 @@ static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq) if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1; if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1; break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->type) < 0) return -1; + if (tDecodeI8(pDecoder, &pReq->flags) < 0) return -1; + if (tDecodeI32v(pDecoder, &pReq->bytes) < 0) return -1; + if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1; default: break; } @@ -10600,3 +10676,55 @@ void tFreeFetchTtlExpiredTbsRsp(void *p) { SVFetchTtlExpiredTbsRsp *pRsp = p; taosArrayDestroy(pRsp->pExpiredTbs); } + +int32_t tEncodeMqBatchMetaRsp(SEncoder *pEncoder, const SMqBatchMetaRsp *pRsp) { + if (tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset) < 0) return -1; + + int32_t size = taosArrayGetSize(pRsp->batchMetaReq); + if (tEncodeI32(pEncoder, size) < 0) return -1; + if (size > 0) { + for (int32_t i = 0; i < size; i++) { + void *pMetaReq = taosArrayGetP(pRsp->batchMetaReq, i); + int32_t metaLen = *(int32_t *)taosArrayGet(pRsp->batchMetaLen, i); + if (tEncodeBinary(pEncoder, pMetaReq, metaLen) < 0) return -1; + } + } + return 0; +} + +int32_t tDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) { + int32_t size = 0; + if (tDecodeI32(pDecoder, &size) < 0) return -1; + if (size > 0) { + pRsp->batchMetaReq = taosArrayInit(size, POINTER_BYTES); + pRsp->batchMetaLen = taosArrayInit(size, sizeof(int32_t)); + for (int32_t i = 0; i < size; i++) { + void *pCreate = NULL; + uint64_t len = 0; + if (tDecodeBinaryAlloc(pDecoder, &pCreate, &len) < 0) return -1; + int32_t l = (int32_t)len; + taosArrayPush(pRsp->batchMetaReq, &pCreate); + taosArrayPush(pRsp->batchMetaLen, &l); + } + } + return 0; +} + +int32_t tSemiDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) { + if (tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset) < 0) return -1; + if (pDecoder->size < pDecoder->pos) { + return -1; + } + pRsp->metaBuffLen = TD_CODER_REMAIN_CAPACITY(pDecoder); + pRsp->pMetaBuff = taosMemoryCalloc(1, pRsp->metaBuffLen); + memcpy(pRsp->pMetaBuff, TD_CODER_CURRENT(pDecoder), pRsp->metaBuffLen); + return 0; +} + +void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp *pRsp) { + taosMemoryFreeClear(pRsp->pMetaBuff); + taosArrayDestroyP(pRsp->batchMetaReq, taosMemoryFree); + taosArrayDestroy(pRsp->batchMetaLen); + pRsp->batchMetaReq = NULL; + pRsp->batchMetaLen = NULL; +} diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index c7ae941389..3eef2afcc1 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -662,6 +662,14 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumerNew = NULL; STrans *pTrans = NULL; + if(taosArrayGetSize(subscribe.topicNames) == 0){ + SMqConsumerObj *pConsumerTmp = mndAcquireConsumer(pMnode, subscribe.consumerId); + if(pConsumerTmp == NULL){ + goto _over; + } + mndReleaseConsumer(pMnode, pConsumerTmp); + } + code = checkAndSortTopic(pMnode, subscribe.topicNames); if(code != TSDB_CODE_SUCCESS){ goto _over; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 61fc180dc6..0d3affe6e5 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1779,7 +1779,8 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj * return 0; } -static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols) { +static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray *pFields, int32_t ncols, + int8_t withCompress) { if (pOld->numOfColumns + ncols + pOld->numOfTags > TSDB_MAX_COLUMNS) { terrno = TSDB_CODE_MND_TOO_MANY_COLUMNS; return -1; @@ -1806,29 +1807,53 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray } for (int32_t i = 0; i < ncols; i++) { - SField *pField = taosArrayGet(pFields, i); - if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { - terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; - return -1; + if (withCompress) { + SFieldWithOptions *pField = taosArrayGet(pFields, i); + if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; + return -1; + } + + if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; + return -1; + } + + SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; + pSchema->bytes = pField->bytes; + pSchema->type = pField->type; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pNew->nextColId; + pNew->nextColId++; + + SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; + pCmpr->id = pSchema->colId; + pCmpr->alg = pField->compress; + mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); + } else { + SField *pField = taosArrayGet(pFields, i); + if (mndFindSuperTableColumnIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_COLUMN_ALREADY_EXIST; + return -1; + } + + if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { + terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; + return -1; + } + + SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; + pSchema->bytes = pField->bytes; + pSchema->type = pField->type; + memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); + pSchema->colId = pNew->nextColId; + pNew->nextColId++; + + SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; + pCmpr->id = pSchema->colId; + pCmpr->alg = createDefaultColCmprByType(pSchema->type); + mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); } - - if (mndFindSuperTableTagIndex(pOld, pField->name) >= 0) { - terrno = TSDB_CODE_MND_TAG_ALREADY_EXIST; - return -1; - } - - SSchema *pSchema = &pNew->pColumns[pOld->numOfColumns + i]; - pSchema->bytes = pField->bytes; - pSchema->type = pField->type; - memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - pSchema->colId = pNew->nextColId; - pNew->nextColId++; - - SColCmpr *pCmpr = &pNew->pCmpr[pOld->numOfColumns + i]; - pCmpr->id = pSchema->colId; - pCmpr->alg = createDefaultColCmprByType(pSchema->type); - - mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name); } pNew->colVer++; @@ -2461,7 +2486,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p code = mndAlterStbTagBytes(pMnode, pOld, &stbObj, pField0); break; case TSDB_ALTER_TABLE_ADD_COLUMN: - code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields); + code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 0); break; case TSDB_ALTER_TABLE_DROP_COLUMN: pField0 = taosArrayGet(pAlter->pFields, 0); @@ -2478,6 +2503,9 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS: code = mndUpdateSuperTableColumnCompress(pMnode, pOld, &stbObj, pAlter->pFields, pAlter->numOfFields); break; + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: + code = mndAddSuperTableColumn(pOld, &stbObj, pAlter->pFields, pAlter->numOfFields, 1); + break; default: needRsp = false; terrno = TSDB_CODE_OPS_NOT_SUPPORT; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 48549fce42..79a04a5348 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1130,6 +1130,15 @@ static int32_t mndCheckNodeStatus(SMnode *pMnode) { ready = false; break; } + + if (pEntry->hTaskId != 0) { + mDebug("s-task:0x%" PRIx64 "-0x%x (nodeId:%d) status:%s related fill-history task:0x%" PRIx64 + " exists, checkpoint not issued", + pEntry->id.streamId, (int32_t)pEntry->id.taskId, pEntry->nodeId, streamTaskGetStatusStr(pEntry->status), + pEntry->hTaskId); + ready = false; + break; + } } taosThreadMutexUnlock(&execInfo.lock); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index e2ecdca59f..08d32b2b81 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -113,7 +113,7 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle); void tqDestroyTqHandle(void* data); // tqRead -int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* offset); +int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatchMetaRsp* pBatchMetaRsp, STqOffsetVal* offset); int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pOffset, const SMqPollReq* pRequest); int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t reqId); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index df54591ae8..2a122081b8 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -36,7 +36,7 @@ static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME); -int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) { +int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add, uint32_t compress) { int32_t nCols = pWp->nCols; int32_t ver = pWp->version; if (add) { @@ -45,7 +45,7 @@ int8_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add) { SColCmpr *pCol = p + nCols; pCol->id = pSchema->colId; - pCol->alg = createDefaultColCmprByType(pSchema->type); + pCol->alg = compress; pWp->nCols = nCols + 1; pWp->version = ver; pWp->pColCmpr = p; @@ -1491,6 +1491,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl SSchema tScheam; switch (pAlterTbReq->action) { case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: if (pColumn) { terrno = TSDB_CODE_VND_COL_ALREADY_EXISTS; goto _err; @@ -1522,7 +1523,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl (void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type); } SSchema *pCol = &pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1]; - updataTableColCmpr(&entry.colCmpr, pCol, 1); + uint32_t compress = pAlterTbReq->action == TSDB_ALTER_TABLE_ADD_COLUMN ? createDefaultColCmprByType(pCol->type) + : pAlterTbReq->compress; + updataTableColCmpr(&entry.colCmpr, pCol, 1, compress); freeColCmpr = true; ASSERT(entry.colCmpr.nCols == pSchema->nCols); break; @@ -1560,7 +1563,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, hasPrimayKey); } - updataTableColCmpr(&entry.colCmpr, &tScheam, 0); + updataTableColCmpr(&entry.colCmpr, &tScheam, 0, 0); ASSERT(entry.colCmpr.nCols == pSchema->nCols); break; case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: @@ -2269,6 +2272,7 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta pMeta->changed = true; switch (pReq->action) { case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: case TSDB_ALTER_TABLE_DROP_COLUMN: case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 9cbe48a0b0..40b817accd 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -99,14 +99,7 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) { taosArrayDestroy(reqNew.pArray); } - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFreeClear(pCreateReq->comment); - taosMemoryFreeClear(pCreateReq->sql); - if (pCreateReq->type == TSDB_CHILD_TABLE) { - taosArrayDestroy(pCreateReq->ctb.tagName); - } - } + tDeleteSVCreateTbBatchReq(&req); } else if (msgType == TDMT_VND_ALTER_TABLE) { SVAlterTbReq req = {0}; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 08f1689f2f..b9c9595c74 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -163,7 +163,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* return 0; } -int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* pOffset) { +int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatchMetaRsp* pBatchMetaRsp, STqOffsetVal* pOffset) { const STqExecHandle* pExec = &pHandle->execHandle; qTaskInfo_t task = pExec->task; @@ -218,10 +218,10 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } // get meta - SMqMetaRsp* tmp = qStreamExtractMetaMsg(task); - if (tmp->metaRspLen > 0) { + SMqBatchMetaRsp* tmp = qStreamExtractMetaMsg(task); + if (taosArrayGetSize(tmp->batchMetaReq) > 0) { qStreamExtractOffset(task, &tmp->rspOffset); - *pMetaRsp = *tmp; + *pBatchMetaRsp = *tmp; tqDebug("tmqsnap task get meta"); break; diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 28f4a19949..33e3414a7d 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -17,6 +17,8 @@ static int32_t tqSendMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp, int32_t vgId); +static int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, + const SMqBatchMetaRsp* pRsp, int32_t vgId); int32_t tqInitDataRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) { tOffsetCopy(&pRsp->reqOffset, &pOffset); @@ -172,7 +174,7 @@ end : { } } -#define PROCESS_EXCLUDED_MSG(TYPE, DECODE_FUNC) \ +#define PROCESS_EXCLUDED_MSG(TYPE, DECODE_FUNC, DELETE_FUNC) \ SDecoder decoder = {0};\ TYPE req = {0}; \ void* data = POINTER_SHIFT(pHead->body, sizeof(SMsgHead)); \ @@ -182,33 +184,37 @@ end : { tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, jump meta for, vgId:%d offset %" PRId64 " msgType %d", \ pRequest->consumerId, pRequest->epoch, vgId, fetchVer, pHead->msgType); \ fetchVer++; \ + DELETE_FUNC(&req); \ tDecoderClear(&decoder); \ continue; \ } \ + DELETE_FUNC(&req); \ tDecoderClear(&decoder); +static void tDeleteCommon(void* parm) { +} static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal* offset) { - int code = 0; - int32_t vgId = TD_VID(pTq->pVnode); - SMqMetaRsp metaRsp = {0}; - STaosxRsp taosxRsp = {0}; + int code = 0; + int32_t vgId = TD_VID(pTq->pVnode); + STaosxRsp taosxRsp = {0}; + SMqBatchMetaRsp btMetaRsp = {0}; tqInitTaosxRsp(&taosxRsp.common, *offset); if (offset->type != TMQ_OFFSET__LOG) { - if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, offset) < 0) { + if (tqScanTaosx(pTq, pHandle, &taosxRsp, &btMetaRsp, offset) < 0) { code = -1; goto end; } - if (metaRsp.metaRspLen > 0) { - code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + if (taosArrayGetSize(btMetaRsp.batchMetaReq) > 0) { + code = tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64 ",ts:%" PRId64, - pRequest->consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid, - metaRsp.rspOffset.ts); - tDeleteMqMetaRsp(&metaRsp); + pRequest->consumerId, pHandle->subKey, vgId, btMetaRsp.rspOffset.type, btMetaRsp.rspOffset.uid, + btMetaRsp.rspOffset.ts); + tDeleteMqBatchMetaRsp(&btMetaRsp); goto end; } @@ -230,11 +236,18 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, uint64_t st = taosGetTimestampMs(); int totalRows = 0; + int32_t totalMetaRows = 0; while (1) { int32_t savedEpoch = atomic_load_32(&pHandle->epoch); ASSERT(savedEpoch <= pRequest->epoch); if (tqFetchLog(pTq, pHandle, &fetchVer, pRequest->reqId) < 0) { + if (totalMetaRows > 0) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); + ASSERT(totalRows == 0); + goto end; + } tqOffsetResetToLog(&taosxRsp.common.rspOffset, fetchVer); code = tqSendDataRsp( pHandle, pMsg, pRequest, &taosxRsp, @@ -258,22 +271,69 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, if ((pRequest->sourceExcluded & TD_REQ_FROM_TAOX) != 0) { if (pHead->msgType == TDMT_VND_CREATE_TABLE) { - PROCESS_EXCLUDED_MSG(SVCreateTbBatchReq, tDecodeSVCreateTbBatchReq) + PROCESS_EXCLUDED_MSG(SVCreateTbBatchReq, tDecodeSVCreateTbBatchReq, tDeleteSVCreateTbBatchReq) } else if (pHead->msgType == TDMT_VND_ALTER_TABLE) { - PROCESS_EXCLUDED_MSG(SVAlterTbReq, tDecodeSVAlterTbReq) + PROCESS_EXCLUDED_MSG(SVAlterTbReq, tDecodeSVAlterTbReq, tDeleteCommon) } else if (pHead->msgType == TDMT_VND_CREATE_STB || pHead->msgType == TDMT_VND_ALTER_STB) { - PROCESS_EXCLUDED_MSG(SVCreateStbReq, tDecodeSVCreateStbReq) + PROCESS_EXCLUDED_MSG(SVCreateStbReq, tDecodeSVCreateStbReq, tDeleteCommon) } else if (pHead->msgType == TDMT_VND_DELETE) { - PROCESS_EXCLUDED_MSG(SDeleteRes, tDecodeDeleteRes) + PROCESS_EXCLUDED_MSG(SDeleteRes, tDecodeDeleteRes, tDeleteCommon) } } - tqDebug("fetch meta msg, ver:%" PRId64 ", type:%s", pHead->version, TMSG_INFO(pHead->msgType)); - tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer + 1); - metaRsp.resMsgType = pHead->msgType; - metaRsp.metaRspLen = pHead->bodyLen; - metaRsp.metaRsp = pHead->body; - code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + tqDebug("fetch meta msg, ver:%" PRId64 ", vgId:%d, type:%s, enable batch meta:%d", pHead->version, vgId, + TMSG_INFO(pHead->msgType), pRequest->enableBatchMeta); + if (!pRequest->enableBatchMeta && !pRequest->useSnapshot) { + SMqMetaRsp metaRsp = {0}; + tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer + 1); + metaRsp.resMsgType = pHead->msgType; + metaRsp.metaRspLen = pHead->bodyLen; + metaRsp.metaRsp = pHead->body; + code = tqSendMetaPollRsp(pHandle, pMsg, pRequest, &metaRsp, vgId); + goto end; + } + + if (!btMetaRsp.batchMetaReq) { + btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); + btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); + } + fetchVer++; + + SMqMetaRsp tmpMetaRsp = {0}; + tmpMetaRsp.resMsgType = pHead->msgType; + tmpMetaRsp.metaRspLen = pHead->bodyLen; + tmpMetaRsp.metaRsp = pHead->body; + uint32_t len = 0; + tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); + if (TSDB_CODE_SUCCESS != code) { + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + continue; + } + int32_t tLen = sizeof(SMqRspHead) + len; + void* tBuf = taosMemoryCalloc(1, tLen); + void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); + SEncoder encoder = {0}; + tEncoderInit(&encoder, metaBuff, len); + code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); + if (code < 0) { + tEncoderClear(&encoder); + tqError("tmq extract meta from log, tEncodeMqMetaRsp error"); + continue; + } + taosArrayPush(btMetaRsp.batchMetaReq, &tBuf); + taosArrayPush(btMetaRsp.batchMetaLen, &tLen); + totalMetaRows++; + if ((taosArrayGetSize(btMetaRsp.batchMetaReq) >= tmqRowSize) || (taosGetTimestampMs() - st > 1000)) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); + goto end; + } + continue; + } + + if (totalMetaRows > 0) { + tqOffsetResetToLog(&btMetaRsp.rspOffset, fetchVer); + tqSendBatchMetaPollRsp(pHandle, pMsg, pRequest, &btMetaRsp, vgId); goto end; } @@ -304,7 +364,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, } end: - + tDeleteMqBatchMetaRsp(&btMetaRsp); tDeleteSTaosxRsp(&taosxRsp); return code; } @@ -352,6 +412,40 @@ static void initMqRspHead(SMqRspHead* pMsgHead, int32_t type, int32_t epoch, int pMsgHead->walever = ever; } +int32_t tqSendBatchMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqBatchMetaRsp* pRsp, + int32_t vgId) { + int32_t len = 0; + int32_t code = 0; + tEncodeSize(tEncodeMqBatchMetaRsp, pRsp, len, code); + if (code < 0) { + return -1; + } + int32_t tlen = sizeof(SMqRspHead) + len; + void* buf = rpcMallocCont(tlen); + if (buf == NULL) { + return -1; + } + + int64_t sver = 0, ever = 0; + walReaderValidVersionRange(pHandle->execHandle.pTqReader->pWalReader, &sver, &ever); + initMqRspHead(buf, TMQ_MSG_TYPE__POLL_BATCH_META_RSP, pReq->epoch, pReq->consumerId, sver, ever); + + void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); + + SEncoder encoder = {0}; + tEncoderInit(&encoder, abuf, len); + tEncodeMqBatchMetaRsp(&encoder, pRsp); + tEncoderClear(&encoder); + + SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0}; + + tmsgSendRsp(&resp); + tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type: batch meta, size:%ld offset type:%d", vgId, + pReq->consumerId, pReq->epoch, taosArrayGetSize(pRsp->batchMetaReq), pRsp->rspOffset.type); + + return 0; +} + int32_t tqSendMetaPollRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp, int32_t vgId) { int32_t len = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index ffe5c2c1e0..4d62bc9632 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -211,6 +211,11 @@ _exit: return code; } +static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { + TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose); + return 0; +} + static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; @@ -255,13 +260,17 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { _exit: if (code) { + tsdbCommitCloseReader(committer); TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); } return code; } -static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { - TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose); +static int32_t tsdbCommitCloseIter(SCommitter2 *committer) { + tsdbIterMergerClose(&committer->tombIterMerger); + tsdbIterMergerClose(&committer->dataIterMerger); + TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose); + TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose); return 0; } @@ -335,19 +344,12 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { _exit: if (code) { + tsdbCommitCloseIter(committer); TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); } return code; } -static int32_t tsdbCommitCloseIter(SCommitter2 *committer) { - tsdbIterMergerClose(&committer->tombIterMerger); - tsdbIterMergerClose(&committer->dataIterMerger); - TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose); - TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose); - return 0; -} - static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c index acacf98f84..107677ce1e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c @@ -74,7 +74,7 @@ int32_t tsdbDataFileRAWReadBlockData(SDataFileRAWReader *reader, STsdbDataRAWBlo pBlock->file.stt->level = reader->config->file.stt->level; int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + char *encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd, pBlock->offset, pBlock->data, pBlock->dataLength, 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); @@ -130,7 +130,7 @@ static int32_t tsdbDataFileRAWWriterCloseCommit(SDataFileRAWWriter *writer, TFil TSDB_CHECK_CODE(code, lino, _exit); int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + char *encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; if (writer->fd) { code = tsdbFsyncFile(writer->fd, encryptAlgorithm, encryptKey); @@ -211,13 +211,13 @@ _exit: return code; } -int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock, - int32_t encryptAlgorithm, char* encryptKey) { +int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock, + int32_t encryptAlgorithm, char *encryptKey) { int32_t code = 0; int32_t lino = 0; code = tsdbWriteFile(writer->fd, writer->ctx->offset, (const uint8_t *)pDataBlock->data, pDataBlock->dataLength, - encryptAlgorithm, encryptKey); + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->ctx->offset += pDataBlock->dataLength; diff --git a/source/dnode/vnode/src/tsdb/tsdbFile2.c b/source/dnode/vnode/src/tsdb/tsdbFile2.c index cde74f5e36..7d8b0a6c8b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile2.c @@ -44,7 +44,7 @@ static const struct { }; void remove_file(const char *fname) { - taosRemoveFile(fname); + (void)taosRemoveFile(fname); tsdbInfo("file:%s is removed", fname); } diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c index 022698b0eb..f2d4ab2cb2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMerge.c +++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c @@ -90,6 +90,11 @@ _exit: return code; } +static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) { + TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose); + return 0; +} + static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { int32_t code = 0; int32_t lino = 0; @@ -220,8 +225,10 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { code = tsdbSttFileReaderOpen(fobj->fname, &config, &reader); TSDB_CHECK_CODE(code, lino, _exit); - code = TARRAY2_APPEND(merger->sttReaderArr, reader); - TSDB_CHECK_CODE(code, lino, _exit); + if ((code = TARRAY2_APPEND(merger->sttReaderArr, reader))) { + tsdbSttFileReaderClose(&reader); + TSDB_CHECK_CODE(code, lino, _exit); + } } } @@ -232,6 +239,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) { _exit: if (code) { + tsdbMergeFileSetEndCloseReader(merger); TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code); } return code; @@ -375,11 +383,6 @@ static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) { return 0; } -static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) { - TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose); - return 0; -} - static int32_t tsdbMergeFileSetEnd(SMerger *merger) { int32_t code = 0; int32_t lino = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c index 9dae9bdd36..bc7bf5449e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c @@ -321,10 +321,10 @@ int32_t tDeserializeTsdbFSetPartList(void* buf, int32_t bufLen, STsdbFSetPartLis if (tDecodeI64(&decoder, &r.minVer) < 0) goto _err; if (tDecodeI64(&decoder, &r.maxVer) < 0) goto _err; if (tDecodeI64(&decoder, &reserved64) < 0) goto _err; - TARRAY2_APPEND(iList, r); + if (TARRAY2_APPEND(iList, r)) goto _err; } } - TARRAY2_APPEND(pList, p); + if (TARRAY2_APPEND(pList, p)) goto _err; p = NULL; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 0d36f9648b..df89746c31 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -57,6 +57,20 @@ struct STsdbSnapReader { STombBlock tombBlock[1]; }; +static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) { + int32_t code = 0; + int32_t lino = 0; + + TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose); + tsdbDataFileReaderClose(&reader->dataReader); + +_exit: + if (code) { + TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); + } + return code; +} + static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) { int32_t code = 0; int32_t lino = 0; @@ -100,27 +114,16 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) { code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); TSDB_CHECK_CODE(code, lino, _exit); - code = TARRAY2_APPEND(reader->sttReaderArr, sttReader); - TSDB_CHECK_CODE(code, lino, _exit); + if ((code = TARRAY2_APPEND(reader->sttReaderArr, sttReader))) { + tsdbSttFileReaderClose(&sttReader); + TSDB_CHECK_CODE(code, lino, _exit); + } } } _exit: if (code) { - TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); - } - return code; -} - -static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) { - int32_t code = 0; - int32_t lino = 0; - - TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose); - tsdbDataFileReaderClose(&reader->dataReader); - -_exit: - if (code) { + tsdbSnapReadFileSetCloseReader(reader); TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); } return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c index ab0575cb53..e4f48745e7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c @@ -141,6 +141,7 @@ static int32_t tsdbSnapRAWReadFileSetOpenReader(STsdbSnapRAWReader* reader) { _exit: if (code) { + tsdbSnapRAWReadFileSetCloseReader(reader); TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino); } return code; @@ -546,7 +547,7 @@ static int32_t tsdbSnapRAWWriteTimeSeriesData(STsdbSnapRAWWriter* writer, STsdbD int32_t lino = 0; int32_t encryptAlgorithm = writer->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; - char* encryptKey = writer->tsdb->pVnode->config.tsdbCfg.encryptKey; + char* encryptKey = writer->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbFSetRAWWriteBlockData(writer->ctx->fsetWriter, bHdr, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index 478778319d..f1a087e3c1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -896,7 +896,7 @@ static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) { char fname[TSDB_FILENAME_LEN]; tsdbTFileName(writer->config->tsdb, writer->file, fname); tsdbCloseFile(&writer->fd); - taosRemoveFile(fname); + (void)taosRemoveFile(fname); return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.c b/source/dnode/vnode/src/tsdb/tsdbUtil2.c index 6df0528f1c..9b88500ad1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil2.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.c @@ -56,7 +56,8 @@ int32_t tTombBlockGet(STombBlock *tombBlock, int32_t idx, STombRecord *record) { for (int32_t i = 0; i < TOMB_RECORD_ELEM_NUM; ++i) { SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * idx, &tombBlock->buffers[i]); - tBufferGetI64(&br, &record->data[i]); + int32_t code = tBufferGetI64(&br, &record->data[i]); + if (code) return code; } return 0; } @@ -182,7 +183,8 @@ int32_t tStatisBlockPut(STbStatisBlock *block, SRowInfo *row, int32_t maxRecords if (block->numOfRecords > 0) { int64_t lastUid; SBufferReader br = BUFFER_READER_INITIALIZER(sizeof(int64_t) * (block->numOfRecords - 1), &block->uids); - tBufferGetI64(&br, &lastUid); + int32_t code = tBufferGetI64(&br, &lastUid); + if (code) return code; if (lastUid == row->uid) { return tStatisBlockUpdate(block, row); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index cbac6a13de..58faa59e81 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1158,12 +1158,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, } _exit: - for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { - pCreateReq = req.pReqs + iReq; - taosMemoryFree(pCreateReq->sql); - taosMemoryFree(pCreateReq->comment); - taosArrayDestroy(pCreateReq->ctb.tagName); - } + tDeleteSVCreateTbBatchReq(&req); taosArrayDestroyEx(rsp.pArray, tFreeSVCreateTbRsp); taosArrayDestroy(tbUids); tDecoderClear(&decoder); diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index 886ce9705d..18f51df2e9 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -58,7 +58,7 @@ typedef struct STaskStopInfo { typedef struct { STqOffsetVal currentOffset; // for tmq - SMqMetaRsp metaRsp; // for tmq fetching meta + SMqBatchMetaRsp btMetaRsp; // for tmq fetching meta int8_t sourceExcluded; int64_t snapshotVer; SSchemaWrapper* schema; diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 06dd43e170..631a92f1be 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -93,6 +93,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn goto _error; } + tmemory_barrier(); SRetrieveTableRsp* pRsp = pDataInfo->pRsp; SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pDataInfo->index); @@ -428,6 +429,7 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { } } + tmemory_barrier(); pSourceDataInfo->status = EX_SOURCE_DATA_READY; code = tsem_post(&pExchangeInfo->ready); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 2f360044c9..69be1c76c7 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1078,9 +1078,9 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { return pTaskInfo->streamInfo.tbName; } -SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { +SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - return &pTaskInfo->streamInfo.metaRsp; + return &pTaskInfo->streamInfo.btMetaRsp; } void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 110aabf9b1..851d2f2735 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2845,8 +2845,8 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { SStreamRawScanInfo* pInfo = pOperator->info; int32_t code = TSDB_CODE_SUCCESS; - pTaskInfo->streamInfo.metaRsp.metaRspLen = 0; // use metaRspLen !=0 to judge if data is meta - pTaskInfo->streamInfo.metaRsp.metaRsp = NULL; + pTaskInfo->streamInfo.btMetaRsp.batchMetaReq = NULL; // use batchMetaReq != NULL to judge if data is meta + pTaskInfo->streamInfo.btMetaRsp.batchMetaLen = NULL; qDebug("tmqsnap doRawScan called"); if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) { @@ -2893,28 +2893,60 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { return NULL; } else if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_META) { SSnapContext* sContext = pInfo->sContext; - void* data = NULL; - int32_t dataLen = 0; - int16_t type = 0; - int64_t uid = 0; - if (pAPI->snapshotFn.getTableInfoFromSnapshot(sContext, &data, &dataLen, &type, &uid) < 0) { - qError("tmqsnap getTableInfoFromSnapshot error"); - taosMemoryFreeClear(data); - return NULL; - } + for(int32_t i = 0; i < tmqRowSize; i++) { + void* data = NULL; + int32_t dataLen = 0; + int16_t type = 0; + int64_t uid = 0; + if (pAPI->snapshotFn.getTableInfoFromSnapshot(sContext, &data, &dataLen, &type, &uid) < 0) { + qError("tmqsnap getTableInfoFromSnapshot error"); + taosMemoryFreeClear(data); + break; + } - if (!sContext->queryMeta) { // change to get data next poll request - STqOffsetVal offset = {0}; - SValue val = {0}; - tqOffsetResetToData(&offset, 0, INT64_MIN, val); - qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType); - } else { - tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid); - pTaskInfo->streamInfo.metaRsp.resMsgType = type; - pTaskInfo->streamInfo.metaRsp.metaRspLen = dataLen; - pTaskInfo->streamInfo.metaRsp.metaRsp = data; - } + if (!sContext->queryMeta) { // change to get data next poll request + STqOffsetVal offset = {0}; + SValue val = {0}; + tqOffsetResetToData(&offset, 0, INT64_MIN, val); + qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType); + break; + } else { + tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid); + SMqMetaRsp tmpMetaRsp = {0}; + tmpMetaRsp.resMsgType = type; + tmpMetaRsp.metaRspLen = dataLen; + tmpMetaRsp.metaRsp = data; + if (!pTaskInfo->streamInfo.btMetaRsp.batchMetaReq) { + pTaskInfo->streamInfo.btMetaRsp.batchMetaReq = taosArrayInit(4, POINTER_BYTES); + pTaskInfo->streamInfo.btMetaRsp.batchMetaLen = taosArrayInit(4, sizeof(int32_t)); + } + int32_t code = TSDB_CODE_SUCCESS; + uint32_t len = 0; + tEncodeSize(tEncodeMqMetaRsp, &tmpMetaRsp, len, code); + if (TSDB_CODE_SUCCESS != code) { + qError("tmqsnap tEncodeMqMetaRsp error"); + taosMemoryFreeClear(data); + break; + } + int32_t tLen = sizeof(SMqRspHead) + len; + void* tBuf = taosMemoryCalloc(1, tLen); + void* metaBuff = POINTER_SHIFT(tBuf, sizeof(SMqRspHead)); + SEncoder encoder = {0}; + tEncoderInit(&encoder, metaBuff, len); + code = tEncodeMqMetaRsp(&encoder, &tmpMetaRsp); + if (code < 0) { + qError("tmqsnap tEncodeMqMetaRsp error"); + tEncoderClear(&encoder); + taosMemoryFreeClear(tBuf); + taosMemoryFreeClear(data); + break; + } + taosMemoryFreeClear(data); + taosArrayPush(pTaskInfo->streamInfo.btMetaRsp.batchMetaReq, &tBuf); + taosArrayPush(pTaskInfo->streamInfo.btMetaRsp.batchMetaLen, &tLen); + } + } return NULL; } return NULL; diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 050e67e15d..857d048457 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -677,6 +677,14 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys goto _error; } + pInfo->twAggSup = (STimeWindowAggSupp){ + .waterMark = pCountNode->window.watermark, + .calTrigger = pCountNode->window.triggerType, + .maxTs = INT64_MIN, + .minTs = INT64_MAX, + .deleteMark = getDeleteMark(&pCountNode->window, 0), + }; + pInfo->primaryTsIndex = ((SColumnNode*)pCountNode->window.pTspk)->slotId; code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, @@ -687,13 +695,6 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->streamAggSup.windowCount = pCountNode->windowCount; pInfo->streamAggSup.windowSliding = pCountNode->windowSliding; - pInfo->twAggSup = (STimeWindowAggSupp){ - .waterMark = pCountNode->window.watermark, - .calTrigger = pCountNode->window.triggerType, - .maxTs = INT64_MIN, - .minTs = INT64_MAX, - }; - initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->binfo.pRes = pResBlock; diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 2da9ed0353..46844a2470 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -1427,7 +1427,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } - removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + if (IS_FINAL_INTERVAL_OP(pOperator) && !pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } if (IS_FINAL_INTERVAL_OP(pOperator)) { closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, pInfo->pPullDataMap, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); @@ -2845,7 +2847,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { closeSessionWindow(pAggSup->pResultRows, &pInfo->twAggSup, pInfo->pStUpdated); closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs); copyUpdateResult(&pInfo->pStUpdated, pInfo->pUpdated, sessionKeyCompareAsc); - removeSessionDeleteResults(pInfo->pStDeleted, pInfo->pUpdated); + if (!pInfo->destHasPrimaryKey) { + removeSessionDeleteResults(pInfo->pStDeleted, pInfo->pUpdated); + } if (pInfo->isHistoryOp) { getMaxTsWins(pInfo->pUpdated, pInfo->historyWins); } @@ -4131,7 +4135,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); } pOperator->status = OP_RES_TO_RETURN; - removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + if (!pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pInfo->pUpdatedMap, pInfo->pDelWins, pOperator); if (pInfo->destHasPrimaryKey && IS_NORMAL_INTERVAL_OP(pOperator)) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index cbffcde875..beedffc4f2 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -240,6 +240,26 @@ int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAlloc return code; } +int32_t nodesSimAcquireAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); + if (NULL == pAllocator) { + return terrno; + } + return TSDB_CODE_SUCCESS; +} + +int32_t nodesSimReleaseAllocator(int64_t allocatorId) { + if (allocatorId <= 0) { + return TSDB_CODE_SUCCESS; + } + + return taosReleaseRef(g_allocatorReqRefPool, allocatorId); +} + int32_t nodesAcquireAllocator(int64_t allocatorId) { if (allocatorId <= 0) { return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index e8596c4d19..90c3753ed0 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -118,44 +118,46 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode); SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode); SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode); -SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName); -SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); -SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode); -SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight); +SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName); +SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); +SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode); +SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft, + SNode* pRight); SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral); -SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); -SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); -SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias); -SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); -SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); -SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); -SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); -SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); -SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt); -SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); -SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); -SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); -SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias); -SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, SNode* pJoinCond); -SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName); -SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset); -SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder); -SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap); -SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr); -SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond); -SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken); -SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding, - SNode* pFill); -SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset); -SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues); -SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode); -SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd); -SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint); -SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); -SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); +SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral); +SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); +SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias); +SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); +SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); +SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); +SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); +SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); +SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt); +SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); +SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); +SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); +SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias); +SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, + SNode* pJoinCond); +SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName); +SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset); +SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder); +SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap); +SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr); +SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond); +SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken); +SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding, + SNode* pFill); +SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset); +SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues); +SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode); +SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd); +SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint); +SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); +SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere); SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList); @@ -170,7 +172,8 @@ SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery); SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill); SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit); SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset); -SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint); +SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, + SNodeList* pHint); SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags); SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight); @@ -205,8 +208,12 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions); SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SDataType dataType); -SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, - SNode* pOptions); + +SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SDataType dataType, SNode* pOptions); + +SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SNode* pOptions); SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName); SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName); @@ -217,7 +224,8 @@ SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind); SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, EOperatorType tableCondType); -SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType); +SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, + EOperatorType tableCondType); SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 5196be93c0..170d51b1bf 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -354,7 +354,7 @@ cmd ::= ALTER STABLE alter_table_clause(A). alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); } alter_table_clause(A) ::= - full_table_name(B) ADD COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D); } + full_table_name(B) ADD COLUMN column_name(C) type_name(D) column_options(E). { A = createAlterTableAddModifyColOptions2(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D, E); } alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); } alter_table_clause(A) ::= full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 2af1e11076..64d1260719 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -176,7 +176,8 @@ static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool demandDb) static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) { trimEscape(pTableName); - if (NULL != pTableName && pTableName->type != TK_NK_NIL && (pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) { + if (NULL != pTableName && pTableName->type != TK_NK_NIL && + (pTableName->n >= TSDB_TABLE_NAME_LEN || pTableName->n == 0)) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pTableName->z); return false; } @@ -185,7 +186,8 @@ static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) { static bool checkColumnName(SAstCreateContext* pCxt, SToken* pColumnName) { trimEscape(pColumnName); - if (NULL != pColumnName && pColumnName->type != TK_NK_NIL && (pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) { + if (NULL != pColumnName && pColumnName->type != TK_NK_NIL && + (pColumnName->n >= TSDB_COL_NAME_LEN || pColumnName->n == 0)) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pColumnName->z); return false; } @@ -1893,6 +1895,38 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, pStmt->dataType = dataType; return createAlterTableStmtFinalize(pRealTable, pStmt); } +SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, + SToken* pColName, SDataType dataType, SNode* pOptions) { + CHECK_PARSER_STATUS(pCxt); + if (!checkColumnName(pCxt, pColName)) { + return NULL; + } + + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + CHECK_OUT_OF_MEM(pStmt); + pStmt->alterType = alterType; + COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); + pStmt->dataType = dataType; + pStmt->pColOptions = (SColumnOptions*)pOptions; + + if (pOptions != NULL) { + SColumnOptions* pOption = (SColumnOptions*)pOptions; + if (pOption->bPrimaryKey == false && pOption->commentNull == true) { + if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) { + pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + } else { + // pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + // "not support alter column with option except compress"); + // return NULL; + } + } else { + pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "not support alter column with option except compress"); + return NULL; + } + } + return createAlterTableStmtFinalize(pRealTable, pStmt); +} SNode* createAlterTableAddModifyColOptions(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, SNode* pOptions) { @@ -2821,9 +2855,10 @@ SNode* createBalanceVgroupLeaderStmt(SAstCreateContext* pCxt, const SToken* pVgI return (SNode*)pStmt; } -SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName){ +SNode* createBalanceVgroupLeaderDBNameStmt(SAstCreateContext* pCxt, const SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); - SBalanceVgroupLeaderStmt* pStmt = (SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT); + SBalanceVgroupLeaderStmt* pStmt = + (SBalanceVgroupLeaderStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_LEADER_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); if (NULL != pDbName) { COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6795fefc14..39c03db5f0 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1003,7 +1003,7 @@ static bool isBlockTimeLineAlignedQuery(SNode* pStmt) { SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum) { SNodeList* pPartitionList = NULL; - SNode* pNode = NULL; + SNode* pNode = NULL; if (pOrderList->length <= nodesNum) { return NULL; } @@ -1023,7 +1023,6 @@ SNodeList* buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesN return pPartitionList; } - static bool isTimeLineAlignedQuery(SNode* pStmt) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; if (!isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { @@ -1036,7 +1035,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) { return true; } if (pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) { - SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); + SNodeList* pPartitionList = + buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList); nodesDestroyList(pPartitionList); @@ -1049,7 +1049,8 @@ static bool isTimeLineAlignedQuery(SNode* pStmt) { if (QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery; if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) { - SNodeList* pPartitionList = buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); + SNodeList* pPartitionList = + buildPartitionListFromOrderList(pSub->pOrderByList, pSelect->pPartitionByList->length); bool match = nodesListMatch(pSelect->pPartitionByList, pPartitionList); nodesDestroyList(pPartitionList); @@ -6083,7 +6084,7 @@ static void resetResultTimeline(SSelectStmt* pSelect) { } } } - + pSelect->timeLineResMode = TIME_LINE_NONE; } @@ -6237,8 +6238,8 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName); SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft); - bool isLeftPrimTs = isPrimaryKeyImpl(pLeft); - bool isRightPrimTs = isPrimaryKeyImpl(pRight); + bool isLeftPrimTs = isPrimaryKeyImpl(pLeft); + bool isRightPrimTs = isPrimaryKeyImpl(pRight); if (isLeftPrimTs && isRightPrimTs) { SColumnNode* pFCol = (SColumnNode*)pProj; @@ -6288,9 +6289,9 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS pSetOperator->timeLineFromOrderBy = true; return code; } - } + } } - + pSetOperator->timeLineResMode = TIME_LINE_NONE; } return code; @@ -8156,9 +8157,9 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* } switch (pStmt->alterType) { + case TSDB_ALTER_TABLE_ADD_COLUMN: case TSDB_ALTER_TABLE_ADD_TAG: case TSDB_ALTER_TABLE_DROP_TAG: - case TSDB_ALTER_TABLE_ADD_COLUMN: case TSDB_ALTER_TABLE_DROP_COLUMN: case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: case TSDB_ALTER_TABLE_UPDATE_TAG_BYTES: { @@ -8193,6 +8194,31 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* taosArrayPush(pAlterReq->pFields, &field); break; } + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { + taosArrayDestroy(pAlterReq->pFields); + + pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions)); + SFieldWithOptions field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)}; + // TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)}; + strcpy(field.name, pStmt->colName); + if (pStmt->pColOptions != NULL) { + if (!checkColumnEncodeOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->encode)) + return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompressOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compress)) + return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevelOrSetDefault(pStmt->dataType.type, pStmt->pColOptions->compressLevel)) + return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + int32_t code = setColCompressByOption(pStmt->dataType.type, columnEncodeVal(pStmt->pColOptions->encode), + columnCompressVal(pStmt->pColOptions->compress), + columnLevelVal(pStmt->pColOptions->compressLevel), false, + (uint32_t*)&field.compress); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + taosArrayPush(pAlterReq->pFields, &field); + break; + } default: break; } @@ -10643,7 +10669,7 @@ static int32_t translateBalanceVgroup(STranslateContext* pCxt, SBalanceVgroupStm static int32_t translateBalanceVgroupLeader(STranslateContext* pCxt, SBalanceVgroupLeaderStmt* pStmt) { SBalanceVgroupLeaderReq req = {0}; req.vgId = pStmt->vgId; - if(pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName); + if (pStmt->dbName != NULL) strcpy(req.db, pStmt->dbName); int32_t code = buildCmdMsg(pCxt, TDMT_MND_BALANCE_VGROUP_LEADER, (FSerializeFunc)tSerializeSBalanceVgroupLeaderReq, &req); tFreeSBalanceVgroupLeaderReq(&req); @@ -11058,7 +11084,8 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm } if (TSDB_CODE_SUCCESS == code) { - pReq->deleteMark = convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision); + pReq->deleteMark = + convertTimePrecision(tsmaDataDeleteMark, TSDB_TIME_PRECISION_MILLI, pTableMeta->tableInfo.precision); code = getSmaIndexSql(pCxt, &pReq->sql, &pReq->sqlLen); } @@ -12858,6 +12885,11 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ROW_LENGTH, TSDB_MAX_BYTES_PER_ROW); } + // only super and normal support + if (pStmt->pColOptions != NULL && TSDB_CHILD_TABLE == pTableMeta->tableType) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); + } + pReq->colName = taosStrdup(pStmt->colName); if (NULL == pReq->colName) { return TSDB_CODE_OUT_OF_MEMORY; @@ -12866,6 +12898,17 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->type = pStmt->dataType.type; pReq->flags = COL_SMA_ON; pReq->bytes = calcTypeBytes(pStmt->dataType); + if (pStmt->pColOptions != NULL) { + if (!checkColumnEncodeOrSetDefault(pReq->type, pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR; + if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress)) + return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR; + if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel)) + return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR; + int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode), + columnCompressVal(pStmt->pColOptions->compress), + columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress); + } + return TSDB_CODE_SUCCESS; } @@ -13012,6 +13055,7 @@ static int32_t buildAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, case TSDB_ALTER_TABLE_UPDATE_TAG_VAL: return buildUpdateTagValReq(pCxt, pStmt, pTableMeta, pReq); case TSDB_ALTER_TABLE_ADD_COLUMN: + case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: return buildAddColReq(pCxt, pStmt, pTableMeta, pReq); case TSDB_ALTER_TABLE_DROP_COLUMN: return buildDropColReq(pCxt, pStmt, pTableMeta, pReq); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 860fb23bcb..bc409dd6cf 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -143,18 +143,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 965 +#define YYNSTATE 967 #define YYNRULE 749 #define YYNRULE_WITH_ACTION 749 #define YYNTOKEN 377 -#define YY_MAX_SHIFT 964 -#define YY_MIN_SHIFTREDUCE 1433 -#define YY_MAX_SHIFTREDUCE 2181 -#define YY_ERROR_ACTION 2182 -#define YY_ACCEPT_ACTION 2183 -#define YY_NO_ACTION 2184 -#define YY_MIN_REDUCE 2185 -#define YY_MAX_REDUCE 2933 +#define YY_MAX_SHIFT 966 +#define YY_MIN_SHIFTREDUCE 1434 +#define YY_MAX_SHIFTREDUCE 2182 +#define YY_ERROR_ACTION 2183 +#define YY_ACCEPT_ACTION 2184 +#define YY_NO_ACTION 2185 +#define YY_MIN_REDUCE 2186 +#define YY_MAX_REDUCE 2934 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -223,335 +223,335 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (3285) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 790, 37, 338, 2542, 190, 2379, 315, 2904, 2899, 802, - /* 10 */ 155, 2448, 47, 45, 2098, 2899, 857, 2388, 2667, 462, - /* 20 */ 469, 485, 1919, 2185, 2540, 847, 789, 217, 659, 2709, - /* 30 */ 2446, 2900, 791, 182, 2903, 2007, 146, 1917, 2900, 2902, - /* 40 */ 197, 2322, 805, 685, 802, 155, 3, 145, 144, 143, + /* 0 */ 792, 37, 338, 2543, 190, 2380, 315, 2905, 2900, 804, + /* 10 */ 155, 2449, 47, 45, 2099, 2900, 859, 2389, 2668, 464, + /* 20 */ 471, 487, 1920, 2186, 2541, 849, 791, 217, 661, 2710, + /* 30 */ 2447, 2901, 793, 182, 2904, 2008, 146, 1918, 2901, 2903, + /* 40 */ 197, 2323, 807, 687, 804, 155, 3, 145, 144, 143, /* 50 */ 142, 141, 140, 139, 138, 137, 40, 39, 9, 53, - /* 60 */ 46, 44, 43, 42, 41, 1474, 437, 2002, 2515, 474, - /* 70 */ 2727, 40, 39, 779, 19, 46, 44, 43, 42, 41, - /* 80 */ 861, 1925, 474, 2448, 1481, 2542, 2674, 2529, 842, 660, - /* 90 */ 183, 435, 2197, 861, 494, 493, 802, 155, 857, 2388, - /* 100 */ 464, 2727, 2446, 122, 1933, 66, 2539, 847, 1476, 1479, - /* 110 */ 1480, 961, 487, 2390, 15, 2208, 2709, 2007, 221, 1926, - /* 120 */ 40, 39, 376, 2627, 46, 44, 43, 42, 41, 843, - /* 130 */ 804, 185, 2809, 2810, 2708, 153, 2814, 2747, 780, 551, - /* 140 */ 2511, 119, 2710, 846, 2712, 2713, 841, 1944, 861, 2002, - /* 150 */ 2009, 2010, 252, 199, 2123, 2801, 642, 2727, 2237, 465, - /* 160 */ 2797, 802, 155, 1925, 453, 2589, 192, 2809, 801, 2124, - /* 170 */ 147, 800, 2674, 2674, 778, 842, 856, 756, 2899, 218, - /* 180 */ 790, 514, 2073, 452, 2589, 2899, 429, 2848, 2899, 1980, - /* 190 */ 1990, 639, 232, 830, 640, 2229, 789, 217, 856, 2008, - /* 200 */ 2011, 2900, 791, 2905, 217, 223, 789, 217, 2900, 791, - /* 210 */ 656, 2900, 791, 2122, 1920, 62, 1918, 2904, 125, 2809, - /* 220 */ 2810, 2708, 153, 2814, 2747, 2899, 98, 775, 119, 2710, - /* 230 */ 846, 2712, 2713, 841, 2036, 861, 867, 2392, 157, 123, - /* 240 */ 166, 2772, 2801, 439, 2903, 62, 465, 2797, 2900, 2901, - /* 250 */ 1923, 1924, 1977, 2383, 1979, 1982, 1983, 1984, 1985, 1986, - /* 260 */ 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, 2005, - /* 270 */ 2006, 2, 47, 45, 657, 2535, 1501, 414, 1500, 1942, - /* 280 */ 469, 739, 1919, 186, 2809, 2810, 586, 153, 2814, 607, - /* 290 */ 494, 493, 50, 151, 606, 2007, 1934, 1917, 1929, 736, - /* 300 */ 2037, 2821, 2070, 2071, 2072, 2821, 2821, 2821, 2821, 2821, - /* 310 */ 644, 33, 565, 1502, 608, 1926, 641, 40, 39, 415, - /* 320 */ 567, 46, 44, 43, 42, 41, 647, 2002, 662, 640, - /* 330 */ 2229, 545, 1937, 1939, 19, 2186, 781, 776, 769, 765, - /* 340 */ 12, 1925, 10, 856, 740, 180, 859, 858, 2001, 2003, - /* 350 */ 2004, 2005, 2006, 236, 487, 2390, 136, 655, 2073, 135, + /* 60 */ 46, 44, 43, 42, 41, 1475, 439, 2003, 2516, 476, + /* 70 */ 2728, 40, 39, 781, 19, 46, 44, 43, 42, 41, + /* 80 */ 863, 1926, 476, 2449, 1482, 2543, 2675, 2530, 844, 662, + /* 90 */ 183, 437, 2198, 863, 496, 495, 804, 155, 859, 2389, + /* 100 */ 466, 2728, 2447, 122, 1934, 66, 2540, 849, 1477, 1480, + /* 110 */ 1481, 963, 489, 2391, 15, 2209, 2710, 2008, 221, 1927, + /* 120 */ 40, 39, 377, 2628, 46, 44, 43, 42, 41, 845, + /* 130 */ 806, 185, 2810, 2811, 2709, 153, 2815, 2748, 782, 553, + /* 140 */ 2512, 119, 2711, 848, 2713, 2714, 843, 1945, 863, 2003, + /* 150 */ 2010, 2011, 252, 199, 2124, 2802, 644, 2728, 2238, 467, + /* 160 */ 2798, 804, 155, 1926, 455, 2590, 192, 2810, 803, 2125, + /* 170 */ 147, 802, 2675, 2675, 780, 844, 858, 758, 2900, 218, + /* 180 */ 792, 516, 2074, 454, 2590, 2900, 431, 2849, 2900, 1981, + /* 190 */ 1991, 641, 232, 832, 642, 2230, 791, 217, 858, 2009, + /* 200 */ 2012, 2901, 793, 2906, 217, 223, 791, 217, 2901, 793, + /* 210 */ 658, 2901, 793, 2123, 1921, 62, 1919, 2905, 125, 2810, + /* 220 */ 2811, 2709, 153, 2815, 2748, 2900, 98, 777, 119, 2711, + /* 230 */ 848, 2713, 2714, 843, 2037, 863, 869, 2393, 157, 123, + /* 240 */ 166, 2773, 2802, 441, 2904, 62, 467, 2798, 2901, 2902, + /* 250 */ 1924, 1925, 1978, 2384, 1980, 1983, 1984, 1985, 1986, 1987, + /* 260 */ 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, 2006, + /* 270 */ 2007, 2, 47, 45, 659, 2536, 1502, 415, 1501, 1943, + /* 280 */ 471, 741, 1920, 186, 2810, 2811, 588, 153, 2815, 609, + /* 290 */ 496, 495, 50, 151, 608, 2008, 1935, 1918, 1930, 738, + /* 300 */ 2038, 2822, 2071, 2072, 2073, 2822, 2822, 2822, 2822, 2822, + /* 310 */ 646, 33, 567, 1503, 610, 1927, 643, 40, 39, 416, + /* 320 */ 569, 46, 44, 43, 42, 41, 649, 2003, 664, 642, + /* 330 */ 2230, 547, 1938, 1940, 19, 2187, 783, 778, 771, 767, + /* 340 */ 12, 1926, 10, 858, 742, 180, 861, 860, 2002, 2004, + /* 350 */ 2005, 2006, 2007, 236, 489, 2391, 136, 657, 2074, 135, /* 360 */ 134, 133, 132, 131, 130, 129, 128, 127, 51, 289, - /* 370 */ 1977, 961, 438, 288, 15, 898, 172, 171, 895, 894, - /* 380 */ 893, 169, 98, 553, 866, 865, 864, 36, 467, 2031, - /* 390 */ 2032, 2033, 2034, 2035, 2039, 2040, 2041, 2042, 322, 92, - /* 400 */ 40, 39, 91, 658, 46, 44, 43, 42, 41, 2384, - /* 410 */ 2009, 2010, 1948, 2522, 2501, 737, 594, 593, 592, 591, - /* 420 */ 590, 585, 584, 583, 582, 421, 649, 2581, 322, 572, - /* 430 */ 571, 570, 569, 568, 562, 561, 560, 50, 555, 554, - /* 440 */ 436, 2073, 2372, 417, 546, 1753, 1754, 101, 181, 1980, - /* 450 */ 1990, 1772, 424, 389, 1944, 451, 62, 728, 136, 2008, - /* 460 */ 2011, 135, 134, 133, 132, 131, 130, 129, 128, 127, - /* 470 */ 90, 387, 76, 726, 1920, 75, 1918, 2821, 2070, 2071, - /* 480 */ 2072, 2821, 2821, 2821, 2821, 2821, 416, 826, 724, 2773, - /* 490 */ 722, 720, 286, 285, 1929, 2709, 1948, 210, 250, 621, - /* 500 */ 619, 616, 614, 2075, 2076, 2077, 2078, 2079, 805, 197, - /* 510 */ 1923, 1924, 1977, 2435, 1979, 1982, 1983, 1984, 1985, 1986, - /* 520 */ 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, 2005, - /* 530 */ 2006, 2, 12, 47, 45, 1945, 2727, 2516, 1919, 2207, - /* 540 */ 1944, 469, 542, 1919, 62, 46, 44, 43, 42, 41, - /* 550 */ 1653, 322, 2674, 1917, 842, 533, 2007, 532, 1917, 519, - /* 560 */ 2484, 2070, 2071, 2072, 1644, 890, 889, 888, 1648, 887, - /* 570 */ 1650, 1651, 886, 883, 2709, 1659, 880, 1661, 1662, 877, - /* 580 */ 874, 871, 63, 213, 2542, 472, 2131, 843, 2002, 531, - /* 590 */ 833, 604, 602, 179, 410, 19, 2674, 1925, 230, 471, - /* 600 */ 2708, 832, 1925, 2747, 2393, 2539, 847, 119, 2710, 846, - /* 610 */ 2712, 2713, 841, 1945, 861, 2727, 443, 442, 689, 199, - /* 620 */ 322, 2801, 688, 1765, 1766, 465, 2797, 961, 557, 2511, - /* 630 */ 180, 2674, 961, 842, 62, 15, 86, 85, 538, 322, - /* 640 */ 2391, 229, 2668, 2816, 1949, 772, 771, 2129, 2130, 2132, - /* 650 */ 2133, 2134, 900, 2849, 530, 528, 40, 39, 857, 2388, - /* 660 */ 46, 44, 43, 42, 41, 1792, 1793, 413, 12, 2813, - /* 670 */ 517, 2009, 2010, 513, 509, 505, 502, 531, 146, 2708, - /* 680 */ 489, 234, 2747, 2441, 2443, 690, 119, 2710, 846, 2712, - /* 690 */ 2713, 841, 2904, 861, 441, 440, 523, 687, 2776, 1501, - /* 700 */ 2801, 1500, 857, 2388, 465, 2797, 474, 117, 2467, 1947, - /* 710 */ 1980, 1990, 2102, 1481, 1791, 1794, 1944, 861, 1944, 689, - /* 720 */ 2008, 2011, 55, 688, 158, 525, 521, 322, 1949, 579, - /* 730 */ 1920, 1653, 1918, 2380, 578, 1920, 1502, 1918, 1479, 1480, - /* 740 */ 598, 2684, 577, 1692, 1693, 1644, 890, 889, 888, 1648, - /* 750 */ 887, 1650, 1651, 837, 836, 2709, 1659, 835, 1661, 1662, - /* 760 */ 834, 874, 871, 2142, 1948, 755, 1923, 1924, 843, 2688, - /* 770 */ 2239, 1923, 1924, 1977, 376, 1979, 1982, 1983, 1984, 1985, - /* 780 */ 1986, 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, - /* 790 */ 2005, 2006, 2, 47, 45, 2012, 2727, 480, 2709, 588, - /* 800 */ 2511, 469, 148, 1919, 2166, 914, 241, 483, 43, 42, - /* 810 */ 41, 843, 2674, 2856, 842, 88, 2007, 322, 1917, 2364, - /* 820 */ 2690, 2693, 40, 39, 1925, 2709, 46, 44, 43, 42, - /* 830 */ 41, 861, 597, 240, 713, 1948, 2590, 2017, 843, 2727, - /* 840 */ 2869, 636, 828, 1944, 2773, 2206, 595, 2205, 2002, 727, - /* 850 */ 634, 2816, 239, 630, 626, 2674, 2362, 842, 857, 2388, - /* 860 */ 2708, 917, 1925, 2747, 2348, 287, 2727, 119, 2710, 846, - /* 870 */ 2712, 2713, 841, 916, 861, 581, 580, 2812, 539, 2919, - /* 880 */ 320, 2801, 2674, 716, 842, 465, 2797, 1981, 857, 2388, - /* 890 */ 710, 708, 961, 2684, 254, 48, 891, 284, 642, 2448, - /* 900 */ 2237, 2448, 2674, 2708, 2674, 60, 2747, 473, 540, 488, - /* 910 */ 119, 2710, 846, 2712, 2713, 841, 753, 861, 2446, 1483, - /* 920 */ 2446, 2688, 2919, 1947, 2801, 1943, 490, 2038, 465, 2797, - /* 930 */ 2708, 2009, 2010, 2747, 179, 208, 2628, 119, 2710, 846, - /* 940 */ 2712, 2713, 841, 72, 861, 2393, 71, 740, 1978, 2919, - /* 950 */ 1978, 2801, 1944, 40, 39, 465, 2797, 46, 44, 43, - /* 960 */ 42, 41, 898, 172, 171, 895, 894, 893, 169, 2709, - /* 970 */ 1980, 1990, 2690, 2692, 466, 2377, 1888, 2204, 29, 1592, - /* 980 */ 2008, 2011, 843, 861, 767, 2095, 1887, 857, 2388, 2363, - /* 990 */ 756, 857, 2388, 857, 2388, 1920, 1949, 1918, 2899, 898, - /* 1000 */ 172, 171, 895, 894, 893, 169, 212, 559, 479, 478, - /* 1010 */ 2727, 573, 1981, 574, 34, 2183, 2905, 217, 482, 481, - /* 1020 */ 2173, 2900, 791, 1594, 2043, 2595, 2674, 372, 842, 742, - /* 1030 */ 2581, 1923, 1924, 1977, 2674, 1979, 1982, 1983, 1984, 1985, - /* 1040 */ 1986, 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, - /* 1050 */ 2005, 2006, 2, 47, 45, 2709, 2442, 2443, 2203, 1587, - /* 1060 */ 2143, 469, 900, 1919, 1504, 1505, 156, 1949, 843, 2772, - /* 1070 */ 2892, 2903, 857, 2388, 2708, 1978, 2007, 2747, 1917, 2260, - /* 1080 */ 290, 119, 2710, 846, 2712, 2713, 841, 291, 861, 857, - /* 1090 */ 2388, 2709, 575, 2919, 320, 2801, 2727, 14, 13, 465, - /* 1100 */ 2797, 707, 500, 1588, 843, 2202, 2833, 499, 2002, 661, - /* 1110 */ 857, 2388, 2674, 1604, 842, 2674, 706, 705, 704, 857, - /* 1120 */ 2388, 1981, 1925, 696, 152, 700, 329, 330, 1603, 699, - /* 1130 */ 2385, 328, 2727, 2816, 698, 703, 446, 445, 2172, 292, - /* 1140 */ 697, 857, 2388, 2201, 444, 693, 692, 691, 2674, 2198, - /* 1150 */ 842, 784, 961, 857, 2388, 48, 756, 2200, 733, 2811, - /* 1160 */ 2708, 300, 2674, 2747, 2899, 1846, 1847, 119, 2710, 846, - /* 1170 */ 2712, 2713, 841, 808, 861, 857, 2388, 857, 2388, 2919, - /* 1180 */ 2199, 2801, 2905, 217, 1978, 465, 2797, 2900, 791, 857, - /* 1190 */ 2388, 2009, 2010, 857, 2388, 333, 2708, 822, 102, 2747, - /* 1200 */ 2674, 1608, 609, 119, 2710, 846, 2712, 2713, 841, 340, - /* 1210 */ 861, 2050, 756, 854, 2674, 2919, 1607, 2801, 2196, 2084, - /* 1220 */ 2899, 465, 2797, 419, 418, 857, 2388, 857, 2388, 2709, - /* 1230 */ 1980, 1990, 1820, 475, 857, 2388, 211, 2674, 2905, 217, - /* 1240 */ 2008, 2011, 843, 2900, 791, 855, 2007, 368, 484, 2375, - /* 1250 */ 681, 680, 683, 682, 491, 1920, 2614, 1918, 111, 2195, - /* 1260 */ 2448, 2194, 2193, 2192, 702, 701, 2448, 2191, 2190, 2189, - /* 1270 */ 2727, 2188, 928, 926, 170, 2674, 2709, 535, 2002, 809, - /* 1280 */ 2094, 2323, 534, 179, 2381, 817, 2674, 2618, 842, 843, - /* 1290 */ 611, 1923, 1924, 1977, 2394, 1979, 1982, 1983, 1984, 1985, - /* 1300 */ 1986, 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, - /* 1310 */ 2005, 2006, 2, 47, 45, 78, 2674, 2727, 2674, 2674, - /* 1320 */ 2674, 469, 2494, 1919, 2674, 2674, 2674, 892, 2674, 794, - /* 1330 */ 2439, 756, 2448, 2674, 2708, 842, 2007, 2747, 1917, 2899, - /* 1340 */ 507, 119, 2710, 846, 2712, 2713, 841, 383, 861, 741, - /* 1350 */ 2425, 2447, 2365, 2774, 2258, 2801, 54, 2905, 217, 465, - /* 1360 */ 2797, 896, 2900, 791, 2439, 549, 40, 39, 2002, 89, - /* 1370 */ 46, 44, 43, 42, 41, 897, 709, 806, 2439, 2213, - /* 1380 */ 956, 2708, 1925, 277, 2747, 161, 275, 793, 119, 2710, - /* 1390 */ 846, 2712, 2713, 841, 279, 861, 281, 278, 283, 280, - /* 1400 */ 827, 282, 2801, 756, 694, 162, 465, 2797, 695, 797, - /* 1410 */ 35, 2899, 961, 2709, 2249, 15, 40, 39, 2247, 2370, - /* 1420 */ 46, 44, 43, 42, 41, 1910, 843, 1886, 1585, 2905, - /* 1430 */ 217, 756, 1583, 301, 2900, 791, 711, 162, 763, 2899, - /* 1440 */ 714, 730, 49, 729, 2175, 2176, 14, 13, 831, 49, - /* 1450 */ 2695, 2009, 2010, 297, 2727, 200, 170, 2905, 217, 477, - /* 1460 */ 476, 1911, 2900, 791, 327, 77, 64, 49, 49, 382, - /* 1470 */ 2674, 2392, 842, 2114, 1928, 859, 858, 2001, 2003, 2004, - /* 1480 */ 2005, 2006, 103, 347, 346, 349, 348, 1836, 351, 350, - /* 1490 */ 1980, 1990, 77, 167, 170, 353, 352, 190, 207, 316, - /* 1500 */ 2008, 2011, 2273, 355, 354, 357, 356, 359, 358, 361, - /* 1510 */ 360, 363, 362, 2862, 2697, 1920, 773, 1918, 2708, 1844, - /* 1520 */ 2118, 2747, 365, 364, 2128, 120, 2710, 846, 2712, 2713, - /* 1530 */ 841, 2127, 861, 367, 366, 308, 74, 306, 807, 2801, - /* 1540 */ 803, 869, 1927, 2800, 2797, 168, 331, 814, 2044, 1991, - /* 1550 */ 1789, 1923, 1924, 1977, 150, 1979, 1982, 1983, 1984, 1985, - /* 1560 */ 1986, 1987, 1988, 1989, 838, 859, 858, 2001, 2003, 2004, - /* 1570 */ 2005, 2006, 2, 170, 1779, 343, 1635, 149, 934, 933, - /* 1580 */ 932, 931, 497, 167, 930, 929, 160, 924, 923, 922, - /* 1590 */ 921, 920, 919, 918, 159, 912, 911, 910, 496, 495, - /* 1600 */ 907, 906, 905, 196, 195, 904, 492, 903, 902, 901, - /* 1610 */ 738, 2728, 1565, 908, 909, 2241, 1538, 795, 381, 2315, - /* 1620 */ 116, 2314, 2709, 1666, 2028, 2520, 2230, 1674, 964, 113, - /* 1630 */ 2852, 770, 454, 458, 777, 843, 811, 1557, 1555, 498, - /* 1640 */ 516, 2236, 2521, 2436, 374, 749, 2853, 2863, 785, 786, - /* 1650 */ 318, 2709, 313, 1931, 321, 1681, 1566, 2349, 501, 1679, - /* 1660 */ 1539, 954, 206, 2727, 843, 173, 506, 5, 433, 952, - /* 1670 */ 1942, 950, 946, 942, 938, 515, 371, 1952, 527, 2674, - /* 1680 */ 526, 842, 224, 225, 529, 227, 1813, 375, 1943, 543, - /* 1690 */ 238, 550, 2727, 552, 563, 556, 558, 600, 576, 798, - /* 1700 */ 587, 2513, 596, 589, 599, 601, 612, 610, 2674, 613, - /* 1710 */ 842, 244, 243, 615, 617, 618, 247, 620, 622, 1950, - /* 1720 */ 637, 1930, 118, 4, 645, 344, 638, 2708, 648, 646, - /* 1730 */ 2747, 255, 94, 1945, 120, 2710, 846, 2712, 2713, 841, - /* 1740 */ 2276, 861, 650, 258, 1951, 651, 1953, 261, 2801, 2709, - /* 1750 */ 654, 652, 829, 2797, 263, 1954, 844, 818, 95, 2747, - /* 1760 */ 96, 1955, 840, 120, 2710, 846, 2712, 2713, 841, 2530, - /* 1770 */ 861, 2536, 97, 2709, 663, 684, 270, 2801, 124, 717, - /* 1780 */ 718, 428, 2797, 686, 2378, 274, 843, 408, 732, 2374, - /* 1790 */ 2727, 276, 2604, 734, 175, 100, 377, 2601, 121, 2376, - /* 1800 */ 2371, 176, 342, 1946, 824, 177, 2674, 325, 842, 293, - /* 1810 */ 163, 2582, 324, 744, 2727, 743, 706, 705, 704, 296, - /* 1820 */ 2600, 745, 751, 696, 152, 700, 748, 298, 774, 699, - /* 1830 */ 2674, 294, 842, 2868, 698, 703, 446, 445, 760, 812, - /* 1840 */ 697, 8, 2709, 783, 444, 693, 692, 691, 2840, 2867, - /* 1850 */ 750, 761, 303, 307, 2708, 843, 305, 2747, 759, 2709, - /* 1860 */ 309, 405, 2710, 846, 2712, 2713, 841, 839, 861, 825, - /* 1870 */ 2766, 758, 843, 788, 311, 189, 310, 312, 2708, 787, - /* 1880 */ 459, 2747, 2922, 2727, 314, 184, 2710, 846, 2712, 2713, - /* 1890 */ 841, 799, 861, 2898, 796, 1947, 317, 154, 2817, 2674, - /* 1900 */ 2727, 842, 2092, 810, 2090, 2820, 323, 203, 272, 378, - /* 1910 */ 164, 379, 2550, 815, 2549, 2548, 2674, 1, 842, 219, - /* 1920 */ 816, 463, 165, 820, 61, 336, 191, 850, 2782, 848, - /* 1930 */ 341, 823, 757, 2859, 852, 679, 675, 671, 667, 2709, - /* 1940 */ 271, 380, 110, 853, 2389, 112, 1457, 2708, 863, 955, - /* 1950 */ 2747, 2666, 843, 2665, 187, 2710, 846, 2712, 2713, 841, - /* 1960 */ 370, 861, 958, 960, 2708, 2661, 2660, 2747, 384, 174, - /* 1970 */ 388, 120, 2710, 846, 2712, 2713, 841, 409, 861, 2652, - /* 1980 */ 2727, 2626, 2651, 2643, 2642, 2801, 99, 52, 386, 269, - /* 1990 */ 2798, 2658, 2625, 2657, 2649, 2648, 2674, 2637, 842, 2636, - /* 2000 */ 2655, 2654, 2646, 2645, 2634, 2633, 396, 425, 2631, 2630, - /* 2010 */ 2440, 736, 420, 792, 2920, 2624, 83, 407, 397, 2619, - /* 2020 */ 503, 504, 1870, 1871, 222, 508, 2617, 510, 511, 512, - /* 2030 */ 1869, 2616, 2709, 434, 2613, 518, 2612, 520, 2611, 522, - /* 2040 */ 426, 2615, 2610, 524, 2708, 843, 2586, 2747, 1857, 226, - /* 2050 */ 2585, 184, 2710, 846, 2712, 2713, 841, 257, 861, 228, - /* 2060 */ 1816, 84, 1815, 2563, 2562, 2561, 268, 536, 537, 2560, - /* 2070 */ 259, 266, 2559, 2727, 2503, 541, 264, 653, 1752, 2500, - /* 2080 */ 544, 2499, 2493, 548, 547, 2490, 2489, 231, 2488, 2674, - /* 2090 */ 87, 842, 2487, 2492, 2491, 256, 235, 564, 233, 2860, - /* 2100 */ 2486, 2485, 2483, 2482, 2481, 2480, 566, 2478, 2477, 2476, - /* 2110 */ 2475, 2709, 2474, 2498, 456, 2473, 2472, 2471, 2496, 2479, - /* 2120 */ 2470, 2469, 2468, 2466, 843, 2465, 2464, 2463, 2462, 2461, - /* 2130 */ 2709, 2460, 2459, 237, 2458, 93, 2457, 2708, 2456, 2528, - /* 2140 */ 2747, 2497, 2495, 843, 406, 2710, 846, 2712, 2713, 841, - /* 2150 */ 2455, 861, 2727, 2454, 2709, 1758, 2453, 242, 2452, 603, - /* 2160 */ 2451, 605, 2450, 2449, 2280, 1605, 1609, 843, 2674, 2279, - /* 2170 */ 842, 2727, 1601, 245, 2278, 422, 2277, 2275, 246, 2272, - /* 2180 */ 2271, 423, 623, 627, 2264, 2251, 2225, 2674, 2224, 842, - /* 2190 */ 73, 625, 631, 457, 629, 2727, 635, 633, 2584, 2709, - /* 2200 */ 624, 198, 628, 251, 248, 632, 1482, 249, 80, 2580, - /* 2210 */ 253, 2674, 840, 842, 262, 81, 2708, 2694, 2570, 2747, - /* 2220 */ 209, 643, 2558, 406, 2710, 846, 2712, 2713, 841, 925, - /* 2230 */ 861, 2557, 260, 265, 2534, 2708, 2527, 267, 2747, 2366, - /* 2240 */ 2727, 2274, 399, 2710, 846, 2712, 2713, 841, 1531, 861, - /* 2250 */ 2270, 2709, 664, 665, 666, 2268, 2674, 668, 842, 2708, - /* 2260 */ 669, 2266, 2747, 672, 843, 673, 187, 2710, 846, 2712, - /* 2270 */ 2713, 841, 2263, 861, 676, 670, 674, 677, 678, 2246, - /* 2280 */ 2244, 2245, 2243, 2221, 2368, 1686, 1685, 2367, 1591, 2709, - /* 2290 */ 1590, 1589, 2727, 782, 1586, 273, 1573, 1584, 927, 1582, - /* 2300 */ 1581, 2261, 843, 2259, 2708, 1580, 1579, 2747, 2674, 2250, - /* 2310 */ 842, 405, 2710, 846, 2712, 2713, 841, 447, 861, 2709, - /* 2320 */ 2767, 448, 1578, 1575, 449, 1574, 2921, 1572, 712, 2248, - /* 2330 */ 2727, 715, 843, 468, 450, 2220, 2709, 2219, 2218, 2217, - /* 2340 */ 2216, 719, 721, 723, 2215, 725, 2674, 126, 842, 843, - /* 2350 */ 1851, 1853, 1850, 1855, 28, 2583, 2708, 67, 295, 2747, - /* 2360 */ 2727, 2579, 1822, 406, 2710, 846, 2712, 2713, 841, 56, - /* 2370 */ 861, 470, 1824, 57, 2569, 746, 2674, 2727, 842, 2556, - /* 2380 */ 2555, 2904, 20, 762, 30, 747, 17, 6, 1841, 302, - /* 2390 */ 1801, 2145, 299, 2674, 2708, 842, 1800, 2747, 752, 455, - /* 2400 */ 21, 406, 2710, 846, 2712, 2713, 841, 735, 861, 754, - /* 2410 */ 178, 2119, 1826, 2709, 764, 7, 22, 202, 214, 766, - /* 2420 */ 768, 2695, 32, 2085, 731, 215, 843, 2747, 2087, 65, - /* 2430 */ 188, 401, 2710, 846, 2712, 2713, 841, 304, 861, 2126, - /* 2440 */ 201, 2708, 31, 24, 2747, 2113, 82, 2709, 391, 2710, - /* 2450 */ 846, 2712, 2713, 841, 2727, 861, 2083, 216, 2160, 2159, - /* 2460 */ 843, 460, 2164, 2165, 2163, 461, 2166, 2067, 319, 2066, - /* 2470 */ 2674, 59, 842, 193, 2554, 2533, 2709, 104, 105, 2532, - /* 2480 */ 326, 2121, 106, 204, 332, 813, 69, 334, 2727, 843, - /* 2490 */ 58, 2526, 821, 107, 25, 13, 819, 2029, 2019, 335, - /* 2500 */ 11, 876, 2018, 23, 2674, 18, 842, 1935, 1994, 879, - /* 2510 */ 337, 1993, 882, 885, 38, 194, 1992, 2727, 2708, 16, - /* 2520 */ 26, 2747, 205, 1962, 1970, 390, 2710, 846, 2712, 2713, - /* 2530 */ 841, 845, 861, 2674, 27, 842, 2525, 108, 113, 851, - /* 2540 */ 345, 862, 2181, 70, 2180, 849, 339, 109, 2752, 2179, - /* 2550 */ 2751, 860, 2708, 868, 68, 2747, 1996, 1667, 2178, 392, - /* 2560 */ 2710, 846, 2712, 2713, 841, 486, 861, 870, 872, 1664, - /* 2570 */ 2709, 873, 875, 1663, 1660, 878, 881, 1654, 1652, 884, - /* 2580 */ 1658, 2708, 1657, 843, 2747, 369, 1656, 1655, 398, 2710, - /* 2590 */ 846, 2712, 2713, 841, 2709, 861, 114, 115, 1680, 1676, - /* 2600 */ 79, 1529, 1569, 899, 1568, 1567, 1564, 843, 1561, 2709, - /* 2610 */ 1560, 2727, 1559, 1558, 1599, 1556, 1554, 913, 1553, 1552, - /* 2620 */ 915, 1598, 843, 220, 1550, 1549, 1548, 2674, 1547, 842, - /* 2630 */ 1546, 1545, 1595, 1544, 1593, 2727, 1541, 1540, 1537, 2709, - /* 2640 */ 1536, 1535, 1534, 2269, 935, 936, 2267, 937, 939, 2265, - /* 2650 */ 2727, 2674, 843, 842, 943, 940, 941, 945, 2262, 947, - /* 2660 */ 2242, 944, 948, 949, 951, 2240, 2674, 953, 842, 1471, - /* 2670 */ 2214, 957, 1458, 373, 959, 2708, 1921, 385, 2747, 963, - /* 2680 */ 2727, 2184, 402, 2710, 846, 2712, 2713, 841, 962, 861, - /* 2690 */ 2184, 2709, 2184, 2184, 2184, 2184, 2674, 2184, 842, 2708, - /* 2700 */ 2184, 2184, 2747, 2184, 843, 2184, 393, 2710, 846, 2712, - /* 2710 */ 2713, 841, 2184, 861, 2708, 2184, 2184, 2747, 2184, 2184, - /* 2720 */ 2184, 403, 2710, 846, 2712, 2713, 841, 2709, 861, 2184, - /* 2730 */ 2184, 2184, 2727, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 2740 */ 843, 2184, 2184, 2184, 2708, 2184, 2184, 2747, 2674, 2184, - /* 2750 */ 842, 394, 2710, 846, 2712, 2713, 841, 2709, 861, 2184, - /* 2760 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2727, 2184, - /* 2770 */ 843, 2184, 2184, 2184, 2709, 2184, 2184, 2184, 2184, 2184, - /* 2780 */ 2184, 2184, 2184, 2184, 2674, 2184, 842, 843, 2184, 2184, - /* 2790 */ 2184, 2184, 2184, 2184, 2184, 2184, 2708, 2184, 2727, 2747, - /* 2800 */ 2184, 2184, 2184, 404, 2710, 846, 2712, 2713, 841, 2184, - /* 2810 */ 861, 2184, 2184, 2184, 2674, 2727, 842, 2184, 2184, 2184, - /* 2820 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 2830 */ 2184, 2674, 2708, 842, 2184, 2747, 2184, 2184, 2184, 395, - /* 2840 */ 2710, 846, 2712, 2713, 841, 2184, 861, 2184, 2184, 2184, - /* 2850 */ 2184, 2709, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 2860 */ 2184, 2184, 2708, 2184, 843, 2747, 2184, 2184, 2184, 411, - /* 2870 */ 2710, 846, 2712, 2713, 841, 2184, 861, 2184, 2184, 2708, - /* 2880 */ 2184, 2184, 2747, 2184, 2184, 2709, 412, 2710, 846, 2712, - /* 2890 */ 2713, 841, 2727, 861, 2184, 2184, 2184, 2184, 843, 2184, - /* 2900 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2674, 2184, - /* 2910 */ 842, 2184, 2184, 2184, 2709, 2184, 2184, 2184, 2184, 2184, - /* 2920 */ 2184, 2184, 2184, 2184, 2184, 2184, 2727, 843, 2184, 2184, - /* 2930 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 2940 */ 2184, 2184, 2674, 2184, 842, 2184, 2184, 2184, 2184, 2184, - /* 2950 */ 2184, 2184, 2184, 2184, 2184, 2727, 2708, 2184, 2184, 2747, - /* 2960 */ 2184, 2184, 2184, 2721, 2710, 846, 2712, 2713, 841, 2184, - /* 2970 */ 861, 2674, 2184, 842, 2184, 2709, 2184, 2184, 2184, 2184, - /* 2980 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 843, 2184, - /* 2990 */ 2708, 2184, 2184, 2747, 2184, 2184, 2184, 2720, 2710, 846, - /* 3000 */ 2712, 2713, 841, 2184, 861, 2184, 2184, 2184, 2709, 2184, - /* 3010 */ 2184, 2184, 2184, 2184, 2184, 2184, 2727, 2184, 2184, 2708, - /* 3020 */ 2184, 843, 2747, 2184, 2184, 2184, 2719, 2710, 846, 2712, - /* 3030 */ 2713, 841, 2674, 861, 842, 2184, 2184, 2184, 2184, 2184, - /* 3040 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2727, - /* 3050 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3060 */ 2184, 2184, 2184, 2184, 2184, 2674, 2184, 842, 2184, 2184, - /* 3070 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3080 */ 2708, 2184, 2184, 2747, 2184, 2709, 2184, 430, 2710, 846, - /* 3090 */ 2712, 2713, 841, 2184, 861, 2184, 2184, 2184, 843, 2184, - /* 3100 */ 2184, 2184, 2709, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3110 */ 2184, 2184, 2184, 2708, 2184, 843, 2747, 2184, 2184, 2184, - /* 3120 */ 431, 2710, 846, 2712, 2713, 841, 2727, 861, 2709, 2184, - /* 3130 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3140 */ 2184, 843, 2674, 2727, 842, 2184, 2184, 2184, 2184, 2184, - /* 3150 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2674, - /* 3160 */ 2184, 842, 2184, 2184, 2184, 2709, 2184, 2184, 2184, 2727, - /* 3170 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 843, 2184, - /* 3180 */ 2184, 2184, 2184, 2184, 2184, 2674, 2184, 842, 2184, 2184, - /* 3190 */ 2708, 2184, 2184, 2747, 2184, 2184, 2184, 427, 2710, 846, - /* 3200 */ 2712, 2713, 841, 2184, 861, 2184, 2727, 2708, 2184, 2184, - /* 3210 */ 2747, 2184, 2184, 2184, 432, 2710, 846, 2712, 2713, 841, - /* 3220 */ 2184, 861, 2674, 2184, 842, 2184, 2184, 2184, 2184, 2184, - /* 3230 */ 2184, 2184, 2184, 844, 2184, 2184, 2747, 2184, 2184, 2184, - /* 3240 */ 401, 2710, 846, 2712, 2713, 841, 2184, 861, 2184, 2184, - /* 3250 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3260 */ 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, 2184, - /* 3270 */ 2708, 2184, 2184, 2747, 2184, 2184, 2184, 400, 2710, 846, - /* 3280 */ 2712, 2713, 841, 2184, 861, + /* 370 */ 1978, 963, 440, 288, 15, 900, 172, 171, 897, 896, + /* 380 */ 895, 169, 98, 555, 868, 867, 866, 36, 469, 2032, + /* 390 */ 2033, 2034, 2035, 2036, 2040, 2041, 2042, 2043, 322, 92, + /* 400 */ 40, 39, 91, 660, 46, 44, 43, 42, 41, 2385, + /* 410 */ 2010, 2011, 1949, 2523, 2502, 739, 596, 595, 594, 593, + /* 420 */ 592, 587, 586, 585, 584, 423, 651, 2582, 322, 574, + /* 430 */ 573, 572, 571, 570, 564, 563, 562, 50, 557, 556, + /* 440 */ 438, 2074, 2373, 418, 548, 1754, 1755, 101, 181, 1981, + /* 450 */ 1991, 1773, 426, 390, 1945, 453, 62, 730, 136, 2009, + /* 460 */ 2012, 135, 134, 133, 132, 131, 130, 129, 128, 127, + /* 470 */ 90, 388, 76, 728, 1921, 75, 1919, 2822, 2071, 2072, + /* 480 */ 2073, 2822, 2822, 2822, 2822, 2822, 417, 828, 726, 2774, + /* 490 */ 724, 722, 286, 285, 1930, 2710, 1949, 210, 250, 623, + /* 500 */ 621, 618, 616, 2076, 2077, 2078, 2079, 2080, 807, 197, + /* 510 */ 1924, 1925, 1978, 2436, 1980, 1983, 1984, 1985, 1986, 1987, + /* 520 */ 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, 2006, + /* 530 */ 2007, 2, 12, 47, 45, 1946, 2728, 2517, 1920, 2208, + /* 540 */ 1945, 471, 544, 1920, 62, 46, 44, 43, 42, 41, + /* 550 */ 1654, 322, 2675, 1918, 844, 535, 2008, 534, 1918, 521, + /* 560 */ 2485, 2071, 2072, 2073, 1645, 892, 891, 890, 1649, 889, + /* 570 */ 1651, 1652, 888, 885, 2710, 1660, 882, 1662, 1663, 879, + /* 580 */ 876, 873, 63, 213, 2543, 474, 2132, 845, 2003, 533, + /* 590 */ 835, 606, 604, 179, 411, 19, 2675, 1926, 230, 473, + /* 600 */ 2709, 834, 1926, 2748, 2394, 2540, 849, 119, 2711, 848, + /* 610 */ 2713, 2714, 843, 1946, 863, 2728, 445, 444, 691, 199, + /* 620 */ 322, 2802, 690, 1766, 1767, 467, 2798, 963, 559, 2512, + /* 630 */ 180, 2675, 963, 844, 62, 15, 86, 85, 540, 322, + /* 640 */ 2392, 229, 2669, 2817, 1950, 774, 773, 2130, 2131, 2133, + /* 650 */ 2134, 2135, 902, 2850, 532, 530, 40, 39, 859, 2389, + /* 660 */ 46, 44, 43, 42, 41, 1793, 1794, 414, 12, 2814, + /* 670 */ 519, 2010, 2011, 515, 511, 507, 504, 533, 146, 2709, + /* 680 */ 491, 234, 2748, 2442, 2444, 692, 119, 2711, 848, 2713, + /* 690 */ 2714, 843, 2905, 863, 443, 442, 525, 689, 2777, 1502, + /* 700 */ 2802, 1501, 859, 2389, 467, 2798, 476, 117, 2468, 1948, + /* 710 */ 1981, 1991, 2103, 1482, 1792, 1795, 1945, 863, 1945, 691, + /* 720 */ 2009, 2012, 55, 690, 158, 527, 523, 322, 1950, 581, + /* 730 */ 1921, 1654, 1919, 2381, 580, 1921, 1503, 1919, 1480, 1481, + /* 740 */ 600, 2685, 579, 1693, 1694, 1645, 892, 891, 890, 1649, + /* 750 */ 889, 1651, 1652, 839, 838, 2710, 1660, 837, 1662, 1663, + /* 760 */ 836, 876, 873, 2143, 1949, 757, 1924, 1925, 845, 2689, + /* 770 */ 2240, 1924, 1925, 1978, 377, 1980, 1983, 1984, 1985, 1986, + /* 780 */ 1987, 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, + /* 790 */ 2006, 2007, 2, 47, 45, 2013, 2728, 482, 2710, 590, + /* 800 */ 2512, 471, 148, 1920, 2167, 916, 241, 485, 43, 42, + /* 810 */ 41, 845, 2675, 2857, 844, 88, 2008, 322, 1918, 2365, + /* 820 */ 2691, 2694, 40, 39, 1926, 2710, 46, 44, 43, 42, + /* 830 */ 41, 863, 599, 240, 715, 1949, 2591, 2018, 845, 2728, + /* 840 */ 2870, 638, 830, 1945, 2774, 2207, 597, 2206, 2003, 729, + /* 850 */ 636, 2817, 239, 632, 628, 2675, 2363, 844, 859, 2389, + /* 860 */ 2709, 919, 1926, 2748, 2349, 287, 2728, 119, 2711, 848, + /* 870 */ 2713, 2714, 843, 918, 863, 583, 582, 2813, 541, 2920, + /* 880 */ 320, 2802, 2675, 718, 844, 467, 2798, 1982, 859, 2389, + /* 890 */ 712, 710, 963, 2685, 254, 48, 893, 284, 644, 2449, + /* 900 */ 2238, 2449, 2675, 2709, 2675, 60, 2748, 475, 542, 490, + /* 910 */ 119, 2711, 848, 2713, 2714, 843, 755, 863, 2447, 1484, + /* 920 */ 2447, 2689, 2920, 1948, 2802, 1944, 492, 2039, 467, 2798, + /* 930 */ 2709, 2010, 2011, 2748, 179, 208, 2629, 119, 2711, 848, + /* 940 */ 2713, 2714, 843, 72, 863, 2394, 71, 742, 1979, 2920, + /* 950 */ 1979, 2802, 1945, 40, 39, 467, 2798, 46, 44, 43, + /* 960 */ 42, 41, 900, 172, 171, 897, 896, 895, 169, 2710, + /* 970 */ 1981, 1991, 2691, 2693, 468, 2378, 1889, 2205, 29, 1593, + /* 980 */ 2009, 2012, 845, 863, 769, 2096, 1888, 859, 2389, 2364, + /* 990 */ 758, 859, 2389, 859, 2389, 1921, 1950, 1919, 2900, 900, + /* 1000 */ 172, 171, 897, 896, 895, 169, 212, 561, 481, 480, + /* 1010 */ 2728, 575, 1982, 576, 34, 2184, 2906, 217, 484, 483, + /* 1020 */ 2174, 2901, 793, 1595, 2044, 2596, 2675, 372, 844, 744, + /* 1030 */ 2582, 1924, 1925, 1978, 2675, 1980, 1983, 1984, 1985, 1986, + /* 1040 */ 1987, 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, + /* 1050 */ 2006, 2007, 2, 47, 45, 2710, 2443, 2444, 2204, 1588, + /* 1060 */ 2144, 471, 902, 1920, 1505, 1506, 156, 1950, 845, 2773, + /* 1070 */ 2893, 2904, 859, 2389, 2709, 1979, 2008, 2748, 1918, 2261, + /* 1080 */ 290, 119, 2711, 848, 2713, 2714, 843, 291, 863, 859, + /* 1090 */ 2389, 2710, 577, 2920, 320, 2802, 2728, 14, 13, 467, + /* 1100 */ 2798, 709, 502, 1589, 845, 2203, 2834, 501, 2003, 663, + /* 1110 */ 859, 2389, 2675, 1605, 844, 2675, 708, 707, 706, 859, + /* 1120 */ 2389, 1982, 1926, 698, 152, 702, 329, 330, 1604, 701, + /* 1130 */ 2386, 328, 2728, 2817, 700, 705, 448, 447, 2173, 292, + /* 1140 */ 699, 859, 2389, 2202, 446, 695, 694, 693, 2675, 2199, + /* 1150 */ 844, 786, 963, 859, 2389, 48, 758, 2201, 735, 2812, + /* 1160 */ 2709, 300, 2675, 2748, 2900, 1847, 1848, 119, 2711, 848, + /* 1170 */ 2713, 2714, 843, 810, 863, 859, 2389, 859, 2389, 2920, + /* 1180 */ 2200, 2802, 2906, 217, 1979, 467, 2798, 2901, 793, 859, + /* 1190 */ 2389, 2010, 2011, 859, 2389, 333, 2709, 824, 102, 2748, + /* 1200 */ 2675, 1609, 611, 119, 2711, 848, 2713, 2714, 843, 340, + /* 1210 */ 863, 2051, 758, 856, 2675, 2920, 1608, 2802, 2197, 2085, + /* 1220 */ 2900, 467, 2798, 421, 420, 859, 2389, 859, 2389, 2710, + /* 1230 */ 1981, 1991, 1821, 477, 859, 2389, 211, 2675, 2906, 217, + /* 1240 */ 2009, 2012, 845, 2901, 793, 857, 2008, 368, 486, 2376, + /* 1250 */ 683, 682, 685, 684, 493, 1921, 2615, 1919, 111, 2196, + /* 1260 */ 2449, 2195, 2194, 2193, 704, 703, 2449, 2192, 2191, 2190, + /* 1270 */ 2728, 2189, 930, 928, 170, 2675, 2710, 537, 2003, 811, + /* 1280 */ 2095, 2324, 536, 179, 2382, 819, 2675, 2619, 844, 845, + /* 1290 */ 613, 1924, 1925, 1978, 2395, 1980, 1983, 1984, 1985, 1986, + /* 1300 */ 1987, 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, + /* 1310 */ 2006, 2007, 2, 47, 45, 78, 2675, 2728, 2675, 2675, + /* 1320 */ 2675, 471, 2495, 1920, 2675, 2675, 2675, 894, 2675, 796, + /* 1330 */ 2440, 758, 2449, 2675, 2709, 844, 2008, 2748, 1918, 2900, + /* 1340 */ 509, 119, 2711, 848, 2713, 2714, 843, 384, 863, 743, + /* 1350 */ 2426, 2448, 2366, 2775, 2259, 2802, 54, 2906, 217, 467, + /* 1360 */ 2798, 898, 2901, 793, 2440, 551, 40, 39, 2003, 89, + /* 1370 */ 46, 44, 43, 42, 41, 899, 711, 808, 2440, 2214, + /* 1380 */ 958, 2709, 1926, 277, 2748, 161, 275, 795, 119, 2711, + /* 1390 */ 848, 2713, 2714, 843, 279, 863, 281, 278, 283, 280, + /* 1400 */ 829, 282, 2802, 758, 696, 162, 467, 2798, 697, 799, + /* 1410 */ 35, 2900, 963, 2710, 2250, 15, 40, 39, 2248, 376, + /* 1420 */ 46, 44, 43, 42, 41, 1911, 845, 1887, 1586, 2906, + /* 1430 */ 217, 758, 1584, 301, 2901, 793, 713, 162, 765, 2900, + /* 1440 */ 716, 732, 49, 731, 2176, 2177, 14, 13, 833, 49, + /* 1450 */ 2696, 2010, 2011, 297, 2728, 200, 170, 2906, 217, 479, + /* 1460 */ 478, 1912, 2901, 793, 327, 77, 64, 49, 49, 383, + /* 1470 */ 2675, 2393, 844, 2115, 1929, 861, 860, 2002, 2004, 2005, + /* 1480 */ 2006, 2007, 103, 347, 346, 349, 348, 1837, 351, 350, + /* 1490 */ 1981, 1991, 77, 167, 170, 353, 352, 190, 207, 316, + /* 1500 */ 2009, 2012, 2274, 355, 354, 357, 356, 359, 358, 361, + /* 1510 */ 360, 363, 362, 2863, 2698, 1921, 775, 1919, 2709, 1845, + /* 1520 */ 2119, 2748, 365, 364, 2129, 120, 2711, 848, 2713, 2714, + /* 1530 */ 843, 2128, 863, 367, 366, 308, 74, 306, 809, 2802, + /* 1540 */ 805, 871, 1928, 2801, 2798, 168, 331, 816, 2045, 1992, + /* 1550 */ 1790, 1924, 1925, 1978, 150, 1980, 1983, 1984, 1985, 1986, + /* 1560 */ 1987, 1988, 1989, 1990, 840, 861, 860, 2002, 2004, 2005, + /* 1570 */ 2006, 2007, 2, 170, 1780, 343, 1636, 149, 936, 935, + /* 1580 */ 934, 933, 499, 167, 932, 931, 160, 926, 925, 924, + /* 1590 */ 923, 922, 921, 920, 159, 914, 913, 912, 498, 497, + /* 1600 */ 909, 908, 907, 196, 195, 906, 494, 905, 904, 903, + /* 1610 */ 740, 2729, 1566, 910, 911, 2242, 1539, 797, 382, 2316, + /* 1620 */ 116, 2315, 2710, 1667, 2029, 2521, 2231, 1675, 966, 113, + /* 1630 */ 2853, 772, 456, 460, 779, 845, 813, 1558, 1556, 500, + /* 1640 */ 518, 2237, 2522, 2437, 374, 751, 2854, 2864, 787, 788, + /* 1650 */ 318, 2710, 313, 1932, 321, 1682, 1567, 2350, 503, 1680, + /* 1660 */ 1540, 956, 206, 2728, 845, 173, 508, 5, 435, 954, + /* 1670 */ 1943, 952, 948, 944, 940, 517, 371, 1953, 529, 2675, + /* 1680 */ 528, 844, 224, 225, 531, 227, 1814, 375, 1944, 545, + /* 1690 */ 238, 552, 2728, 554, 565, 558, 560, 602, 578, 800, + /* 1700 */ 589, 2514, 598, 591, 601, 603, 614, 612, 2675, 615, + /* 1710 */ 844, 244, 243, 617, 619, 620, 247, 622, 624, 1951, + /* 1720 */ 639, 1931, 118, 4, 647, 344, 640, 2709, 650, 648, + /* 1730 */ 2748, 255, 94, 1946, 120, 2711, 848, 2713, 2714, 843, + /* 1740 */ 2277, 863, 652, 258, 1952, 653, 1954, 261, 2802, 2710, + /* 1750 */ 656, 654, 831, 2798, 263, 1955, 846, 820, 95, 2748, + /* 1760 */ 96, 1956, 842, 120, 2711, 848, 2713, 2714, 843, 2531, + /* 1770 */ 863, 2537, 97, 2710, 665, 686, 270, 2802, 124, 719, + /* 1780 */ 720, 430, 2798, 688, 2379, 274, 845, 409, 734, 2375, + /* 1790 */ 2728, 276, 2605, 736, 175, 100, 378, 2602, 121, 2377, + /* 1800 */ 2372, 176, 342, 1947, 826, 177, 2675, 325, 844, 293, + /* 1810 */ 163, 2583, 324, 746, 2728, 745, 708, 707, 706, 296, + /* 1820 */ 2601, 747, 753, 698, 152, 702, 750, 298, 776, 701, + /* 1830 */ 2675, 294, 844, 2869, 700, 705, 448, 447, 762, 814, + /* 1840 */ 699, 8, 2710, 785, 446, 695, 694, 693, 2841, 2868, + /* 1850 */ 752, 763, 303, 307, 2709, 845, 305, 2748, 761, 2710, + /* 1860 */ 309, 406, 2711, 848, 2713, 2714, 843, 841, 863, 827, + /* 1870 */ 2767, 760, 845, 790, 311, 189, 310, 312, 2709, 789, + /* 1880 */ 461, 2748, 2923, 2728, 314, 184, 2711, 848, 2713, 2714, + /* 1890 */ 843, 801, 863, 2899, 798, 1948, 317, 154, 2818, 2675, + /* 1900 */ 2728, 844, 2093, 812, 2091, 2821, 323, 203, 272, 379, + /* 1910 */ 164, 380, 2551, 817, 2550, 2549, 2675, 1, 844, 219, + /* 1920 */ 818, 465, 165, 822, 61, 336, 191, 852, 2783, 850, + /* 1930 */ 341, 825, 759, 2860, 854, 681, 677, 673, 669, 2710, + /* 1940 */ 271, 381, 110, 855, 2390, 112, 1458, 2709, 865, 957, + /* 1950 */ 2748, 2667, 845, 2666, 187, 2711, 848, 2713, 2714, 843, + /* 1960 */ 370, 863, 960, 962, 2709, 2662, 2661, 2748, 385, 174, + /* 1970 */ 2627, 120, 2711, 848, 2713, 2714, 843, 410, 863, 2653, + /* 1980 */ 2728, 389, 2652, 2644, 2643, 2802, 99, 52, 2626, 269, + /* 1990 */ 2799, 2659, 387, 2658, 2650, 2649, 2675, 2638, 844, 2637, + /* 2000 */ 2656, 2655, 2647, 2646, 2635, 2634, 397, 427, 2632, 2631, + /* 2010 */ 2441, 419, 422, 794, 2921, 2625, 2620, 408, 738, 398, + /* 2020 */ 83, 505, 506, 1871, 1872, 510, 222, 2618, 512, 513, + /* 2030 */ 514, 1870, 2710, 436, 2614, 520, 2613, 522, 2612, 524, + /* 2040 */ 428, 2617, 2616, 2611, 2709, 845, 526, 2748, 1858, 2587, + /* 2050 */ 226, 184, 2711, 848, 2713, 2714, 843, 257, 863, 2586, + /* 2060 */ 228, 1817, 84, 1816, 2564, 2563, 268, 538, 539, 2561, + /* 2070 */ 259, 266, 2562, 2728, 2560, 2504, 264, 655, 543, 1753, + /* 2080 */ 2501, 546, 2500, 2494, 549, 550, 2491, 231, 2490, 2675, + /* 2090 */ 2489, 844, 87, 2488, 2493, 256, 235, 566, 233, 2861, + /* 2100 */ 2492, 2487, 2486, 2484, 2483, 2482, 2481, 568, 2479, 2478, + /* 2110 */ 2477, 2710, 2476, 2475, 458, 2499, 2474, 2473, 2472, 2497, + /* 2120 */ 2480, 2471, 2470, 2469, 845, 2467, 2466, 2465, 2464, 2463, + /* 2130 */ 2710, 2462, 2461, 93, 237, 2460, 2459, 2709, 2458, 2457, + /* 2140 */ 2748, 2529, 2498, 845, 407, 2711, 848, 2713, 2714, 843, + /* 2150 */ 2496, 863, 2728, 2456, 2710, 2455, 1759, 2454, 242, 2453, + /* 2160 */ 605, 2452, 2451, 607, 2450, 1606, 1610, 845, 2675, 2281, + /* 2170 */ 844, 2728, 2280, 2279, 245, 424, 2278, 1602, 246, 2276, + /* 2180 */ 2273, 425, 625, 2272, 2265, 2252, 629, 2675, 2226, 844, + /* 2190 */ 627, 633, 251, 459, 631, 2728, 1483, 2225, 2585, 2710, + /* 2200 */ 248, 626, 637, 635, 249, 630, 80, 198, 2695, 634, + /* 2210 */ 253, 2675, 842, 844, 81, 2581, 2709, 209, 645, 2748, + /* 2220 */ 2571, 2559, 2558, 407, 2711, 848, 2713, 2714, 843, 260, + /* 2230 */ 863, 262, 2535, 2528, 2367, 2709, 2275, 265, 2748, 267, + /* 2240 */ 2728, 2271, 400, 2711, 848, 2713, 2714, 843, 666, 863, + /* 2250 */ 1532, 2710, 667, 668, 2269, 670, 2675, 671, 844, 2709, + /* 2260 */ 672, 2267, 2748, 674, 845, 675, 187, 2711, 848, 2713, + /* 2270 */ 2714, 843, 2264, 863, 676, 678, 679, 2247, 680, 2245, + /* 2280 */ 2246, 2244, 2222, 2369, 1687, 1686, 2368, 1592, 1591, 2710, + /* 2290 */ 273, 2262, 2728, 784, 1590, 1587, 1574, 1585, 2260, 73, + /* 2300 */ 927, 1583, 845, 1582, 2709, 1581, 1580, 2748, 2675, 929, + /* 2310 */ 844, 406, 2711, 848, 2713, 2714, 843, 449, 863, 2710, + /* 2320 */ 2768, 1579, 1576, 450, 1575, 1573, 2922, 2251, 451, 2249, + /* 2330 */ 2728, 452, 845, 470, 717, 2221, 2710, 2220, 2219, 721, + /* 2340 */ 2218, 723, 2217, 2216, 714, 725, 2675, 727, 844, 845, + /* 2350 */ 126, 1852, 1854, 1851, 1856, 2584, 2709, 28, 67, 2748, + /* 2360 */ 2728, 2580, 295, 407, 2711, 848, 2713, 2714, 843, 56, + /* 2370 */ 863, 472, 1825, 1823, 2570, 748, 2675, 2728, 844, 2557, + /* 2380 */ 2556, 2905, 20, 57, 30, 302, 749, 1802, 2146, 764, + /* 2390 */ 2120, 1801, 766, 2675, 2709, 844, 457, 2748, 299, 17, + /* 2400 */ 770, 407, 2711, 848, 2713, 2714, 843, 737, 863, 754, + /* 2410 */ 756, 178, 768, 2710, 1827, 6, 7, 21, 1842, 22, + /* 2420 */ 304, 202, 2127, 214, 733, 2114, 845, 2748, 32, 2086, + /* 2430 */ 215, 402, 2711, 848, 2713, 2714, 843, 188, 863, 2696, + /* 2440 */ 201, 2709, 31, 2088, 2748, 82, 216, 2710, 392, 2711, + /* 2450 */ 848, 2713, 2714, 843, 2728, 863, 2084, 65, 24, 2166, + /* 2460 */ 845, 2167, 319, 2161, 2160, 462, 2165, 2164, 463, 2068, + /* 2470 */ 2675, 2067, 844, 59, 193, 2555, 2710, 2534, 105, 2533, + /* 2480 */ 104, 106, 326, 2122, 204, 332, 815, 2527, 2728, 845, + /* 2490 */ 69, 334, 58, 823, 107, 25, 821, 335, 11, 2020, + /* 2500 */ 13, 847, 2019, 1936, 2675, 23, 844, 18, 1995, 194, + /* 2510 */ 337, 1994, 2030, 878, 881, 884, 887, 2728, 2709, 38, + /* 2520 */ 205, 2748, 1993, 16, 26, 391, 2711, 848, 2713, 2714, + /* 2530 */ 843, 1963, 863, 2675, 1971, 844, 27, 70, 2526, 853, + /* 2540 */ 108, 113, 345, 864, 2182, 2181, 2180, 851, 339, 2179, + /* 2550 */ 109, 2753, 2709, 2752, 870, 2748, 1997, 862, 68, 393, + /* 2560 */ 2711, 848, 2713, 2714, 843, 1668, 863, 488, 1665, 872, + /* 2570 */ 2710, 875, 874, 1664, 877, 1661, 880, 883, 1655, 1653, + /* 2580 */ 886, 2709, 1659, 845, 2748, 369, 114, 1658, 399, 2711, + /* 2590 */ 848, 2713, 2714, 843, 2710, 863, 1657, 115, 1681, 79, + /* 2600 */ 1656, 1677, 1530, 901, 1570, 1569, 1568, 845, 1565, 2710, + /* 2610 */ 1562, 2728, 1561, 1560, 1559, 1557, 915, 1555, 1554, 917, + /* 2620 */ 1553, 220, 845, 1600, 1551, 1599, 1550, 2675, 1549, 844, + /* 2630 */ 1548, 1547, 1596, 1546, 1545, 2728, 1594, 1542, 1541, 2710, + /* 2640 */ 1538, 1537, 1536, 1535, 2270, 938, 937, 2268, 939, 941, + /* 2650 */ 2728, 2675, 845, 844, 943, 942, 2266, 947, 945, 2263, + /* 2660 */ 946, 949, 951, 950, 2243, 2241, 2675, 953, 844, 1472, + /* 2670 */ 955, 2215, 1459, 959, 373, 2709, 961, 2185, 2748, 1922, + /* 2680 */ 2728, 964, 403, 2711, 848, 2713, 2714, 843, 386, 863, + /* 2690 */ 965, 2710, 2185, 2185, 2185, 2185, 2675, 2185, 844, 2709, + /* 2700 */ 2185, 2185, 2748, 2185, 845, 2185, 394, 2711, 848, 2713, + /* 2710 */ 2714, 843, 2185, 863, 2709, 2185, 2185, 2748, 2185, 2185, + /* 2720 */ 2185, 404, 2711, 848, 2713, 2714, 843, 2710, 863, 2185, + /* 2730 */ 2185, 2185, 2728, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 2740 */ 845, 2185, 2185, 2185, 2709, 2185, 2185, 2748, 2675, 2185, + /* 2750 */ 844, 395, 2711, 848, 2713, 2714, 843, 2710, 863, 2185, + /* 2760 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2728, 2185, + /* 2770 */ 845, 2185, 2185, 2185, 2710, 2185, 2185, 2185, 2185, 2185, + /* 2780 */ 2185, 2185, 2185, 2185, 2675, 2185, 844, 845, 2185, 2185, + /* 2790 */ 2185, 2185, 2185, 2185, 2185, 2185, 2709, 2185, 2728, 2748, + /* 2800 */ 2185, 2185, 2185, 405, 2711, 848, 2713, 2714, 843, 2185, + /* 2810 */ 863, 2185, 2185, 2185, 2675, 2728, 844, 2185, 2185, 2185, + /* 2820 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 2830 */ 2185, 2675, 2709, 844, 2185, 2748, 2185, 2185, 2185, 396, + /* 2840 */ 2711, 848, 2713, 2714, 843, 2185, 863, 2185, 2185, 2185, + /* 2850 */ 2185, 2710, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 2860 */ 2185, 2185, 2709, 2185, 845, 2748, 2185, 2185, 2185, 412, + /* 2870 */ 2711, 848, 2713, 2714, 843, 2185, 863, 2185, 2185, 2709, + /* 2880 */ 2185, 2185, 2748, 2185, 2185, 2710, 413, 2711, 848, 2713, + /* 2890 */ 2714, 843, 2728, 863, 2185, 2185, 2185, 2185, 845, 2185, + /* 2900 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2675, 2185, + /* 2910 */ 844, 2185, 2185, 2185, 2710, 2185, 2185, 2185, 2185, 2185, + /* 2920 */ 2185, 2185, 2185, 2185, 2185, 2185, 2728, 845, 2185, 2185, + /* 2930 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 2940 */ 2185, 2185, 2675, 2185, 844, 2185, 2185, 2185, 2185, 2185, + /* 2950 */ 2185, 2185, 2185, 2185, 2185, 2728, 2709, 2185, 2185, 2748, + /* 2960 */ 2185, 2185, 2185, 2722, 2711, 848, 2713, 2714, 843, 2185, + /* 2970 */ 863, 2675, 2185, 844, 2185, 2710, 2185, 2185, 2185, 2185, + /* 2980 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 845, 2185, + /* 2990 */ 2709, 2185, 2185, 2748, 2185, 2185, 2185, 2721, 2711, 848, + /* 3000 */ 2713, 2714, 843, 2185, 863, 2185, 2185, 2185, 2710, 2185, + /* 3010 */ 2185, 2185, 2185, 2185, 2185, 2185, 2728, 2185, 2185, 2709, + /* 3020 */ 2185, 845, 2748, 2185, 2185, 2185, 2720, 2711, 848, 2713, + /* 3030 */ 2714, 843, 2675, 863, 844, 2185, 2185, 2185, 2185, 2185, + /* 3040 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2728, + /* 3050 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3060 */ 2185, 2185, 2185, 2185, 2185, 2675, 2185, 844, 2185, 2185, + /* 3070 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3080 */ 2709, 2185, 2185, 2748, 2185, 2710, 2185, 432, 2711, 848, + /* 3090 */ 2713, 2714, 843, 2185, 863, 2185, 2185, 2185, 845, 2185, + /* 3100 */ 2185, 2185, 2710, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3110 */ 2185, 2185, 2185, 2709, 2185, 845, 2748, 2185, 2185, 2185, + /* 3120 */ 433, 2711, 848, 2713, 2714, 843, 2728, 863, 2710, 2185, + /* 3130 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3140 */ 2185, 845, 2675, 2728, 844, 2185, 2185, 2185, 2185, 2185, + /* 3150 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2675, + /* 3160 */ 2185, 844, 2185, 2185, 2185, 2710, 2185, 2185, 2185, 2728, + /* 3170 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 845, 2185, + /* 3180 */ 2185, 2185, 2185, 2185, 2185, 2675, 2185, 844, 2185, 2185, + /* 3190 */ 2709, 2185, 2185, 2748, 2185, 2185, 2185, 429, 2711, 848, + /* 3200 */ 2713, 2714, 843, 2185, 863, 2185, 2728, 2709, 2185, 2185, + /* 3210 */ 2748, 2185, 2185, 2185, 434, 2711, 848, 2713, 2714, 843, + /* 3220 */ 2185, 863, 2675, 2185, 844, 2185, 2185, 2185, 2185, 2185, + /* 3230 */ 2185, 2185, 2185, 846, 2185, 2185, 2748, 2185, 2185, 2185, + /* 3240 */ 402, 2711, 848, 2713, 2714, 843, 2185, 863, 2185, 2185, + /* 3250 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3260 */ 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, 2185, + /* 3270 */ 2709, 2185, 2185, 2748, 2185, 2185, 2185, 401, 2711, 848, + /* 3280 */ 2713, 2714, 843, 2185, 863, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 518, 507, 508, 439, 520, 424, 522, 518, 526, 392, @@ -751,79 +751,79 @@ static const YYCODETYPE yy_lookahead[] = { /* 1940 */ 67, 417, 399, 451, 393, 114, 22, 485, 426, 38, /* 1950 */ 488, 437, 393, 437, 492, 493, 494, 495, 496, 497, /* 1960 */ 399, 499, 382, 385, 485, 437, 437, 488, 392, 386, - /* 1970 */ 378, 492, 493, 494, 495, 496, 497, 477, 499, 437, - /* 1980 */ 421, 0, 437, 437, 437, 506, 113, 468, 400, 116, - /* 1990 */ 511, 437, 0, 437, 437, 437, 437, 437, 439, 437, + /* 1970 */ 0, 492, 493, 494, 495, 496, 497, 477, 499, 437, + /* 1980 */ 421, 378, 437, 437, 437, 506, 113, 468, 0, 116, + /* 1990 */ 511, 437, 400, 437, 437, 437, 437, 437, 439, 437, /* 2000 */ 437, 437, 437, 437, 437, 437, 415, 459, 437, 437, - /* 2010 */ 437, 484, 423, 551, 552, 0, 46, 415, 415, 0, - /* 2020 */ 37, 241, 37, 37, 37, 241, 0, 37, 37, 241, - /* 2030 */ 37, 0, 380, 241, 0, 37, 0, 37, 0, 22, - /* 2040 */ 459, 0, 0, 37, 485, 393, 0, 488, 236, 222, - /* 2050 */ 0, 492, 493, 494, 495, 496, 497, 184, 499, 222, - /* 2060 */ 216, 223, 214, 0, 0, 0, 193, 210, 209, 0, - /* 2070 */ 197, 198, 0, 421, 155, 50, 203, 204, 50, 0, - /* 2080 */ 37, 0, 0, 53, 37, 0, 0, 50, 0, 437, - /* 2090 */ 46, 439, 0, 0, 0, 222, 174, 37, 50, 540, - /* 2100 */ 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, + /* 2010 */ 437, 423, 423, 551, 552, 0, 0, 415, 484, 415, + /* 2020 */ 46, 37, 241, 37, 37, 241, 37, 0, 37, 37, + /* 2030 */ 241, 37, 380, 241, 0, 37, 0, 37, 0, 22, + /* 2040 */ 459, 0, 0, 0, 485, 393, 37, 488, 236, 0, + /* 2050 */ 222, 492, 493, 494, 495, 496, 497, 184, 499, 0, + /* 2060 */ 222, 216, 223, 214, 0, 0, 193, 210, 209, 0, + /* 2070 */ 197, 198, 0, 421, 0, 155, 203, 204, 50, 50, + /* 2080 */ 0, 37, 0, 0, 37, 53, 0, 50, 0, 437, + /* 2090 */ 0, 439, 46, 0, 0, 222, 174, 37, 50, 540, + /* 2100 */ 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, /* 2110 */ 0, 380, 0, 0, 462, 0, 0, 0, 0, 0, /* 2120 */ 0, 0, 0, 0, 393, 0, 0, 0, 0, 0, - /* 2130 */ 380, 0, 0, 50, 0, 46, 0, 485, 0, 0, + /* 2130 */ 380, 0, 0, 46, 50, 0, 0, 485, 0, 0, /* 2140 */ 488, 0, 0, 393, 492, 493, 494, 495, 496, 497, - /* 2150 */ 0, 499, 421, 0, 380, 22, 0, 155, 0, 154, - /* 2160 */ 0, 153, 0, 0, 0, 22, 22, 393, 437, 0, - /* 2170 */ 439, 421, 37, 67, 0, 51, 0, 0, 67, 0, - /* 2180 */ 0, 51, 37, 37, 0, 0, 0, 437, 0, 439, - /* 2190 */ 122, 43, 37, 462, 43, 421, 37, 43, 0, 380, - /* 2200 */ 53, 33, 53, 46, 67, 53, 14, 67, 43, 0, - /* 2210 */ 44, 437, 393, 439, 205, 43, 485, 50, 0, 488, - /* 2220 */ 50, 50, 0, 492, 493, 494, 495, 496, 497, 33, - /* 2230 */ 499, 0, 43, 50, 0, 485, 0, 50, 488, 0, - /* 2240 */ 421, 0, 492, 493, 494, 495, 496, 497, 75, 499, - /* 2250 */ 0, 380, 37, 53, 43, 0, 437, 37, 439, 485, - /* 2260 */ 53, 0, 488, 37, 393, 53, 492, 493, 494, 495, - /* 2270 */ 496, 497, 0, 499, 37, 43, 43, 53, 43, 0, - /* 2280 */ 0, 0, 0, 0, 0, 37, 22, 0, 22, 380, - /* 2290 */ 37, 37, 421, 543, 37, 120, 22, 37, 33, 37, - /* 2300 */ 37, 0, 393, 0, 485, 37, 37, 488, 437, 0, + /* 2150 */ 0, 499, 421, 0, 380, 0, 22, 0, 155, 0, + /* 2160 */ 154, 0, 0, 153, 0, 22, 22, 393, 437, 0, + /* 2170 */ 439, 421, 0, 0, 67, 51, 0, 37, 67, 0, + /* 2180 */ 0, 51, 37, 0, 0, 0, 37, 437, 0, 439, + /* 2190 */ 43, 37, 46, 462, 43, 421, 14, 0, 0, 380, + /* 2200 */ 67, 53, 37, 43, 67, 53, 43, 33, 50, 53, + /* 2210 */ 44, 437, 393, 439, 43, 0, 485, 50, 50, 488, + /* 2220 */ 0, 0, 0, 492, 493, 494, 495, 496, 497, 43, + /* 2230 */ 499, 205, 0, 0, 0, 485, 0, 50, 488, 50, + /* 2240 */ 421, 0, 492, 493, 494, 495, 496, 497, 37, 499, + /* 2250 */ 75, 380, 53, 43, 0, 37, 437, 53, 439, 485, + /* 2260 */ 43, 0, 488, 37, 393, 53, 492, 493, 494, 495, + /* 2270 */ 496, 497, 0, 499, 43, 37, 53, 0, 43, 0, + /* 2280 */ 0, 0, 0, 0, 37, 22, 0, 22, 37, 380, + /* 2290 */ 120, 0, 421, 543, 37, 37, 22, 37, 0, 122, + /* 2300 */ 33, 37, 393, 37, 485, 37, 37, 488, 437, 33, /* 2310 */ 439, 492, 493, 494, 495, 496, 497, 22, 499, 380, - /* 2320 */ 501, 22, 37, 37, 22, 37, 552, 37, 55, 0, - /* 2330 */ 421, 37, 393, 462, 22, 0, 380, 0, 0, 0, - /* 2340 */ 0, 37, 37, 37, 0, 22, 437, 20, 439, 393, - /* 2350 */ 37, 37, 37, 115, 114, 0, 485, 114, 50, 488, - /* 2360 */ 421, 0, 37, 492, 493, 494, 495, 496, 497, 191, - /* 2370 */ 499, 462, 22, 191, 0, 22, 437, 421, 439, 0, - /* 2380 */ 0, 3, 33, 37, 114, 191, 302, 51, 227, 114, - /* 2390 */ 191, 115, 197, 437, 485, 439, 191, 488, 201, 37, - /* 2400 */ 33, 492, 493, 494, 495, 496, 497, 226, 499, 201, - /* 2410 */ 217, 115, 221, 380, 114, 51, 33, 33, 50, 112, - /* 2420 */ 110, 50, 33, 81, 485, 33, 393, 488, 37, 3, - /* 2430 */ 114, 492, 493, 494, 495, 496, 497, 115, 499, 115, - /* 2440 */ 114, 485, 114, 33, 488, 115, 114, 380, 492, 493, - /* 2450 */ 494, 495, 496, 497, 421, 499, 115, 114, 37, 37, - /* 2460 */ 393, 37, 37, 115, 37, 37, 115, 115, 50, 115, - /* 2470 */ 437, 33, 439, 50, 0, 0, 380, 114, 43, 0, - /* 2480 */ 115, 115, 43, 114, 114, 194, 114, 198, 421, 393, - /* 2490 */ 286, 0, 194, 43, 33, 2, 115, 250, 112, 114, - /* 2500 */ 273, 114, 112, 302, 437, 302, 439, 22, 115, 114, - /* 2510 */ 193, 115, 114, 114, 114, 50, 115, 421, 485, 114, - /* 2520 */ 114, 488, 50, 115, 22, 492, 493, 494, 495, 496, - /* 2530 */ 497, 253, 499, 437, 114, 439, 0, 43, 123, 194, - /* 2540 */ 50, 124, 22, 114, 22, 115, 114, 114, 114, 22, - /* 2550 */ 114, 114, 485, 37, 114, 488, 115, 115, 227, 492, - /* 2560 */ 493, 494, 495, 496, 497, 37, 499, 114, 37, 115, - /* 2570 */ 380, 114, 37, 115, 115, 37, 37, 115, 115, 37, - /* 2580 */ 135, 485, 135, 393, 488, 33, 135, 135, 492, 493, - /* 2590 */ 494, 495, 496, 497, 380, 499, 114, 114, 37, 22, - /* 2600 */ 114, 75, 22, 74, 37, 37, 37, 393, 37, 380, - /* 2610 */ 37, 421, 37, 37, 81, 37, 37, 108, 37, 37, - /* 2620 */ 108, 81, 393, 33, 37, 37, 37, 437, 22, 439, - /* 2630 */ 37, 37, 81, 37, 37, 421, 37, 37, 37, 380, - /* 2640 */ 37, 22, 37, 0, 37, 53, 0, 43, 37, 0, - /* 2650 */ 421, 437, 393, 439, 37, 53, 43, 43, 0, 37, - /* 2660 */ 0, 53, 53, 43, 37, 0, 437, 22, 439, 37, - /* 2670 */ 0, 33, 22, 22, 21, 485, 22, 22, 488, 20, - /* 2680 */ 421, 555, 492, 493, 494, 495, 496, 497, 21, 499, - /* 2690 */ 555, 380, 555, 555, 555, 555, 437, 555, 439, 485, + /* 2320 */ 501, 37, 37, 22, 37, 37, 552, 0, 22, 0, + /* 2330 */ 421, 22, 393, 462, 37, 0, 380, 0, 0, 37, + /* 2340 */ 0, 37, 0, 0, 55, 37, 437, 22, 439, 393, + /* 2350 */ 20, 37, 37, 37, 115, 0, 485, 114, 114, 488, + /* 2360 */ 421, 0, 50, 492, 493, 494, 495, 496, 497, 191, + /* 2370 */ 499, 462, 22, 37, 0, 22, 437, 421, 439, 0, + /* 2380 */ 0, 3, 33, 191, 114, 114, 191, 191, 115, 37, + /* 2390 */ 115, 191, 114, 437, 485, 439, 37, 488, 197, 302, + /* 2400 */ 110, 492, 493, 494, 495, 496, 497, 226, 499, 201, + /* 2410 */ 201, 217, 112, 380, 221, 51, 51, 33, 227, 33, + /* 2420 */ 115, 33, 115, 50, 485, 115, 393, 488, 33, 81, + /* 2430 */ 33, 492, 493, 494, 495, 496, 497, 114, 499, 50, + /* 2440 */ 114, 485, 114, 37, 488, 114, 114, 380, 492, 493, + /* 2450 */ 494, 495, 496, 497, 421, 499, 115, 3, 33, 115, + /* 2460 */ 393, 115, 50, 37, 37, 37, 37, 37, 37, 115, + /* 2470 */ 437, 115, 439, 33, 50, 0, 380, 0, 43, 0, + /* 2480 */ 114, 43, 115, 115, 114, 114, 194, 0, 421, 393, + /* 2490 */ 114, 198, 286, 194, 43, 33, 115, 114, 273, 112, + /* 2500 */ 2, 253, 112, 22, 437, 302, 439, 302, 115, 50, + /* 2510 */ 193, 115, 250, 114, 114, 114, 114, 421, 485, 114, + /* 2520 */ 50, 488, 115, 114, 114, 492, 493, 494, 495, 496, + /* 2530 */ 497, 115, 499, 437, 22, 439, 114, 114, 0, 194, + /* 2540 */ 43, 123, 50, 124, 22, 22, 22, 115, 114, 227, + /* 2550 */ 114, 114, 485, 114, 37, 488, 115, 114, 114, 492, + /* 2560 */ 493, 494, 495, 496, 497, 115, 499, 37, 115, 114, + /* 2570 */ 380, 114, 37, 115, 37, 115, 37, 37, 115, 115, + /* 2580 */ 37, 485, 135, 393, 488, 33, 114, 135, 492, 493, + /* 2590 */ 494, 495, 496, 497, 380, 499, 135, 114, 37, 114, + /* 2600 */ 135, 22, 75, 74, 22, 37, 37, 393, 37, 380, + /* 2610 */ 37, 421, 37, 37, 37, 37, 108, 37, 37, 108, + /* 2620 */ 37, 33, 393, 81, 37, 81, 37, 437, 37, 439, + /* 2630 */ 22, 37, 81, 37, 37, 421, 37, 37, 37, 380, + /* 2640 */ 37, 37, 22, 37, 0, 53, 37, 0, 43, 37, + /* 2650 */ 421, 437, 393, 439, 43, 53, 0, 43, 37, 0, + /* 2660 */ 53, 37, 43, 53, 0, 0, 437, 37, 439, 37, + /* 2670 */ 22, 0, 22, 33, 22, 485, 21, 555, 488, 22, + /* 2680 */ 421, 21, 492, 493, 494, 495, 496, 497, 22, 499, + /* 2690 */ 20, 380, 555, 555, 555, 555, 437, 555, 439, 485, /* 2700 */ 555, 555, 488, 555, 393, 555, 492, 493, 494, 495, /* 2710 */ 496, 497, 555, 499, 485, 555, 555, 488, 555, 555, /* 2720 */ 555, 492, 493, 494, 495, 496, 497, 380, 499, 555, @@ -922,9 +922,9 @@ static const YYCODETYPE yy_lookahead[] = { /* 3650 */ 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, /* 3660 */ 377, 377, }; -#define YY_SHIFT_COUNT (964) +#define YY_SHIFT_COUNT (966) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2670) +#define YY_SHIFT_MAX (2671) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 430, 0, 260, 0, 521, 521, 521, 521, 521, 521, /* 10 */ 521, 521, 521, 521, 521, 521, 781, 1041, 1041, 1301, @@ -964,67 +964,67 @@ static const unsigned short int yy_shift_ofst[] = { /* 350 */ 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, /* 360 */ 743, 743, 743, 743, 743, 743, 743, 743, 1831, 743, /* 370 */ 1650, 579, 1924, 1911, 1699, 3285, 3285, 3285, 3285, 3285, - /* 380 */ 3285, 3285, 3285, 3285, 3285, 3285, 1502, 1873, 23, 830, - /* 390 */ 945, 648, 1358, 309, 1408, 48, 819, 856, 63, 63, - /* 400 */ 63, 63, 63, 63, 63, 63, 63, 232, 452, 224, - /* 410 */ 650, 533, 533, 487, 286, 560, 788, 10, 760, 770, - /* 420 */ 10, 708, 1091, 1179, 936, 982, 982, 794, 1096, 739, - /* 430 */ 794, 794, 794, 1287, 1256, 1241, 1322, 769, 1191, 1352, - /* 440 */ 1266, 1277, 1279, 1281, 1022, 1391, 1395, 1079, 1354, 1414, - /* 450 */ 1418, 1209, 1372, 1404, 1366, 1405, 1409, 1416, 1422, 1294, - /* 460 */ 1296, 1376, 1423, 1431, 1432, 1445, 1433, 1374, 1434, 1400, - /* 470 */ 1435, 1459, 1460, 1461, 1471, 1473, 1476, 1483, 1491, 1493, - /* 480 */ 1495, 1497, 1499, 1510, 1521, 1503, 1508, 1512, 1540, 1544, - /* 490 */ 1550, 1506, 1575, 1437, 1505, 1600, 1601, 1579, 1615, 1981, - /* 500 */ 1992, 2015, 1970, 2019, 1983, 1780, 1985, 1986, 1987, 1784, - /* 510 */ 2026, 1990, 1991, 1788, 1993, 2031, 2041, 1792, 2034, 1998, - /* 520 */ 2036, 2000, 2038, 2017, 2042, 2006, 1812, 2046, 1827, 2050, - /* 530 */ 1837, 1838, 1844, 1848, 2063, 2064, 2065, 1857, 1859, 2069, - /* 540 */ 2072, 1919, 2025, 2028, 2079, 2043, 2081, 2082, 2047, 2030, - /* 550 */ 2085, 2037, 2086, 2044, 2088, 2092, 2093, 2048, 2094, 2100, - /* 560 */ 2101, 2102, 2103, 2104, 1922, 2060, 2105, 1932, 2107, 2108, - /* 570 */ 2109, 2110, 2112, 2113, 2115, 2116, 2117, 2118, 2119, 2120, - /* 580 */ 2121, 2122, 2123, 2125, 2126, 2127, 2128, 2129, 2083, 2131, - /* 590 */ 2089, 2132, 2134, 2136, 2138, 2139, 2141, 2142, 2150, 2153, - /* 600 */ 2133, 2156, 2002, 2158, 2005, 2160, 2008, 2162, 2163, 2143, - /* 610 */ 2124, 2144, 2130, 2164, 2106, 2169, 2111, 2135, 2174, 2137, - /* 620 */ 2176, 2140, 2177, 2179, 2145, 2147, 2148, 2180, 2146, 2149, - /* 630 */ 2151, 2184, 2155, 2152, 2154, 2185, 2159, 2186, 2157, 2165, - /* 640 */ 2168, 2167, 2170, 2192, 2171, 2188, 2166, 2172, 2198, 2209, - /* 650 */ 2218, 2222, 2189, 2009, 2231, 2167, 2183, 2234, 2167, 2187, - /* 660 */ 2236, 2239, 2173, 2241, 2250, 2215, 2200, 2211, 2255, 2220, - /* 670 */ 2207, 2232, 2261, 2226, 2212, 2233, 2272, 2237, 2224, 2235, - /* 680 */ 2279, 2280, 2281, 2282, 2283, 2284, 2068, 2175, 2248, 2264, - /* 690 */ 2287, 2266, 2253, 2254, 2257, 2260, 2262, 2263, 2268, 2269, - /* 700 */ 2285, 2196, 2265, 2286, 2288, 2274, 2290, 2301, 2295, 2303, - /* 710 */ 2299, 2309, 2302, 2273, 2329, 2312, 2294, 2335, 2337, 2338, - /* 720 */ 2304, 2339, 2305, 2340, 2306, 2344, 2323, 2327, 2313, 2314, - /* 730 */ 2315, 2238, 2240, 2355, 2178, 2161, 2181, 2243, 2191, 2167, - /* 740 */ 2308, 2361, 2182, 2325, 2350, 2374, 2193, 2353, 2194, 2195, - /* 750 */ 2379, 2380, 2199, 2197, 2205, 2208, 2378, 2349, 2084, 2270, - /* 760 */ 2276, 2275, 2296, 2346, 2362, 2300, 2336, 2307, 2364, 2310, - /* 770 */ 2322, 2367, 2383, 2324, 2316, 2326, 2328, 2330, 2384, 2368, - /* 780 */ 2371, 2332, 2389, 2201, 2342, 2341, 2392, 2343, 2391, 2348, - /* 790 */ 2351, 2426, 2410, 2203, 2421, 2422, 2424, 2425, 2427, 2428, - /* 800 */ 2352, 2354, 2418, 2204, 2438, 2423, 2474, 2475, 2363, 2435, - /* 810 */ 2365, 2366, 2369, 2370, 2291, 2372, 2479, 2439, 2289, 2491, - /* 820 */ 2381, 2385, 2298, 2450, 2317, 2461, 2386, 2227, 2390, 2493, - /* 830 */ 2485, 2247, 2393, 2396, 2387, 2395, 2398, 2399, 2400, 2401, - /* 840 */ 2465, 2405, 2406, 2472, 2408, 2502, 2278, 2420, 2429, 2536, - /* 850 */ 2430, 2432, 2345, 2494, 2433, 2415, 2167, 2490, 2434, 2436, - /* 860 */ 2441, 2437, 2440, 2417, 2520, 2522, 2527, 2331, 2442, 2516, - /* 870 */ 2528, 2453, 2454, 2531, 2457, 2458, 2535, 2387, 2459, 2538, - /* 880 */ 2395, 2462, 2539, 2398, 2463, 2542, 2399, 2445, 2447, 2451, - /* 890 */ 2452, 2482, 2552, 2483, 2561, 2486, 2552, 2552, 2577, 2526, - /* 900 */ 2529, 2580, 2567, 2568, 2569, 2571, 2573, 2575, 2576, 2578, - /* 910 */ 2579, 2581, 2582, 2533, 2509, 2540, 2512, 2590, 2587, 2588, - /* 920 */ 2589, 2606, 2593, 2594, 2596, 2551, 2196, 2597, 2265, 2599, - /* 930 */ 2600, 2601, 2603, 2619, 2605, 2643, 2607, 2592, 2604, 2646, - /* 940 */ 2611, 2602, 2613, 2649, 2617, 2608, 2614, 2658, 2622, 2609, - /* 950 */ 2620, 2660, 2627, 2665, 2645, 2632, 2670, 2650, 2638, 2651, - /* 960 */ 2653, 2654, 2655, 2667, 2659, + /* 380 */ 3285, 3285, 3285, 3285, 3285, 3285, 3285, 1502, 1873, 23, + /* 390 */ 830, 945, 648, 1358, 309, 1408, 48, 819, 856, 63, + /* 400 */ 63, 63, 63, 63, 63, 63, 63, 63, 232, 452, + /* 410 */ 224, 650, 533, 533, 487, 286, 560, 788, 10, 10, + /* 420 */ 760, 770, 10, 708, 1091, 1179, 936, 982, 982, 794, + /* 430 */ 1096, 739, 794, 794, 794, 1287, 1256, 1241, 1322, 769, + /* 440 */ 1191, 1352, 1266, 1277, 1279, 1281, 1022, 1391, 1395, 1079, + /* 450 */ 1354, 1414, 1418, 1209, 1372, 1404, 1366, 1405, 1409, 1416, + /* 460 */ 1422, 1294, 1296, 1376, 1423, 1431, 1432, 1445, 1433, 1374, + /* 470 */ 1434, 1400, 1435, 1459, 1460, 1461, 1471, 1473, 1476, 1483, + /* 480 */ 1491, 1493, 1495, 1497, 1499, 1510, 1521, 1503, 1508, 1512, + /* 490 */ 1540, 1544, 1550, 1506, 1575, 1437, 1505, 1600, 1601, 1579, + /* 500 */ 1615, 1970, 1988, 2015, 1974, 2016, 1984, 1781, 1986, 1987, + /* 510 */ 1989, 1784, 2027, 1991, 1992, 1789, 1994, 2041, 2042, 1792, + /* 520 */ 2034, 1998, 2036, 2000, 2038, 2017, 2043, 2009, 1812, 2049, + /* 530 */ 1828, 2059, 1838, 1839, 1845, 1849, 2064, 2065, 2072, 1857, + /* 540 */ 1859, 2069, 2074, 1920, 2028, 2029, 2080, 2044, 2082, 2083, + /* 550 */ 2047, 2032, 2086, 2037, 2088, 2046, 2090, 2093, 2094, 2048, + /* 560 */ 2100, 2101, 2102, 2103, 2104, 2105, 1922, 2060, 2106, 1933, + /* 570 */ 2108, 2109, 2110, 2112, 2113, 2115, 2116, 2117, 2118, 2119, + /* 580 */ 2120, 2121, 2122, 2123, 2125, 2126, 2127, 2128, 2129, 2131, + /* 590 */ 2084, 2132, 2087, 2135, 2136, 2138, 2139, 2141, 2142, 2150, + /* 600 */ 2153, 2155, 2134, 2157, 2003, 2159, 2006, 2161, 2010, 2162, + /* 610 */ 2164, 2143, 2124, 2144, 2130, 2169, 2107, 2172, 2111, 2140, + /* 620 */ 2173, 2133, 2176, 2137, 2179, 2180, 2145, 2148, 2147, 2183, + /* 630 */ 2149, 2152, 2151, 2184, 2154, 2156, 2160, 2185, 2165, 2188, + /* 640 */ 2146, 2163, 2174, 2158, 2167, 2182, 2168, 2197, 2166, 2171, + /* 650 */ 2198, 2215, 2220, 2221, 2186, 2026, 2222, 2158, 2187, 2232, + /* 660 */ 2158, 2189, 2233, 2234, 2175, 2236, 2241, 2211, 2199, 2210, + /* 670 */ 2254, 2218, 2204, 2217, 2261, 2226, 2212, 2231, 2272, 2238, + /* 680 */ 2223, 2235, 2277, 2279, 2280, 2281, 2282, 2283, 2177, 2170, + /* 690 */ 2247, 2263, 2286, 2265, 2251, 2257, 2258, 2260, 2264, 2266, + /* 700 */ 2268, 2269, 2284, 2267, 2276, 2285, 2287, 2274, 2288, 2291, + /* 710 */ 2295, 2298, 2301, 2327, 2306, 2289, 2329, 2309, 2297, 2335, + /* 720 */ 2337, 2338, 2302, 2340, 2304, 2342, 2308, 2343, 2325, 2330, + /* 730 */ 2314, 2315, 2316, 2239, 2243, 2355, 2178, 2191, 2181, 2244, + /* 740 */ 2193, 2158, 2312, 2361, 2192, 2336, 2350, 2374, 2194, 2353, + /* 750 */ 2195, 2201, 2379, 2380, 2196, 2208, 2200, 2209, 2378, 2349, + /* 760 */ 2097, 2270, 2273, 2271, 2275, 2352, 2359, 2278, 2364, 2300, + /* 770 */ 2365, 2290, 2305, 2384, 2386, 2307, 2323, 2326, 2328, 2310, + /* 780 */ 2388, 2373, 2389, 2331, 2395, 2203, 2348, 2341, 2397, 2332, + /* 790 */ 2406, 2344, 2346, 2454, 2425, 2205, 2426, 2427, 2428, 2429, + /* 800 */ 2430, 2431, 2354, 2356, 2412, 2206, 2440, 2424, 2475, 2477, + /* 810 */ 2366, 2435, 2367, 2368, 2370, 2371, 2292, 2376, 2479, 2438, + /* 820 */ 2293, 2487, 2381, 2383, 2299, 2451, 2317, 2462, 2387, 2225, + /* 830 */ 2390, 2498, 2481, 2262, 2393, 2396, 2399, 2400, 2401, 2402, + /* 840 */ 2405, 2407, 2459, 2409, 2410, 2470, 2416, 2512, 2248, 2422, + /* 850 */ 2423, 2538, 2432, 2434, 2345, 2497, 2436, 2418, 2158, 2492, + /* 860 */ 2437, 2439, 2441, 2443, 2444, 2419, 2522, 2523, 2524, 2322, + /* 870 */ 2450, 2517, 2530, 2455, 2453, 2535, 2457, 2458, 2537, 2399, + /* 880 */ 2460, 2539, 2400, 2463, 2540, 2401, 2464, 2543, 2402, 2447, + /* 890 */ 2452, 2461, 2465, 2472, 2552, 2483, 2561, 2485, 2552, 2552, + /* 900 */ 2579, 2527, 2529, 2582, 2568, 2569, 2571, 2573, 2575, 2576, + /* 910 */ 2577, 2578, 2580, 2581, 2583, 2542, 2508, 2544, 2511, 2588, + /* 920 */ 2587, 2589, 2591, 2608, 2594, 2596, 2597, 2551, 2267, 2599, + /* 930 */ 2276, 2600, 2601, 2603, 2604, 2620, 2606, 2644, 2609, 2592, + /* 940 */ 2605, 2647, 2612, 2602, 2611, 2656, 2621, 2607, 2614, 2659, + /* 950 */ 2624, 2610, 2619, 2664, 2630, 2665, 2648, 2632, 2671, 2650, + /* 960 */ 2640, 2652, 2655, 2657, 2666, 2660, 2670, }; -#define YY_REDUCE_COUNT (385) +#define YY_REDUCE_COUNT (386) #define YY_REDUCE_MIN (-518) #define YY_REDUCE_MAX (2785) static const short yy_reduce_ofst[] = { @@ -1065,107 +1065,107 @@ static const short yy_reduce_ofst[] = { /* 340 */ 1482, 1492, 1531, 1524, 1543, 1551, 1514, 1516, 1528, 1529, /* 350 */ 1542, 1545, 1546, 1547, 1554, 1556, 1557, 1558, 1560, 1562, /* 360 */ 1563, 1564, 1565, 1566, 1567, 1568, 1571, 1572, 1522, 1573, - /* 370 */ 1576, 1561, 1580, 1583, 1578, 1519, 1527, 1500, 1548, 1581, - /* 380 */ 1591, 1602, 1589, 1603, 1588, 1592, + /* 370 */ 1576, 1561, 1580, 1583, 1578, 1519, 1588, 1534, 1500, 1548, + /* 380 */ 1581, 1591, 1602, 1589, 1604, 1592, 1603, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 10 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 20 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 30 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 40 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 50 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 60 */ 2551, 2182, 2182, 2507, 2182, 2182, 2182, 2182, 2182, 2182, - /* 70 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2514, 2182, - /* 80 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 90 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2284, - /* 100 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 110 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2282, 2803, - /* 120 */ 2182, 2929, 2592, 2182, 2182, 2832, 2182, 2182, 2182, 2182, - /* 130 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 140 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2815, 2182, 2182, - /* 150 */ 2255, 2255, 2182, 2815, 2815, 2815, 2775, 2775, 2282, 2182, - /* 160 */ 2182, 2284, 2182, 2594, 2182, 2182, 2182, 2182, 2182, 2182, - /* 170 */ 2182, 2182, 2182, 2424, 2212, 2182, 2182, 2182, 2182, 2182, - /* 180 */ 2182, 2577, 2182, 2182, 2861, 2807, 2808, 2923, 2182, 2864, - /* 190 */ 2826, 2182, 2821, 2182, 2182, 2182, 2182, 2519, 2182, 2851, - /* 200 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2620, 2182, 2182, - /* 210 */ 2369, 2571, 2182, 2182, 2182, 2182, 2182, 2907, 2805, 2845, - /* 220 */ 2182, 2855, 2182, 2182, 2182, 2608, 2284, 2182, 2284, 2564, - /* 230 */ 2502, 2182, 2512, 2182, 2512, 2509, 2182, 2182, 2182, 2512, - /* 240 */ 2509, 2509, 2509, 2358, 2354, 2182, 2182, 2352, 2182, 2182, - /* 250 */ 2182, 2182, 2238, 2182, 2238, 2182, 2284, 2284, 2182, 2284, - /* 260 */ 2182, 2182, 2284, 2182, 2284, 2182, 2284, 2182, 2284, 2284, - /* 270 */ 2182, 2284, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 280 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 290 */ 2182, 2606, 2587, 2182, 2282, 2182, 2575, 2573, 2182, 2282, - /* 300 */ 2855, 2182, 2182, 2877, 2872, 2877, 2872, 2891, 2887, 2877, - /* 310 */ 2896, 2893, 2857, 2855, 2838, 2834, 2926, 2913, 2909, 2182, - /* 320 */ 2182, 2843, 2841, 2182, 2282, 2282, 2872, 2182, 2182, 2182, - /* 330 */ 2182, 2872, 2182, 2182, 2282, 2182, 2182, 2282, 2182, 2182, - /* 340 */ 2182, 2182, 2282, 2182, 2282, 2182, 2182, 2182, 2182, 2182, - /* 350 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 360 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2386, 2182, - /* 370 */ 2182, 2282, 2182, 2222, 2182, 2566, 2592, 2597, 2547, 2547, - /* 380 */ 2427, 2427, 2929, 2427, 2285, 2187, 2182, 2182, 2182, 2182, - /* 390 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2890, 2889, - /* 400 */ 2726, 2182, 2779, 2778, 2777, 2768, 2725, 2382, 2182, 2182, - /* 410 */ 2182, 2724, 2723, 2182, 2182, 2182, 2182, 2373, 2182, 2182, - /* 420 */ 2395, 2182, 2182, 2182, 2182, 2538, 2537, 2717, 2182, 2182, - /* 430 */ 2718, 2716, 2715, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 440 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 450 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 460 */ 2910, 2914, 2182, 2182, 2182, 2804, 2182, 2182, 2182, 2696, - /* 470 */ 2182, 2182, 2182, 2182, 2664, 2659, 2650, 2641, 2656, 2647, - /* 480 */ 2635, 2653, 2644, 2632, 2629, 2182, 2182, 2182, 2182, 2182, - /* 490 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 500 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 510 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 520 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 530 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 540 */ 2182, 2508, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 550 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 560 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 570 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 580 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 590 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 600 */ 2182, 2182, 2182, 2182, 2182, 2182, 2523, 2182, 2182, 2182, - /* 610 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 620 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 630 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 640 */ 2227, 2703, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 650 */ 2182, 2182, 2182, 2182, 2182, 2706, 2182, 2182, 2707, 2182, - /* 660 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 670 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 680 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 690 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 700 */ 2182, 2329, 2328, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 710 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 720 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 730 */ 2182, 2708, 2182, 2182, 2182, 2182, 2591, 2182, 2182, 2698, - /* 740 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 750 */ 2182, 2182, 2182, 2182, 2182, 2182, 2906, 2858, 2182, 2182, - /* 760 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 770 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 780 */ 2696, 2182, 2888, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 790 */ 2904, 2182, 2908, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 800 */ 2814, 2810, 2182, 2182, 2806, 2182, 2182, 2182, 2182, 2182, - /* 810 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 820 */ 2182, 2182, 2182, 2182, 2182, 2765, 2182, 2182, 2182, 2799, - /* 830 */ 2182, 2182, 2182, 2182, 2423, 2422, 2421, 2420, 2182, 2182, - /* 840 */ 2182, 2182, 2182, 2182, 2708, 2182, 2711, 2182, 2182, 2182, - /* 850 */ 2182, 2182, 2182, 2182, 2182, 2182, 2695, 2182, 2750, 2749, - /* 860 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 870 */ 2182, 2417, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 880 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2401, 2399, 2398, - /* 890 */ 2397, 2182, 2434, 2182, 2182, 2182, 2430, 2429, 2182, 2182, - /* 900 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 910 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2303, 2182, 2182, - /* 920 */ 2182, 2182, 2182, 2182, 2182, 2182, 2295, 2182, 2294, 2182, - /* 930 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 940 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, - /* 950 */ 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2182, 2211, 2182, - /* 960 */ 2182, 2182, 2182, 2182, 2182, + /* 0 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 10 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 20 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 30 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 40 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 50 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 60 */ 2552, 2183, 2183, 2508, 2183, 2183, 2183, 2183, 2183, 2183, + /* 70 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2515, 2183, + /* 80 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 90 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2285, + /* 100 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 110 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2283, 2804, + /* 120 */ 2183, 2930, 2593, 2183, 2183, 2833, 2183, 2183, 2183, 2183, + /* 130 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 140 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2816, 2183, 2183, + /* 150 */ 2256, 2256, 2183, 2816, 2816, 2816, 2776, 2776, 2283, 2183, + /* 160 */ 2183, 2285, 2183, 2595, 2183, 2183, 2183, 2183, 2183, 2183, + /* 170 */ 2183, 2183, 2183, 2425, 2213, 2183, 2183, 2183, 2183, 2183, + /* 180 */ 2183, 2578, 2183, 2183, 2862, 2808, 2809, 2924, 2183, 2865, + /* 190 */ 2827, 2183, 2822, 2183, 2183, 2183, 2183, 2520, 2183, 2852, + /* 200 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2621, 2183, 2183, + /* 210 */ 2370, 2572, 2183, 2183, 2183, 2183, 2183, 2908, 2806, 2846, + /* 220 */ 2183, 2856, 2183, 2183, 2183, 2609, 2285, 2183, 2285, 2565, + /* 230 */ 2503, 2183, 2513, 2183, 2513, 2510, 2183, 2183, 2183, 2513, + /* 240 */ 2510, 2510, 2510, 2359, 2355, 2183, 2183, 2353, 2183, 2183, + /* 250 */ 2183, 2183, 2239, 2183, 2239, 2183, 2285, 2285, 2183, 2285, + /* 260 */ 2183, 2183, 2285, 2183, 2285, 2183, 2285, 2183, 2285, 2285, + /* 270 */ 2183, 2285, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 280 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 290 */ 2183, 2607, 2588, 2183, 2283, 2183, 2576, 2574, 2183, 2283, + /* 300 */ 2856, 2183, 2183, 2878, 2873, 2878, 2873, 2892, 2888, 2878, + /* 310 */ 2897, 2894, 2858, 2856, 2839, 2835, 2927, 2914, 2910, 2183, + /* 320 */ 2183, 2844, 2842, 2183, 2283, 2283, 2873, 2183, 2183, 2183, + /* 330 */ 2183, 2873, 2183, 2183, 2283, 2183, 2183, 2283, 2183, 2183, + /* 340 */ 2183, 2183, 2283, 2183, 2283, 2183, 2183, 2183, 2183, 2183, + /* 350 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 360 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2387, 2183, + /* 370 */ 2183, 2283, 2183, 2223, 2183, 2567, 2930, 2593, 2598, 2548, + /* 380 */ 2548, 2428, 2428, 2930, 2428, 2286, 2188, 2183, 2183, 2183, + /* 390 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2891, + /* 400 */ 2890, 2727, 2183, 2780, 2779, 2778, 2769, 2726, 2383, 2183, + /* 410 */ 2183, 2183, 2725, 2724, 2183, 2183, 2183, 2183, 2374, 2371, + /* 420 */ 2183, 2183, 2396, 2183, 2183, 2183, 2183, 2539, 2538, 2718, + /* 430 */ 2183, 2183, 2719, 2717, 2716, 2183, 2183, 2183, 2183, 2183, + /* 440 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 450 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 460 */ 2183, 2183, 2911, 2915, 2183, 2183, 2183, 2805, 2183, 2183, + /* 470 */ 2183, 2697, 2183, 2183, 2183, 2183, 2665, 2660, 2651, 2642, + /* 480 */ 2657, 2648, 2636, 2654, 2645, 2633, 2630, 2183, 2183, 2183, + /* 490 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 500 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 510 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 520 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 530 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 540 */ 2183, 2183, 2183, 2509, 2183, 2183, 2183, 2183, 2183, 2183, + /* 550 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 560 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 570 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 580 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 590 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 600 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2524, 2183, + /* 610 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 620 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 630 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 640 */ 2183, 2183, 2228, 2704, 2183, 2183, 2183, 2183, 2183, 2183, + /* 650 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2707, 2183, 2183, + /* 660 */ 2708, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 670 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 680 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 690 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 700 */ 2183, 2183, 2183, 2330, 2329, 2183, 2183, 2183, 2183, 2183, + /* 710 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 720 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 730 */ 2183, 2183, 2183, 2709, 2183, 2183, 2183, 2183, 2592, 2183, + /* 740 */ 2183, 2699, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 750 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2907, 2859, + /* 760 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 770 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 780 */ 2183, 2183, 2697, 2183, 2889, 2183, 2183, 2183, 2183, 2183, + /* 790 */ 2183, 2183, 2905, 2183, 2909, 2183, 2183, 2183, 2183, 2183, + /* 800 */ 2183, 2183, 2815, 2811, 2183, 2183, 2807, 2183, 2183, 2183, + /* 810 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 820 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2766, 2183, 2183, + /* 830 */ 2183, 2800, 2183, 2183, 2183, 2183, 2424, 2423, 2422, 2421, + /* 840 */ 2183, 2183, 2183, 2183, 2183, 2183, 2709, 2183, 2712, 2183, + /* 850 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2696, 2183, + /* 860 */ 2751, 2750, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 870 */ 2183, 2183, 2183, 2418, 2183, 2183, 2183, 2183, 2183, 2183, + /* 880 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2402, + /* 890 */ 2400, 2399, 2398, 2183, 2435, 2183, 2183, 2183, 2431, 2430, + /* 900 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 910 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2304, + /* 920 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2296, 2183, + /* 930 */ 2295, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 940 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 950 */ 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, 2183, + /* 960 */ 2212, 2183, 2183, 2183, 2183, 2183, 2183, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2396,7 +2396,7 @@ static const char *const yyRuleName[] = { /* 182 */ "cmd ::= ALTER TABLE alter_table_clause", /* 183 */ "cmd ::= ALTER STABLE alter_table_clause", /* 184 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 185 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 185 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", /* 186 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", /* 187 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", /* 188 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", @@ -3811,7 +3811,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 377, /* (182) cmd ::= ALTER TABLE alter_table_clause */ 377, /* (183) cmd ::= ALTER STABLE alter_table_clause */ 419, /* (184) alter_table_clause ::= full_table_name alter_table_options */ - 419, /* (185) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 419, /* (185) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ 419, /* (186) alter_table_clause ::= full_table_name DROP COLUMN column_name */ 419, /* (187) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ 419, /* (188) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ @@ -4565,7 +4565,7 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (182) cmd ::= ALTER TABLE alter_table_clause */ -3, /* (183) cmd ::= ALTER STABLE alter_table_clause */ -2, /* (184) alter_table_clause ::= full_table_name alter_table_options */ - -5, /* (185) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + -6, /* (185) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -4, /* (186) alter_table_clause ::= full_table_name DROP COLUMN column_name */ -5, /* (187) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -5, /* (188) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ @@ -5895,9 +5895,9 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy452 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } yymsp[-1].minor.yy452 = yylhsminor.yy452; break; - case 185: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy479, yymsp[0].minor.yy874); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; + case 185: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ +{ yylhsminor.yy452 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy452, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy479, yymsp[-1].minor.yy874, yymsp[0].minor.yy452); } + yymsp[-5].minor.yy452 = yylhsminor.yy452; break; case 186: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy452 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy452, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy479); } diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c index 687b4bcf12..4c61e6da1d 100644 --- a/source/libs/stream/src/streamSessionState.c +++ b/source/libs/stream/src/streamSessionState.c @@ -734,6 +734,21 @@ _end: return code; } +int32_t getCountWinStateFromDisc(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen) { + SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentNext_rocksdb(pState, pKey); + int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); + streamStateFreeCur(pCur); + if (code == TSDB_CODE_SUCCESS) { + return code; + } else { + pCur = streamStateSessionSeekKeyPrev_rocksdb(pState, pKey); + } + + code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); + streamStateFreeCur(pCur); + return code; +} + int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal, int32_t* pVLen) { SSessionKey* pWinKey = pKey; const TSKEY gap = 0; @@ -755,14 +770,13 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C if (size == 0) { void* pFileStore = getStateFileStore(pFileState); void* pRockVal = NULL; - SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId); - code = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &pRockVal, pVLen); - streamStateFreeCur(pCur); + code = getCountWinStateFromDisc(pFileStore, pWinKey, &pRockVal, pVLen); if (code == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) { - qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code); + qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, + pWinKey->win.ekey, code); if (code == TSDB_CODE_SUCCESS) { int32_t valSize = *pVLen; - COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)( (char*)(pRockVal) + (valSize - sizeof(COUNT_TYPE)) ); + COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)((char*)(pRockVal) + (valSize - sizeof(COUNT_TYPE))); if (inSessionWindow(pWinKey, startTs, gap) || (*pWinStateCout) < winCount) { (*pVal) = createSessionWinBuff(pFileState, pWinKey, pRockVal, pVLen); goto _end; @@ -798,20 +812,24 @@ int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, C } if (index == -1) { - if (!isDeteled(pFileState, endTs)) { - void* p = NULL; - void* pFileStore = getStateFileStore(pFileState); - SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId); - int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen); + if (!isDeteled(pFileState, endTs) && isFlushedState(pFileState, endTs, 0)) { + SSessionKey tmpKey = *pWinKey; + void* pRockVal = NULL; + void* pFileStore = getStateFileStore(pFileState); + int32_t code_file = getCountWinStateFromDisc(pFileStore, &tmpKey, &pRockVal, pVLen); if (code_file == TSDB_CODE_SUCCESS) { - (*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen); - code = code_file; - qDebug("===stream===1 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code_file); - streamStateFreeCur(pCur); - goto _end; + SRowBuffPos* pFirstPos = taosArrayGetP(pWinStates, 0); + SSessionKey* pFirstWinKey = (SSessionKey*)pFirstPos->pKey; + if (tmpKey.win.ekey < pFirstWinKey->win.skey) { + *pWinKey = tmpKey; + (*pVal) = createSessionWinBuff(pFileState, pWinKey, pRockVal, pVLen); + code = code_file; + qDebug("===stream===1 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, + pWinKey->win.ekey, code_file); + goto _end; + } } - taosMemoryFree(p); - streamStateFreeCur(pCur); + taosMemoryFree(pRockVal); } } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index d0fb5cbfdb..9a29444d2d 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -200,7 +200,7 @@ static FORCE_INLINE void cliMayUpdateFqdnCache(SHashObj* cache, char* dst); // process data read from server, add decompress etc later static void cliHandleResp(SCliConn* conn); // handle except about conn -static void cliHandleExcept(SCliConn* conn); +static void cliHandleExcept(SCliConn* conn, int32_t code); static void cliReleaseUnfinishedMsg(SCliConn* conn); static void cliHandleFastFail(SCliConn* pConn, int status); @@ -571,8 +571,11 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) { if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn); transUnrefCliHandle(pConn); } -void cliHandleExcept(SCliConn* conn) { +void cliHandleExcept(SCliConn* conn, int32_t code) { tTrace("%s conn %p except ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn)); + if (code != TSDB_CODE_RPC_FQDN_ERROR) { + code = -1; + } cliHandleExceptImpl(conn, -1); } @@ -866,7 +869,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { while (transReadComplete(pBuf)) { tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn); if (pBuf->invalid) { - cliHandleExcept(conn); + cliHandleExcept(conn, -1); break; } else { cliHandleResp(conn); @@ -886,7 +889,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread), T_REF_VAL_GET(conn)); conn->broken = true; - cliHandleExcept(conn); + cliHandleExcept(conn, -1); } } @@ -1037,7 +1040,7 @@ static void cliSendCb(uv_write_t* req, int status) { } else { if (!uv_is_closing((uv_handle_t*)&pConn->stream)) { tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status)); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); } return; } @@ -1113,7 +1116,7 @@ void cliSend(SCliConn* pConn) { if (transQueueEmpty(&pConn->cliMsgs)) { tError("%s conn %p not msg to send", pTransInst->label, pConn); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); return; } @@ -1186,7 +1189,7 @@ void cliSend(SCliConn* pConn) { if (status != 0) { tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType), uv_err_name(status)); - cliHandleExcept(pConn); + cliHandleExcept(pConn, -1); } return; _RETURN: @@ -1242,7 +1245,8 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { taosArrayPush(pThrd->timerList, &conn->timer); conn->timer = NULL; - cliHandleFastFail(conn, -1); + cliHandleFastFail(conn, terrno); + terrno = 0; return; } struct sockaddr_in addr; @@ -1304,7 +1308,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize, uv_err_name(status)); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn); + if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn, -1); cliHandleBatchReq(nxtBatch, thrd); } else { @@ -1362,7 +1366,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { cliDestroyBatch(pConn->pBatch); pConn->pBatch = NULL; } - cliHandleExcept(pConn); + cliHandleExcept(pConn, status); } void cliConnCb(uv_connect_t* req, int status) { @@ -1653,7 +1657,8 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { taosArrayPush(pThrd->timerList, &conn->timer); conn->timer = NULL; - cliHandleExcept(conn); + cliHandleExcept(conn, terrno); + terrno = 0; return; } @@ -1667,20 +1672,20 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(TAOS_SYSTEM_ERROR(errno))); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); errno = 0; return; } int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd); if (ret != 0) { tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); return; } ret = transSetConnOption((uv_tcp_t*)conn->stream, tsKeepAliveIdle); if (ret != 0) { tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret)); - cliHandleExcept(conn); + cliHandleExcept(conn, -1); return; } diff --git a/tests/army/community/query/subquery/subqueryBugs.py b/tests/army/community/query/subquery/subqueryBugs.py new file mode 100644 index 0000000000..8442474d40 --- /dev/null +++ b/tests/army/community/query/subquery/subqueryBugs.py @@ -0,0 +1,94 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import frame.etool + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from frame.autogen import * + + +class TDTestCase(TBase): + + def ts_30189(self): + tdLog.info("create database ts_30189") + tdSql.execute(f"create database ts_30189") + tdSql.execute(f"use ts_30189") + sqls = [ + "CREATE STABLE `demo` (`_ts` TIMESTAMP, `faev` DOUBLE) TAGS (`deviceid` VARCHAR(256))", + "CREATE TABLE demo_201000008 USING demo (deviceid) TAGS ('201000008')", + "CREATE TABLE demo_K201000258 USING demo (deviceid) TAGS ('K201000258')", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-11-30 23:59:27.255', 51412.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:11:28.179', 51458.900999999998021)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-04 23:12:28.180', 51458.800999999999476)", + "INSERT INTO demo_201000008 (_ts,faev) VALUES ('2023-12-31 23:59:36.108', 52855.400999999998021)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-11-30 23:59:00.365', 258839.234375000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:00:00.381', 272188.843750000000000)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-28 05:01:00.600', 13.909012794494629)", + "INSERT INTO demo_K201000258 (_ts,faev) VALUES ('2023-12-31 23:59:00.366', 1886.711303710937500)", + ] + tdSql.executes(sqls) + sql1 = ''' + SELECT ts, deviceid, faev FROM ( + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, _ts AS ts, faev, DIFF(ROUND(faev*1000)/1000) AS diff_faev + FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid + ) WHERE diff_faev < 0 + ) UNION ALL + ( + SELECT deviceid, ts, faev FROM ( + SELECT deviceid, ts, faev, DIFF(ROUND(faev*1000)/1000) as diff_faev + FROM ( SELECT deviceid, _ts as ts , faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-12-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + ORDER BY ts desc ) PARTITION BY deviceid + ) WHERE diff_faev > 0 + ) + UNION ALL + ( + SELECT deviceid, LAST(_ts) AS ts, LAST(faev) AS faev FROM demo + WHERE deviceid in ('201000008') AND _ts >= '2023-11-01 00:00:00' AND _ts < '2024-01-01 00:00:00' + PARTITION BY deviceid INTERVAL(1n) + ) + ) order by ts + ''' + tdSql.query(sql1) + tdSql.checkRows(4) + + row1 = ['2023-11-30 23:59:27.255', "201000008", 51412.900999999998021] + row2 = ['2023-12-04 23:11:28.179', "201000008", 51458.900999999998021] + row3 = ['2023-12-04 23:12:28.180', "201000008", 51458.800999999999476] + row4 = ['2023-12-31 23:59:36.108', "201000008", 52855.400999999998021] + + rows = [row1, row2, row3, row4] + tdSql.checkDataMem(sql1, rows) + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # TS-30189 + self.ts_30189() + + + tdLog.success(f"{__file__} successfully executed") + + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 61687eeccd..12f2ee1689 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -27,6 +27,7 @@ ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py ,,n,army,python3 ./test.py -f community/query/show.py -N 3 ,,n,army,python3 ./test.py -f enterprise/alter/alterConfig.py -N 3 +,,y,army,./pytest.sh python3 ./test.py -f community/query/subquery/subqueryBugs.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/storage/oneStageComp.py -N 3 -L 3 -D 1 ,,y,army,./pytest.sh python3 ./test.py -f community/storage/compressBasic.py -N 3 diff --git a/tests/script/tsim/compress/compress_col.sim b/tests/script/tsim/compress/compress_col.sim index cc5b46fa06..ddf65b7f40 100644 --- a/tests/script/tsim/compress/compress_col.sim +++ b/tests/script/tsim/compress/compress_col.sim @@ -21,4 +21,15 @@ sql create table txx2 (ts timestamp compress 'disabled' level 'h', f int compres sql create table txx3 (ts timestamp compress 'disabled' level 'h', f int compress 'xz') sql create table txx4 (ts timestamp compress 'disabled' level 'h', f int compress 'zstd') + +sql alter table txx4 add column tt int compress 'xz' level 'h' +sql alter table txx4 drop column tt + +sql create stable sp(ts timestamp, c int) tags(t int) +sql alter table sp add column c1 int compress 'zstd' +sql alter table sp drop column c1 + +sql alter stable sp add column c1 int compress 'zstd' +sql alter stable sp drop column c1 + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 35f5e39214..8578f22084 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -222,7 +222,7 @@ class TDTestCase: tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") tdLog.info(len(tdSql.queryResult)) - tdSql.checkEqual(True, len(tdSql.queryResult) in range(255, 256)) + tdSql.checkEqual(True, len(tdSql.queryResult) in range(256, 257)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(54, len(tdSql.queryResult)) diff --git a/tests/system-test/2-query/avg.py b/tests/system-test/2-query/avg.py index dd8b38f9ea..34e4a19978 100644 --- a/tests/system-test/2-query/avg.py +++ b/tests/system-test/2-query/avg.py @@ -436,13 +436,13 @@ class TDTestCase: tdSql.execute(f"use db") tdSql.execute(f"create table db.st(ts timestamp, ibv bigint, ubv bigint unsigned) tags(area int)") # insert t1 data - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,9223372036854775801,18446744073709551611)") - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,8223372036854775801,17446744073709551611)") - tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,7223372036854775801,16446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 1s,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 2s,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now + 3s,7223372036854775801,16446744073709551611)") # insert t2 data - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,9223372036854775801,18446744073709551611)") - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,8223372036854775801,17446744073709551611)") - tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,7223372036854775801,16446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 1s,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 2s,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now + 3s,7223372036854775801,16446744073709551611)") # check single table answer tdSql.query(f"select avg(ibv), avg(ubv) from db.t1") diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 94e9babf3c..39b9c6d34a 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -278,6 +278,19 @@ class TDTestCase: self.checkDropData(False) return + + def checkSnapshot1VgroupBtmeta(self): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -c %s -sv 1 -dv 1 -s -bt'%(buildPath, cfgPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkJson(cfgPath, "tmq_taosx_tmp_snapshot") + self.checkData() + self.checkDropData(False) + + return def checkSnapshot1VgroupTable(self): buildPath = tdCom.getBuildPath() @@ -290,6 +303,18 @@ class TDTestCase: self.checkDataTable() return + + def checkSnapshot1VgroupTableBtmeta(self): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -c %s -sv 1 -dv 1 -s -t -bt'%(buildPath, cfgPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkJson(cfgPath, "tmq_taosx_tmp_snapshot") + self.checkDataTable() + + return def checkSnapshotMultiVgroups(self): buildPath = tdCom.getBuildPath() @@ -301,6 +326,17 @@ class TDTestCase: self.checkDropData(False) return + + def checkSnapshotMultiVgroupsBtmeta(self): + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -sv 2 -dv 4 -s -bt'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkData() + self.checkDropData(False) + + return def checkSnapshotMultiVgroupsWithDropTable(self): buildPath = tdCom.getBuildPath() @@ -311,6 +347,16 @@ class TDTestCase: self.checkDropData(True) return + + def checkSnapshotMultiVgroupsWithDropTableBtmeta(self): + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -sv 2 -dv 4 -s -d -bt'%(buildPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + self.checkDropData(True) + + return def consumeTest(self): tdSql.execute(f'create database if not exists d1 vgroups 1') @@ -472,6 +518,11 @@ class TDTestCase: self.checkSnapshotMultiVgroupsWithDropTable() + self.checkSnapshot1VgroupBtmeta() + self.checkSnapshot1VgroupTableBtmeta() + self.checkSnapshotMultiVgroupsBtmeta() + self.checkSnapshotMultiVgroupsWithDropTableBtmeta() + def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index a391093609..51d134a463 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -18,6 +18,7 @@ #include #include #include +#include "cJSON.h" #include "taos.h" #include "tmsg.h" #include "types.h" @@ -32,6 +33,7 @@ typedef struct { int srcVgroups; int dstVgroups; char dir[256]; + bool btMeta; } Config; Config g_conf = {0}; @@ -61,8 +63,23 @@ static void msg_process(TAOS_RES* msg) { if (result) { printf("meta result: %s\n", result); if (g_fp && strcmp(result, "") != 0) { - taosFprintfFile(g_fp, result); - taosFprintfFile(g_fp, "\n"); + // RES_TYPE__TMQ_BATCH_META + if ((*(int8_t*)msg) == 5) { + cJSON* pJson = cJSON_Parse(result); + cJSON* pJsonArray = cJSON_GetObjectItem(pJson, "metas"); + int32_t num = cJSON_GetArraySize(pJsonArray); + for (int32_t i = 0; i < num; i++) { + cJSON* pJsonItem = cJSON_GetArrayItem(pJsonArray, i); + char* itemStr = cJSON_PrintUnformatted(pJsonItem); + taosFprintfFile(g_fp, itemStr); + tmq_free_json_meta(itemStr); + taosFprintfFile(g_fp, "\n"); + } + cJSON_Delete(pJson); + } else { + taosFprintfFile(g_fp, result); + taosFprintfFile(g_fp, "\n"); + } } } tmq_free_json_meta(result); @@ -584,6 +601,10 @@ tmq_t* build_consumer() { tmq_conf_set(conf, "experimental.snapshot.enable", "true"); } + if (g_conf.btMeta) { + tmq_conf_set(conf, "msg.enable.batchmeta", "true"); + } + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); assert(tmq); @@ -1064,7 +1085,7 @@ void testConsumeExcluded(int topic_type) { char* topic = "create topic topic_excluded with meta as database db_taosx"; pRes = taos_query(pConn, topic); if (taos_errno(pRes) != 0) { - printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + printf("failed to create topic topic_excluded1, reason:%s\n", taos_errstr(pRes)); taos_close(pConn); return; } @@ -1073,7 +1094,7 @@ void testConsumeExcluded(int topic_type) { char* topic = "create topic topic_excluded as select * from stt"; pRes = taos_query(pConn, topic); if (taos_errno(pRes) != 0) { - printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + printf("failed to create topic topic_excluded2, reason:%s\n", taos_errstr(pRes)); taos_close(pConn); return; } @@ -1115,7 +1136,7 @@ void testConsumeExcluded(int topic_type) { assert(raw.raw_type != 2 && raw.raw_type != 4 && raw.raw_type != TDMT_VND_CREATE_STB && raw.raw_type != TDMT_VND_ALTER_STB && raw.raw_type != TDMT_VND_CREATE_TABLE && raw.raw_type != TDMT_VND_ALTER_TABLE && raw.raw_type != TDMT_VND_DELETE); - assert(raw.raw_type == TDMT_VND_DROP_STB || raw.raw_type == TDMT_VND_DROP_TABLE); + assert(raw.raw_type == TDMT_VND_DROP_STB || raw.raw_type == TDMT_VND_DROP_TABLE || raw.raw_type == 5); } else if (topic_type == 2) { assert(0); } @@ -1138,6 +1159,7 @@ void testConsumeExcluded(int topic_type) { taos_close(pConn); return; } + taos_close(pConn); taos_free_result(pRes); } @@ -1167,6 +1189,8 @@ int main(int argc, char* argv[]) { g_conf.subTable = true; } else if (strcmp(argv[i], "-onlymeta") == 0) { g_conf.meta = 1; + } else if (strcmp(argv[i], "-bt") == 0) { + g_conf.btMeta = true; } }