diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 8b7901e2a7..f4999ed368 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -296,6 +296,7 @@ char tsS3AccessKeySecret[TSDB_FQDN_LEN] = ""; char tsS3BucketName[TSDB_FQDN_LEN] = ""; char tsS3AppId[TSDB_FQDN_LEN] = ""; int8_t tsS3Enabled = false; +int8_t tsS3EnabledCfg = false; int8_t tsS3Oss = false; int8_t tsS3StreamEnabled = false; @@ -375,6 +376,7 @@ int32_t taosSetS3Cfg(SConfig *pCfg) { #if defined(USE_COS) || defined(USE_S3) #ifdef TD_ENTERPRISE /*if (tsDiskCfgNum > 1) */ tsS3Enabled = true; + tsS3EnabledCfg = true; #endif tsS3StreamEnabled = true; #endif diff --git a/source/dnode/mgmt/node_mgmt/CMakeLists.txt b/source/dnode/mgmt/node_mgmt/CMakeLists.txt index 4f362f5a74..82b9384d66 100644 --- a/source/dnode/mgmt/node_mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/node_mgmt/CMakeLists.txt @@ -16,11 +16,6 @@ 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 4619214f40..8e760c28be 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -166,12 +166,6 @@ 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 diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 5a138d2bed..f4344296b4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -757,6 +757,16 @@ _exit: int32_t tsdbS3Migrate(STsdb *tsdb, int64_t now, int32_t sync) { int32_t code = 0; + extern int8_t tsS3EnabledCfg; + + int32_t expired = grantCheck(TSDB_GRANT_OBJECT_STORAGE); + if (expired && tsS3Enabled) { + tsdbWarn("s3 grant expired: %d", expired); + tsS3Enabled = false; + } else if (!expired && tsS3EnabledCfg) { + tsS3Enabled = true; + } + if (!tsS3Enabled) { return code; }