diff --git a/source/dnode/mgmt/node_mgmt/CMakeLists.txt b/source/dnode/mgmt/node_mgmt/CMakeLists.txt index 82b9384d66..4f362f5a74 100644 --- a/source/dnode/mgmt/node_mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/node_mgmt/CMakeLists.txt @@ -16,6 +16,11 @@ IF (DEFINED GRANT_CFG_INCLUDE_DIR) add_definitions(-DGRANTS_CFG) ENDIF() +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) + TARGET_LINK_LIBRARIES(dnode grant) +ENDIF () + target_include_directories( dnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 12712d6585..4619214f40 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -17,6 +17,7 @@ #include "dmMgmt.h" #include "audit.h" #include "libs/function/tudf.h" +#include "tgrant.h" #define DM_INIT_AUDIT() \ do { \ @@ -150,6 +151,7 @@ static bool dmCheckDataDirVersion() { extern int32_t s3Begin(); extern void s3End(); +extern int8_t tsS3Enabled; #endif @@ -164,6 +166,12 @@ int32_t dmInit() { if (dmInitAudit() != 0) return -1; if (dmInitDnode(dmInstance()) != 0) return -1; #if defined(USE_S3) + int32_t expired = grantCheck(TSDB_GRANT_OBJECT_STORAGE); + if (expired && tsS3Enabled) { + dWarn("s3 grant expired: %d", expired); + tsS3Enabled = false; + } + if (s3Begin() != 0) return -1; #endif