diff --git a/cmake/cmake.version b/cmake/cmake.version index 5bb1c61ac2..4b944e5ad0 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -11,6 +11,10 @@ ELSE () SET(TD_VER_COMPATIBLE "3.0.0.0") ENDIF () +IF (TD_EDITION_NAME) + ADD_DEFINITIONS(-DTD_EDITION_NAME="${TD_EDITION_NAME}") +ENDIF () + find_program(HAVE_GIT NAMES git) IF (DEFINED GITINFO) diff --git a/include/common/tgrant.h b/include/common/tgrant.h index 7e7162204e..b707045bd1 100644 --- a/include/common/tgrant.h +++ b/include/common/tgrant.h @@ -73,7 +73,7 @@ char *tGetMachineId(); #ifdef TD_ENTERPRISE #define GRANTS_SCHEMA \ static const SSysDbTableSchema grantsSchema[] = { \ - {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ + {.name = "version", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ @@ -85,7 +85,7 @@ char *tGetMachineId(); #else #define GRANTS_SCHEMA \ static const SSysDbTableSchema grantsSchema[] = { \ - {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ + {.name = "version", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \ diff --git a/include/util/cus_name.h b/include/util/cus_name.h index 16f677f855..76b09f3ea1 100644 --- a/include/util/cus_name.h +++ b/include/util/cus_name.h @@ -28,4 +28,5 @@ #define CUS_EMAIL "" #endif + #endif // _CUS_NAME_H_ diff --git a/include/util/tdef.h b/include/util/tdef.h index 6ded54dc00..3246e09a45 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -78,6 +78,14 @@ extern const int32_t TYPE_BYTES[21]; #define TSDB_DEFAULT_PASS "taosdata" #endif +#ifndef TD_EDITION_NAME +#ifdef TD_ENTERPRISE +#define TD_EDITION_NAME "TDengine Enterprise Edition" +#else +#define TD_EDITION_NAME "TDengine Community Edition" +#endif +#endif + #define TSDB_TRUE 1 #define TSDB_FALSE 0 #define TSDB_OK 0 diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index f7fcd7697f..6a68f580b2 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -258,12 +258,7 @@ static void dmPrintArgs(int32_t argc, char const *argv[]) { static void dmGenerateGrant() { mndGenerateMachineCode(); } static void dmPrintVersion() { -#ifdef TD_ENTERPRISE - char *releaseName = "enterprise"; -#else - char *releaseName = "community"; -#endif - printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version); + printf("%s: %s compatible_version: %s\n", TD_EDITION_NAME, version, compatible_version); printf("gitinfo: %s\n", gitinfo); #ifdef TD_ENTERPRISE printf("gitinfoOfInternal: %s\n", gitinfoOfInternal); diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 8dae4b3c11..32c2b50148 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -36,8 +36,7 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl if (pShow->numOfRows < 1) { cols = 0; SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - const char *src = "community"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); + STR_WITH_MAXSIZE_TO_VARSTR(tmp, TD_EDITION_NAME, 32); colDataSetVal(pColInfo, numOfRows, tmp, false); GRANT_ITEM_SHOW("unlimited"); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 1d1050c1ec..23765a8e67 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1189,12 +1189,11 @@ bool shellGetGrantInfo(char* buf) { fprintf(stderr, "\r\nFailed to get grant information from server. Abort.\r\n"); exit(0); } - - char serverVersion[32] = {0}; + char serverVersion[64] = {0}; char expiretime[32] = {0}; char expired[32] = {0}; - memcpy(serverVersion, row[0], fields[0].bytes); + tstrncpy(serverVersion, row[0], 64); memcpy(expiretime, row[1], fields[1].bytes); memcpy(expired, row[2], fields[2].bytes);