Skip to content

Commit 9d3e9a1

Browse files
committed
Fix various build modes
Attempt to fix the cloud build to successfully build: - make unity_test - LITE=1 - COMPILE_WITH_TSAN
1 parent 1590a1c commit 9d3e9a1

File tree

11 files changed

+34
-24
lines changed

11 files changed

+34
-24
lines changed

cloud/aws/aws_env.cc

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2016-present, Rockset, Inc. All rights reserved.
22
//
3+
#ifndef ROCKSDB_LITE
34
#include "cloud/aws/aws_env.h"
45

56
#include <chrono>
@@ -18,7 +19,7 @@
1819
#include "rocksdb/cloud/cloud_storage_provider.h"
1920
#include "rocksdb/env.h"
2021
#include "rocksdb/status.h"
21-
#include "util/stderr_logger.h"
22+
#include "rocksdb/utilities/options_type.h"
2223
#include "util/string_util.h"
2324

2425
#ifdef USE_AWS
@@ -41,16 +42,6 @@ static const std::unordered_map<std::string, AwsAccessType> AwsAccessTypeMap = {
4142
{"anonymous", AwsAccessType::kAnonymous},
4243
};
4344

44-
template <typename T>
45-
bool ParseEnum(const std::unordered_map<std::string, T>& type_map,
46-
const std::string& type, T* value) {
47-
auto iter = type_map.find(type);
48-
if (iter != type_map.end()) {
49-
*value = iter->second;
50-
return true;
51-
}
52-
return false;
53-
}
5445

5546
AwsAccessType AwsCloudAccessCredentials::GetAccessType() const {
5647
if (type != AwsAccessType::kUndefined) {
@@ -177,8 +168,7 @@ Status AwsCloudAccessCredentials::GetCredentialsProvider(
177168
//
178169
AwsEnv::AwsEnv(Env* underlying_env, const CloudEnvOptions& _cloud_env_options,
179170
const std::shared_ptr<Logger>& info_log)
180-
: CloudEnvImpl(_cloud_env_options, underlying_env, info_log),
181-
rng_(time(nullptr)) {
171+
: CloudEnvImpl(_cloud_env_options, underlying_env, info_log) {
182172
Aws::InitAPI(Aws::SDKOptions());
183173
if (cloud_env_options.src_bucket.GetRegion().empty() ||
184174
cloud_env_options.dest_bucket.GetRegion().empty()) {
@@ -370,3 +360,4 @@ std::string AwsEnv::GetWALCacheDir() {
370360

371361
#endif // USE_AWS
372362
} // namespace ROCKSDB_NAMESPACE
363+
#endif // ROCKSDB_LITE

cloud/aws/aws_env.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <iostream>
1010

1111
#include "cloud/cloud_env_impl.h"
12-
#include "port/sys_time.h"
13-
#include "util/random.h"
1412

1513
#ifdef USE_AWS
1614

@@ -93,8 +91,6 @@ class AwsEnv : public CloudEnvImpl {
9391

9492
// The pathname that contains a list of all db's inside a bucket.
9593
static constexpr const char* dbid_registry_ = "/.rockset/dbid/";
96-
97-
Random64 rng_;
9894
};
9995

10096
} // namespace ROCKSDB_NAMESPACE

cloud/aws/aws_s3.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// A directory maps to an an zero-size object in an S3 bucket
55
// A sst file maps to an object in that S3 bucket.
66
//
7+
#ifndef ROCKSDB_LITE
78
#ifdef USE_AWS
89
#include <aws/core/Aws.h>
910
#include <aws/core/utils/Outcome.h>
@@ -903,7 +904,7 @@ Status S3StorageProvider::DoPutCloudObject(const std::string& local_file,
903904
}
904905

905906
#endif /* USE_AWS */
906-
907+
907908
Status CloudStorageProviderImpl::CreateS3Provider(
908909
std::shared_ptr<CloudStorageProvider>* provider) {
909910
#ifndef USE_AWS
@@ -916,3 +917,4 @@ Status CloudStorageProviderImpl::CreateS3Provider(
916917
#endif /* USE_AWS */
917918
}
918919
} // namespace ROCKSDB_NAMESPACE
920+
#endif // ROCKSDB_LITE

cloud/cloud_scheduler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class LocalCloudScheduler : public CloudScheduler {
7272
long local_id)
7373
: scheduler_(scheduler), next_local_id_(local_id) {}
7474
~LocalCloudScheduler() override {
75-
for (const auto job : jobs_) {
75+
for (const auto& job : jobs_) {
7676
scheduler_->CancelJob(job.second);
7777
}
7878
jobs_.clear();

cloud/cloud_scheduler_test.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2017 Rockset
22

3+
#ifndef ROCKSDB_LITE
34
#include "cloud/cloud_scheduler.h"
45

56
#include <gtest/gtest.h>
@@ -159,3 +160,12 @@ int main(int argc, char **argv) {
159160
::testing::InitGoogleTest(&argc, argv);
160161
return RUN_ALL_TESTS();
161162
}
163+
#else
164+
#include <stdio.h>
165+
166+
int main(int /*argc*/, char** /*argv*/) {
167+
fprintf(stderr, "SKIPPED as CloudSchedulerTest is not supported in ROCKSDB_LITE\n");
168+
return 0;
169+
}
170+
171+
#endif // ROCKSDB_LITE

cloud/cloud_storage_provider.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "util/string_util.h"
2121

2222
namespace ROCKSDB_NAMESPACE {
23-
23+
#ifndef ROCKSDB_LITE
2424
/******************** Readablefile ******************/
2525
CloudStorageReadableFileImpl::CloudStorageReadableFileImpl(
2626
const std::shared_ptr<Logger>& info_log, const std::string& bucket,
@@ -361,4 +361,5 @@ Status CloudStorageProviderImpl::PutCloudObject(
361361
return DoPutCloudObject(local_file, bucket_name, object_path, fsize);
362362
}
363363

364+
#endif //ROCKSDB_LITE
364365
} // namespace ROCKSDB_NAMESPACE

cloud/db_cloud_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ int main(int, char**) {
15591559

15601560
#include <stdio.h>
15611561

1562-
int main(int argc, char** argv) {
1562+
int main(int, char** ) {
15631563
fprintf(stderr, "SKIPPED as DBCloud is not supported in ROCKSDB_LITE\n");
15641564
return 0;
15651565
}

cloud/remote_compaction_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ int main(int, char**) {
517517

518518
#include <stdio.h>
519519

520-
int main(int argc, char** argv) {
520+
int main(int, char**) {
521521
fprintf(stderr, "SKIPPED as DBCloud is not supported in ROCKSDB_LITE\n");
522522
return 0;
523523
}

db/db_impl/db_impl_remote_compaction.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,15 @@ Status DBImpl::doCompact(const CompactionOptions& compact_options,
151151
// remove this compaction job from the list of compactions
152152
c->ReleaseCompactionFiles(s);
153153

154+
#ifndef ROCKSDB_LITE
154155
// Make sure SstFileManager does its bookkeeping
155156
auto sfm = static_cast<SstFileManagerImpl*>(
156157
immutable_db_options_.sst_file_manager.get());
157158
if (sfm) {
158159
sfm->OnCompactionCompletion(c.get());
159160
}
160-
161+
#endif // ROCKSDB_LITE
162+
161163
// remove our iterator
162164
ReleaseFileNumberFromPendingOutputs(pending_outputs_inserted_elem);
163165

db/db_test_util.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ DBTestBase::DBTestBase(const std::string path, bool env_do_fsync)
9595
#endif // !ROCKSDB_LITE
9696
env_ = new SpecialEnv(encrypted_env_ ? encrypted_env_
9797
: (mem_env_ ? mem_env_ : base_env));
98+
#ifndef ROCKSDB_LITE
9899
#ifdef USE_AWS
99100
// Randomize the test path so that multiple tests can run in parallel
100101
srand(static_cast<unsigned int>(time(nullptr)));
@@ -104,6 +105,7 @@ DBTestBase::DBTestBase(const std::string path, bool env_do_fsync)
104105
info_log_->SetInfoLogLevel(InfoLogLevel::DEBUG_LEVEL);
105106
s3_env_ = CreateNewAwsEnv(mypath, env_);
106107
#endif
108+
#endif // !ROCKSDB_LITE
107109
env_->SetBackgroundThreads(1, Env::LOW);
108110
env_->SetBackgroundThreads(1, Env::HIGH);
109111
env_->skip_fsync_ = !env_do_fsync;
@@ -141,11 +143,13 @@ DBTestBase::~DBTestBase() {
141143
}
142144
delete env_;
143145

146+
#ifndef ROCKSDB_LITE
144147
#ifdef USE_AWS
145148
auto aenv = dynamic_cast<CloudEnv*>(s3_env_);
146149
aenv->GetCloudEnvOptions().storage_provider->EmptyBucket(
147150
aenv->GetSrcBucketName(), aenv->GetSrcObjectPath());
148151
#endif
152+
#endif // !ROCKSDB_LITE
149153
delete s3_env_;
150154
}
151155

@@ -645,6 +649,7 @@ Options DBTestBase::GetOptions(
645649
return options;
646650
}
647651

652+
#ifndef ROCKSDB_LITE
648653
#ifdef USE_AWS
649654
Env* DBTestBase::CreateNewAwsEnv(const std::string& prefix, Env* parent) {
650655
if (!prefix.empty()) {
@@ -666,7 +671,8 @@ Env* DBTestBase::CreateNewAwsEnv(const std::string& prefix, Env* parent) {
666671
assert(st.ok() && cenv);
667672
return cenv;
668673
}
669-
#endif
674+
#endif // USE_AWS
675+
#endif // ROCKSDB_LITE
670676

671677
void DBTestBase::CreateColumnFamilies(const std::vector<std::string>& cfs,
672678
const Options& options) {

0 commit comments

Comments
 (0)