88// found in the LICENSE file. See the AUTHORS file for names of contributors.
99
1010#include " db/db_test_util.h"
11+
1112#include " db/forward_iterator.h"
12- #include " util/stderr_logger.h"
1313#include " rocksdb/env_encryption.h"
14+ #include " util/stderr_logger.h"
1415#ifdef USE_AWS
1516#include " cloud/cloud_env_impl.h"
1617#include " rocksdb/cloud/cloud_storage_provider.h"
@@ -85,7 +86,7 @@ DBTestBase::DBTestBase(const std::string path)
8586 // Randomize the test path so that multiple tests can run in parallel
8687 srand (static_cast <unsigned int >(time (nullptr )));
8788 std::string mypath = path + " _" + std::to_string (rand ());
88-
89+
8990 env_->NewLogger (test::TmpDir (env_) + " /rocksdb-cloud.log" , &info_log_);
9091 info_log_->SetInfoLogLevel (InfoLogLevel::DEBUG_LEVEL);
9192 s3_env_ = CreateNewAwsEnv (mypath, env_);
@@ -187,45 +188,45 @@ bool DBTestBase::ShouldSkipOptions(int option_config, int skip_mask) {
187188}
188189
189190bool DBTestBase::ShouldSkipAwsOptions (int option_config) {
190- // AWS Env doesn't work with DirectIO
191- return option_config == kDirectIO ;
191+ // AWS Env doesn't work with DirectIO
192+ return option_config == kDirectIO ;
192193}
193194
194195// Switch to a fresh database with the next option configuration to
195196// test. Return false if there are no more configurations to test.
196197bool DBTestBase::ChangeOptions (int skip_mask) {
197198 while (true ) {
198- for (option_config_++; option_config_ < kEnd ; option_config_++) {
199- if (ShouldSkipOptions (option_config_, skip_mask)) {
200- continue ;
201- }
202- if (option_env_ == kAwsEnv && ShouldSkipAwsOptions (option_config_)) {
203- continue ;
204- }
205- break ;
206- }
207- if (option_config_ >= kEnd ) {
199+ for (option_config_++; option_config_ < kEnd ; option_config_++) {
200+ if (ShouldSkipOptions (option_config_, skip_mask)) {
201+ continue ;
202+ }
203+ if (option_env_ == kAwsEnv && ShouldSkipAwsOptions (option_config_)) {
204+ continue ;
205+ }
206+ break ;
207+ }
208+ if (option_config_ >= kEnd ) {
208209#ifndef USE_AWS
209- // If not built for AWS, skip it
210- if (option_env_ + 1 == kAwsEnv ) {
211- option_env_++;
212- }
210+ // If not built for AWS, skip it
211+ if (option_env_ + 1 == kAwsEnv ) {
212+ option_env_++;
213+ }
213214#endif
214- if (option_env_ + 1 >= kEndEnv ) {
215- Destroy (last_options_);
216- return false ;
217- } else {
218- option_env_++;
219- option_config_ = kDefault ;
220- continue ;
221- }
222- } else {
223- auto options = CurrentOptions ();
224- options.create_if_missing = true ;
225- DestroyAndReopen (options);
226- return true ;
227- }
228- }
215+ if (option_env_ + 1 >= kEndEnv ) {
216+ Destroy (last_options_);
217+ return false ;
218+ } else {
219+ option_env_++;
220+ option_config_ = kDefault ;
221+ continue ;
222+ }
223+ } else {
224+ auto options = CurrentOptions ();
225+ options.create_if_missing = true ;
226+ DestroyAndReopen (options);
227+ return true ;
228+ }
229+ }
229230}
230231
231232// Switch between different compaction styles.
@@ -620,8 +621,8 @@ Options DBTestBase::GetOptions(
620621 case kAwsEnv : {
621622 assert (s3_env_);
622623 options.env = s3_env_;
623- options.recycle_log_file_num = 0 ; // do not reuse log files
624- options.allow_mmap_reads = false ; // mmap is incompatible with S3
624+ options.recycle_log_file_num = 0 ; // do not reuse log files
625+ options.allow_mmap_reads = false ; // mmap is incompatible with S3
625626 break ;
626627 }
627628#endif /* USE_AWS */
@@ -644,7 +645,7 @@ Options DBTestBase::GetOptions(
644645}
645646
646647#ifdef USE_AWS
647- Env* DBTestBase::CreateNewAwsEnv (const std::string& prefix, Env * parent) {
648+ Env* DBTestBase::CreateNewAwsEnv (const std::string& prefix, Env* parent) {
648649 if (!prefix.empty ()) {
649650 fprintf (stderr, " Creating new AWS env with prefix %s\n " , prefix.c_str ());
650651 }
@@ -747,7 +748,7 @@ void DBTestBase::Destroy(const Options& options, bool delete_cf_paths) {
747748 ASSERT_OK (DestroyDB (dbname_, options, column_families));
748749#ifdef USE_AWS
749750 if (s3_env_) {
750- AwsEnv* aenv = static_cast <AwsEnv *>(s3_env_);
751+ AwsEnv* aenv = static_cast <AwsEnv*>(s3_env_);
751752 Status st = aenv->GetCloudEnvOptions ().storage_provider ->EmptyBucket (
752753 aenv->GetSrcBucketName (), dbname_);
753754 ASSERT_TRUE (st.ok () || st.IsNotFound ());
0 commit comments