Skip to content

Commit 83bdd49

Browse files
committed
make with USE_AWS=1 and without USE_GCP=1 work properly
1 parent e071e2e commit 83bdd49

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

cloud/cloud_file_system.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ int DoRegisterCloudObjects(ObjectLibrary& library, std::string const& arg) {
488488
count++;
489489

490490
count += CloudFileSystemImpl::RegisterAwsObjects(library, arg);
491+
#ifdef USE_GCP // Only register GCP if we have it
491492
count += CloudFileSystemImpl::RegisterGcpObjects(library, arg);
493+
#endif
492494

493495
// Register the Cloud Log Controllers
494496

cloud/gcp/gcp_file_system.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#ifndef ROCKSDB_LITE
22

3+
#ifdef USE_GCP
4+
35
#include <string>
46

57
#include "rocksdb/convenience.h"
@@ -8,8 +10,6 @@
810
#include "cloud/gcp/gcp_file_system.h"
911
#include "cloud/cloud_storage_provider_impl.h"
1012

11-
#ifdef USE_GCP
12-
1313
namespace ROCKSDB_NAMESPACE {
1414
GcpFileSystem::GcpFileSystem(std::shared_ptr<FileSystem> const& underlying_fs,
1515
CloudFileSystemOptions const& cloud_options,
@@ -75,7 +75,6 @@ Status GcpFileSystem::PrepareOptions(ConfigOptions const& options) {
7575
int CloudFileSystemImpl::RegisterGcpObjects(ObjectLibrary& library,
7676
std::string const& /*arg*/) {
7777
int count = 0;
78-
#ifdef USE_GCP
7978
library.AddFactory<FileSystem>(
8079
CloudFileSystemImpl::kGcp(),
8180
[](std::string const& /*uri*/, std::unique_ptr<FileSystem>* guard,
@@ -92,7 +91,7 @@ int CloudFileSystemImpl::RegisterGcpObjects(ObjectLibrary& library,
9291
}
9392
});
9493
count++;
95-
#endif
94+
9695
library.AddFactory<CloudStorageProvider>(
9796
CloudStorageProviderImpl::kGcs(),
9897
[](std::string const& /*uri*/,

cloud/gcp/gcp_file_system_test.cc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright (c) 2017 Rockset
22

3+
#ifndef ROCKSDB_LITE
4+
5+
#ifdef USE_GCP
6+
37
#include "rocksdb/cloud/cloud_file_system.h"
48

59
#include "cloud/cloud_log_controller_impl.h"
@@ -204,4 +208,23 @@ TEST(CloudFileSystemTest, ConfigureGcsProvider) {
204208
int main(int argc, char** argv) {
205209
::testing::InitGoogleTest(&argc, argv);
206210
return RUN_ALL_TESTS();
207-
}
211+
}
212+
213+
#else // USE_GCP
214+
#include <stdio.h>
215+
216+
int main(int, char**) {
217+
fprintf(stderr,
218+
"SKIPPED as DBCloud is supported only when USE_GCP is defined.\n");
219+
return 0;
220+
}
221+
#endif // USE_GCP
222+
223+
#else // ROCKSDB_LITE
224+
#include <stdio.h>
225+
226+
int main(int, char**) {
227+
fprintf(stderr, "SKIPPED as DBCloud is not supported in ROCKSDB_LITE.\n");
228+
return 0;
229+
}
230+
#endif // ROCKSDB_LITE

cloud/gcp/gcp_retry.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#include "cloud/gcp/gcp_file_system.h"
2-
#include "rocksdb/cloud/cloud_file_system.h"
31
#include <chrono>
42

3+
#include "rocksdb/cloud/cloud_file_system.h"
4+
55
#ifdef USE_GCP
6+
#include "cloud/gcp/gcp_file_system.h"
7+
68
#include <google/cloud/optional.h>
79
#include <google/cloud/options.h>
810
#include <google/cloud/retry_policy.h>
@@ -47,7 +49,7 @@ class GcpRetryPolicy : public gcs::RetryPolicy {
4749
"[gcs] Encountered failure: %s"
4850
"retry attempt %d exceeds max retries %d. Aborting...",
4951
s.message().c_str(), failure_count_, maximum_failures_);
50-
// retry count exceed maxnum, but is not nonretryable
52+
// retry count exceed maxium, but is not nonretryable
5153
return false;
5254
}
5355
} else {
@@ -112,12 +114,12 @@ Status GcpCloudOptions::GetClientConfiguration(CloudFileSystem* fs,
112114
GcpRetryPolicy(fs, std::chrono::milliseconds(timeout_ms)).clone());
113115
return Status::OK();
114116
}
115-
#else
116-
Status GcpCloudOptions::GetClientConfiguration(CloudFileSystem*,
117-
std::string const&,
118-
gcp::Options&) {
119-
return Status::NotSupported("Not configured for GCP support");
120-
}
117+
//#else
118+
//Status GcpCloudOptions::GetClientConfiguration(CloudFileSystem*,
119+
//std::string const&,
120+
//gcp::Options&) {
121+
//return Status::NotSupported("Not configured for GCP support");
122+
//}
121123
#endif /* USE_GCP */
122124

123125
} // namespace ROCKSDB_NAMESPACE

src.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ TEST_MAIN_SOURCES = \
445445
cache/lru_cache_test.cc \
446446
cloud/db_cloud_test.cc \
447447
cloud/cloud_file_system_test.cc \
448-
cloud/gcp/gcp_file_system_test.cc \
449-
cloud/gcp/gcp_db_cloud_test.cc \
448+
cloud/gcp/gcp_file_system_test.cc \
449+
cloud/gcp/gcp_db_cloud_test.cc \
450450
cloud/cloud_manifest_test.cc \
451451
cloud/cloud_scheduler_test.cc \
452452
cloud/replication_test.cc \

0 commit comments

Comments
 (0)