fix(s3/grant): checking grant when doing migrate
This commit is contained in:
parent
b318121e8e
commit
b6eec20dfb
|
@ -296,6 +296,7 @@ char tsS3AccessKeySecret[TSDB_FQDN_LEN] = "<accesskeysecrect>";
|
|||
char tsS3BucketName[TSDB_FQDN_LEN] = "<bucketname>";
|
||||
char tsS3AppId[TSDB_FQDN_LEN] = "<appid>";
|
||||
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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue