az: remove unused key newing

This commit is contained in:
Minglei Jin 2024-10-16 17:27:32 +08:00
parent b05784f524
commit d81fa80865
5 changed files with 28 additions and 26 deletions

View File

@ -4,7 +4,7 @@ aux_source_directory(. MNODE_ARBGROUP_TEST_SRC)
add_executable(arbgroupTest ${MNODE_ARBGROUP_TEST_SRC}) add_executable(arbgroupTest ${MNODE_ARBGROUP_TEST_SRC})
target_link_libraries( target_link_libraries(
arbgroupTest arbgroupTest
PRIVATE dnode nodes planner gtest qcom PRIVATE dnode nodes planner gtest qcom tcs
) )
add_test( add_test(

View File

@ -72,8 +72,6 @@ static int32_t azListBucket(char const *bucketname) {
try { try {
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
std::string containerName = bucketname; std::string containerName = bucketname;
@ -217,7 +215,6 @@ int32_t azPutObjectFromFileOffset(const char *file, const char *object_name, int
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
std::string accountURL = tsS3Hostname[0]; std::string accountURL = tsS3Hostname[0];
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
accountURL = "https://" + accountURL; accountURL = "https://" + accountURL;
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
@ -278,8 +275,6 @@ int32_t azGetObjectBlockImpl(const char *object_name, int64_t offset, int64_t si
try { try {
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
accountURL = "https://" + accountURL; accountURL = "https://" + accountURL;
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
@ -353,8 +348,6 @@ void azDeleteObjectsByPrefix(const char *prefix) {
try { try {
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
std::string containerName = tsS3BucketName; std::string containerName = tsS3BucketName;
@ -414,8 +407,6 @@ int32_t azGetObjectToFile(const char *object_name, const char *fileName) {
try { try {
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
std::string containerName = tsS3BucketName; std::string containerName = tsS3BucketName;
@ -450,8 +441,6 @@ int32_t azGetObjectsByPrefix(const char *prefix, const char *path) {
try { try {
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey); auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
StorageSharedKeyCredential *pSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential); BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
std::string containerName = tsS3BucketName; std::string containerName = tsS3BucketName;

View File

@ -12,8 +12,8 @@ if(${BUILD_WITH_ROCKSDB})
if (${BUILD_CONTRIB}) if (${BUILD_CONTRIB})
target_link_libraries( target_link_libraries(
stream stream
PUBLIC rocksdb tdb PUBLIC rocksdb tdb tcs
PRIVATE os util transport qcom executor wal index tcs PRIVATE os util transport qcom executor wal index
) )
target_include_directories( target_include_directories(
stream stream
@ -31,14 +31,14 @@ if(${BUILD_WITH_ROCKSDB})
) )
target_link_libraries( target_link_libraries(
stream stream
PUBLIC rocksdb tdb PUBLIC rocksdb tdb tcs
PRIVATE os util transport qcom executor wal index tcs PRIVATE os util transport qcom executor wal index
) )
else() else()
target_link_libraries( target_link_libraries(
stream stream
PUBLIC rocksdb tdb PUBLIC rocksdb tdb tcs
PRIVATE os util transport qcom executor wal index tcs PRIVATE os util transport qcom executor wal index
) )
target_include_directories( target_include_directories(
stream stream
@ -59,4 +59,3 @@ endif(${BUILD_WITH_ROCKSDB})
if(${BUILD_TEST}) if(${BUILD_TEST})
ADD_SUBDIRECTORY(test) ADD_SUBDIRECTORY(test)
endif(${BUILD_TEST}) endif(${BUILD_TEST})

View File

@ -4,6 +4,7 @@
#include <queue> #include <queue>
#include "tcs.h" #include "tcs.h"
#include "tcsInt.h"
int32_t tcsInitEnv() { int32_t tcsInitEnv() {
int32_t code = 0; int32_t code = 0;
@ -19,7 +20,21 @@ int32_t tcsInitEnv() {
tsS3AccessKeySecret[0] = "<access-key-secret/account-key>"; tsS3AccessKeySecret[0] = "<access-key-secret/account-key>";
tsS3BucketName = "<bucket/container-name>"; tsS3BucketName = "<bucket/container-name>";
*/ */
const char *hostname = "endpoint/<account-name>.blob.core.windows.net";
const char *accessKeyId = "<access-key-id/account-name>";
const char *accessKeySecret = "<access-key-secret/account-key>";
const char *bucketName = "<bucket/container-name>";
tstrncpy(&tsS3Hostname[0][0], hostname, TSDB_FQDN_LEN);
tstrncpy(&tsS3AccessKeyId[0][0], accessKeyId, TSDB_FQDN_LEN);
tstrncpy(&tsS3AccessKeySecret[0][0], accessKeySecret, TSDB_FQDN_LEN);
tstrncpy(tsS3BucketName, bucketName, TSDB_FQDN_LEN);
tstrncpy(tsTempDir, "/tmp/", PATH_MAX);
tsS3Enabled = true; tsS3Enabled = true;
tsS3Ablob = true;
return code; return code;
} }
@ -28,11 +43,10 @@ int32_t tcsInitEnv() {
TEST(TcsTest, InterfaceTest) { TEST(TcsTest, InterfaceTest) {
int code = 0; int code = 0;
if (!tsS3Enabled) { code = tcsInitEnv();
(void)fprintf(stderr, "tcs not configured.\n"); GTEST_ASSERT_EQ(code, 0);
GTEST_ASSERT_EQ(tsS3Enabled, 1);
return; GTEST_ASSERT_EQ(tsS3Ablob, 1);
}
code = tcsInit(); code = tcsInit();
GTEST_ASSERT_EQ(code, 0); GTEST_ASSERT_EQ(code, 0);