diff --git a/include/util/tdef.h b/include/util/tdef.h index f7ff0a111287d5f21cd8b3eba083e9bfac3777a5..eeaa34007a5ed173ca505254f30418ed0623a0db 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -118,6 +118,7 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_INS_TABLE_VGROUPS "vgroups" #define TSDB_INS_TABLE_BNODES "bnodes" #define TSDB_INS_TABLE_SNODES "snodes" +#define TSDB_INS_TABLE_LICENCES "grants" #define TSDB_INDEX_TYPE_SMA "SMA" #define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT" diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index 8fb4b02479866a23aaabc76568488a62522a673b..e002bbe444a15a9766c5828583c52ef346243617 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -24,13 +24,6 @@ target_include_directories( ) target_link_libraries(taosd dnode) -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(taosd grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(taosd usb_dongle) -ENDIF () - if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/source/dnode/mgmt/exe/dndMain.c b/source/dnode/mgmt/exe/dndMain.c index 80c431fe369c21b81525e402e49f7592766f1c6f..ae2b7343198b25af97fade9eb0e13953b7c842c7 100644 --- a/source/dnode/mgmt/exe/dndMain.c +++ b/source/dnode/mgmt/exe/dndMain.c @@ -91,7 +91,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } static void dndGenerateGrant() { - grantParseParameter(); + parseGrantParameter(); } static void dndPrintVersion() { diff --git a/source/dnode/mnode/impl/inc/mndGrant.h b/source/dnode/mnode/impl/inc/mndGrant.h index ad3dc7f79d2d9925e223880bde05560f1587fb11..a2ff5ea6ce0068ad73192e491367de926a552ea7 100644 --- a/source/dnode/mnode/impl/inc/mndGrant.h +++ b/source/dnode/mnode/impl/inc/mndGrant.h @@ -44,6 +44,7 @@ void grantReset(EGrantType grant, uint64_t value); void grantAdd(EGrantType grant, uint64_t value); void grantRestore(EGrantType grant, uint64_t value); +void parseGrantParameter(); #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 37f87142e6a4a999a9d86d9b2e2190fc8265ff63..c97d4dd8074a855129cf945b613743437e5cc1a3 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -28,4 +28,6 @@ void grantReset(EGrantType grant, uint64_t value) {} void grantAdd(EGrantType grant, uint64_t value) {} void grantRestore(EGrantType grant, uint64_t value) {} -#endif \ No newline at end of file +#endif + +void parseGrantParameter() { parseGrantParameter(); } \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index 64c3fbdefa9b3763064d81b67008fad31bf904cb..b210ee0d4fc79102e48dd34acc93e2b13b7b8ef9 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -151,6 +151,22 @@ static const SInfosTableSchema userUsersSchema[] = { {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, {.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, }; +static const SInfosTableSchema grantsSchema[] = { + {.name = "version", .bytes = 8 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "expire time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "storage(GB)", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "cpu cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "speed(PPS)", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, + {.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, +}; static const SInfosTableSchema vgroupsSchema[] = { {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}, @@ -211,6 +227,7 @@ static const SInfosTableMeta infosMeta[] = { {TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)}, {TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)}, {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)}, + {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema)}, }; // connection/application/ diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 808d488682e2e7c5892951ec4a61d3c4a857b4fd..f7f1d470bbf1ccb7bd087929e6b1747dfc020ff9 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -778,6 +778,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB tableType = TSDB_MGMT_TABLE_USER; } else if (strncasecmp(name, TSDB_INS_TABLE_DNODES, tListLen(pName->tname)) == 0) { tableType = TSDB_MGMT_TABLE_DNODE; + } else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, tListLen(pName->tname)) == 0) { + tableType = TSDB_MGMT_TABLE_GRANTS; } else if (strncasecmp(name, TSDB_INS_TABLE_MNODES, tListLen(pName->tname)) == 0) { tableType = TSDB_MGMT_TABLE_MNODE; } else if (strncasecmp(name, TSDB_INS_TABLE_MODULES, tListLen(pName->tname)) == 0) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b3947b872e2afa5dffecb40150213310abd7804a..7919fcedd1f12c827644625b102573f6041fdd09 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2363,7 +2363,6 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { break; case QUERY_NODE_SHOW_APPS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: - case QUERY_NODE_SHOW_LICENCE_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: case QUERY_NODE_SHOW_SCORES_STMT: case QUERY_NODE_SHOW_TOPICS_STMT: @@ -2551,6 +2550,8 @@ static const char* getSysTableName(ENodeType type) { return TSDB_INS_TABLE_BNODES; case QUERY_NODE_SHOW_SNODES_STMT: return TSDB_INS_TABLE_SNODES; + case QUERY_NODE_SHOW_LICENCE_STMT: + return TSDB_INS_TABLE_LICENCES; default: break; } @@ -3058,6 +3059,7 @@ static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pQuery->pRoot)) { + case QUERY_NODE_SHOW_LICENCE_STMT: case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: