|
44 | 44 | #include "cloud/aws/aws_file.h" |
45 | 45 | #include "cloud/cloud_storage_provider_impl.h" |
46 | 46 | #include "cloud/filename.h" |
47 | | -#include "port/port_posix.h" |
| 47 | +#include "port/port.h" |
48 | 48 | #include "rocksdb/cloud/cloud_env_options.h" |
49 | 49 | #include "rocksdb/cloud/cloud_storage_provider.h" |
50 | 50 | #include "rocksdb/options.h" |
51 | 51 | #include "util/stderr_logger.h" |
52 | 52 | #include "util/string_util.h" |
53 | 53 |
|
| 54 | +#ifdef _WIN32_WINNT |
| 55 | +#undef GetMessage |
| 56 | +#endif |
| 57 | + |
54 | 58 | namespace ROCKSDB_NAMESPACE { |
55 | 59 | #ifdef USE_AWS |
56 | 60 | class CloudRequestCallbackGuard { |
@@ -477,8 +481,20 @@ Status S3StorageProvider::CreateBucket(const std::string& bucket) { |
477 | 481 | Aws::S3::Model::BucketLocationConstraint bucket_location = Aws::S3::Model:: |
478 | 482 | BucketLocationConstraintMapper::GetBucketLocationConstraintForName( |
479 | 483 | ToAwsString(env_->GetCloudEnvOptions().dest_bucket.GetRegion())); |
480 | | - if (bucket_location != Aws::S3::Model::BucketLocationConstraint::NOT_SET) { |
481 | | - // only set the location constraint if it's not not set |
| 484 | + // |
| 485 | + // If you create a bucket in US-EAST-1, no location constraint should be |
| 486 | + // specified |
| 487 | + // |
| 488 | + // https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html |
| 489 | + // |
| 490 | + // By default, the bucket is created in the US East (N. Virginia) Region. |
| 491 | + // You can optionally specify a Region in the request body. You might choose |
| 492 | + // a Region to optimize latency, minimize costs, or address regulatory |
| 493 | + // requirements. |
| 494 | + // |
| 495 | + if ((bucket_location != Aws::S3::Model::BucketLocationConstraint::NOT_SET) && |
| 496 | + (bucket_location != |
| 497 | + Aws::S3::Model::BucketLocationConstraint::us_east_1)) { |
482 | 498 | conf.SetLocationConstraint(bucket_location); |
483 | 499 | } |
484 | 500 |
|
|
0 commit comments