Skip to content

Commit 6cc9f3b

Browse files
committed
Address PR issues
1 parent 868d13a commit 6cc9f3b

12 files changed

+14
-105
lines changed

cloud/aws/aws_env.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Status AwsCloudAccessCredentials::TEST_Initialize() {
7676
Status AwsCloudAccessCredentials::CheckCredentials(
7777
const AwsAccessType& aws_type) const {
7878
#ifndef USE_AWS
79-
(void) aws_type;
79+
(void)aws_type;
8080
return Status::NotSupported("AWS not supported");
8181
#else
8282
if (aws_type == AwsAccessType::kSimple) {

cloud/aws/aws_kafka.cc

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ class KafkaController : public CloudLogControllerImpl {
203203
virtual CloudLogWritableFile* CreateWritableFile(const std::string& fname,
204204
const EnvOptions& options) override;
205205

206-
Status Verify() const override;
207-
208206
protected:
209207
Status Initialize(CloudEnv* env) override;
210208

@@ -240,12 +238,11 @@ Status KafkaController::Initialize(CloudEnv* env) {
240238
for (auto const& item : kconf) {
241239
if (conf->set(item.first, item.second, conf_errstr) !=
242240
RdKafka::Conf::CONF_OK) {
243-
s = Status::InvalidArgument(
244-
"Failed adding specified conf to Kafka conf", conf_errstr.c_str());
241+
s = Status::InvalidArgument("Failed adding specified conf to Kafka conf",
242+
conf_errstr.c_str());
245243

246244
Log(InfoLogLevel::ERROR_LEVEL, env->info_log_,
247-
"[aws] NewAwsEnv Kafka conf set error: %s",
248-
s.ToString().c_str());
245+
"[aws] NewAwsEnv Kafka conf set error: %s", s.ToString().c_str());
249246
return s;
250247
}
251248
}
@@ -288,24 +285,6 @@ Status KafkaController::Initialize(CloudEnv* env) {
288285
return s;
289286
}
290287

291-
Status KafkaController::Verify() const {
292-
Status s = CloudLogControllerImpl::Verify();
293-
if (s.ok()) {
294-
if (!producer_) {
295-
s = Status::InvalidArgument("Failed creating Kafka producer");
296-
} else if (!consumer_) {
297-
s = Status::InvalidArgument("Failed creating Kafka consumer");
298-
} else if (producer_topic_ == nullptr) {
299-
s = Status::InvalidArgument("Failed to initialize Kafa Producer Topic");
300-
} else if (consumer_topic_ == nullptr) {
301-
s = Status::InvalidArgument("Failed to initialize Kafa Consumer Topic");
302-
} else if (consuming_queue_ == nullptr) {
303-
s = Status::InvalidArgument("Failed to initialize Kafa Consuming Queue");
304-
}
305-
}
306-
return s;
307-
}
308-
309288
Status KafkaController::TailStream() {
310289
InitializePartitions();
311290

cloud/aws/aws_kinesis.cc

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ class KinesisController : public CloudLogControllerImpl {
189189

190190
CloudLogWritableFile* CreateWritableFile(const std::string& fname,
191191
const EnvOptions& options) override;
192-
Status Verify() const override;
193-
194192
protected:
195193
Status Initialize(CloudEnv* env) override;
196194

@@ -212,40 +210,30 @@ class KinesisController : public CloudLogControllerImpl {
212210
};
213211

214212
Status KinesisController::Initialize(CloudEnv* env) {
215-
Status status = CloudLogControllerImpl::Initialize(env);
216-
if (status.ok()) {
213+
Status st = CloudLogControllerImpl::Initialize(env);
214+
if (st.ok()) {
217215
Aws::Client::ClientConfiguration config;
218216
const auto& options = env->GetCloudEnvOptions();
219217
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> provider;
220-
status = options.credentials.GetCredentialsProvider(&provider);
221-
if (status.ok()) {
222-
status = AwsCloudOptions::GetClientConfiguration(
218+
st = options.credentials.GetCredentialsProvider(&provider);
219+
if (st.ok()) {
220+
st = AwsCloudOptions::GetClientConfiguration(
223221
env, options.src_bucket.GetRegion(), &config);
224222
}
225-
if (status.ok()) {
223+
if (st.ok()) {
226224
kinesis_client_.reset(
227225
provider ? new Aws::Kinesis::KinesisClient(provider, config)
228226
: new Aws::Kinesis::KinesisClient(config));
229227
// Initialize stream name.
230228
std::string bucket = env->GetSrcBucketName();
231229
topic_ = Aws::String(bucket.c_str(), bucket.size());
232230

233-
Log(InfoLogLevel::DEBUG_LEVEL, env->info_log_,
231+
Log(InfoLogLevel::INFO_LEVEL, env->info_log_,
234232
"[%s] KinesisController opening stream %s using cachedir '%s'",
235233
Name(), topic_.c_str(), cache_dir_.c_str());
236234
}
237235
}
238-
return status;
239-
}
240-
241-
Status KinesisController::Verify() const {
242-
Status s = CloudLogControllerImpl::Verify();
243-
if (s.ok()) {
244-
if (!kinesis_client_) {
245-
s = Status::InvalidArgument("Failed to initialize kinesis client");
246-
}
247-
}
248-
return s;
236+
return st;
249237
}
250238

251239
Status KinesisController::TailStream() {

cloud/aws/aws_s3.cc

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <aws/s3/model/PutObjectResult.h>
3434
#include <aws/s3/model/ServerSideEncryption.h>
3535
#include <aws/transfer/TransferManager.h>
36-
#endif // USE_AWS
36+
#endif // USE_AWS
3737

3838
#include <cassert>
3939
#include <cinttypes>
@@ -389,8 +389,6 @@ class S3StorageProvider : public CloudStorageProviderImpl {
389389
const std::string& object_path,
390390
std::unique_ptr<CloudStorageWritableFile>* result,
391391
const EnvOptions& options) override;
392-
Status Verify() const override;
393-
394392
protected:
395393
Status Initialize(CloudEnv* env) override;
396394
Status DoGetObject(const std::string& bucket_name,
@@ -451,16 +449,6 @@ Status S3StorageProvider::Initialize(CloudEnv* env) {
451449
return status;
452450
}
453451

454-
Status S3StorageProvider::Verify() const {
455-
Status s = CloudStorageProviderImpl::Verify();
456-
if (s.ok()) {
457-
if (!s3client_) {
458-
s = Status::InvalidArgument("S3Client Failed to initialize");
459-
}
460-
}
461-
return s;
462-
}
463-
464452
//
465453
// Create bucket in S3 if it does not already exist.
466454
//

cloud/cloud_env_impl.cc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -999,24 +999,6 @@ Status CloudEnvImpl::RollNewEpoch(const std::string& local_dbname) {
999999
return Status::OK();
10001000
}
10011001

1002-
Status CloudEnvImpl::Verify() const {
1003-
Status s;
1004-
if (!cloud_env_options.storage_provider) {
1005-
s = Status::InvalidArgument(
1006-
"Cloud environment requires a storage provider");
1007-
} else {
1008-
s = cloud_env_options.storage_provider->Verify();
1009-
}
1010-
if (s.ok()) {
1011-
if (cloud_env_options.cloud_log_controller) {
1012-
s = cloud_env_options.cloud_log_controller->Verify();
1013-
} else if (!cloud_env_options.keep_local_log_files) {
1014-
s = Status::InvalidArgument(
1015-
"Log controller required for remote log files");
1016-
}
1017-
}
1018-
return s;
1019-
}
10201002
Status CloudEnvImpl::Prepare() {
10211003
Header(info_log_, " %s.src_bucket_name: %s", Name(),
10221004
cloud_env_options.src_bucket.GetBucketName().c_str());

cloud/cloud_env_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class CloudEnvImpl : public CloudEnv {
106106

107107
protected:
108108
virtual Status Prepare();
109-
virtual Status Verify() const;
110109

111110
// Does the dir need to be re-initialized?
112111
Status NeedsReinitialization(const std::string& clone_dir, bool* do_reinit);

cloud/cloud_log_controller.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@ Status CloudLogControllerImpl::Prepare(CloudEnv* env) {
7676
return status_;
7777
}
7878

79-
Status CloudLogControllerImpl::Verify() const {
80-
if (!status_.ok()) {
81-
return status_;
82-
} else if (!env_) {
83-
return Status::InvalidArgument("Log Controller not initialized: ", Name());
84-
}
85-
return status_;
86-
}
87-
8879
std::string CloudLogControllerImpl::GetCachePath(
8980
const Slice& original_pathname) const {
9081
const std::string & cache_dir = GetCacheDir();

cloud/cloud_log_controller_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class CloudLogControllerImpl : public CloudLogController {
5555
Status FileExists(const std::string& fname) override;
5656
Status GetFileSize(const std::string& logical_fname, uint64_t* size) override;
5757
virtual Status Prepare(CloudEnv* env) override;
58-
virtual Status Verify() const override;
59-
6058
protected:
6159
virtual Status Initialize(CloudEnv* env);
6260
// Converts an original pathname to a pathname in the cache.

cloud/cloud_storage_provider.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,6 @@ CloudStorageProviderImpl::CloudStorageProviderImpl() : rng_(time(nullptr)) {}
286286

287287
CloudStorageProviderImpl::~CloudStorageProviderImpl() {}
288288

289-
Status CloudStorageProviderImpl::Verify() const {
290-
if (!status_.ok()) {
291-
return status_;
292-
} else if (!env_) {
293-
return Status::InvalidArgument("Storage Provider not initialized: ",
294-
Name());
295-
} else {
296-
return Status::OK();
297-
}
298-
}
299-
300289
Status CloudStorageProviderImpl::Prepare(CloudEnv* env) {
301290
status_ = Initialize(env);
302291
if (status_.ok()) {

cloud/cloud_storage_provider_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ class CloudStorageProviderImpl : public CloudStorageProvider {
117117
std::unique_ptr<CloudStorageReadableFile>* result,
118118
const EnvOptions& options) override;
119119
virtual Status Prepare(CloudEnv* env) override;
120-
virtual Status Verify() const override;
121-
122120
protected:
123121
Random64 rng_;
124122
virtual Status Initialize(CloudEnv* env);

0 commit comments

Comments
 (0)