@@ -102,7 +102,6 @@ void AwsCloudAccessCredentials::InitializeConfig(
102102Status AwsCloudAccessCredentials::HasValid () const {
103103 AwsAccessType aws_type = GetAccessType ();
104104 Status status = CheckCredentials (aws_type);
105- printf (" MJR: Credentials HasValid=%d status=%s\n " , (int ) aws_type, status.ToString ().c_str ());
106105 return status;
107106}
108107
@@ -117,7 +116,6 @@ Status AwsCloudAccessCredentials::GetCredentialsProvider(
117116
118117 AwsAccessType aws_type = GetAccessType ();
119118 Status status = CheckCredentials (aws_type);
120- printf (" MJR: Credentials=%d status=%s\n " , (int ) aws_type, status.ToString ().c_str ());
121119 if (status.ok ()) {
122120#ifdef USE_AWS
123121 switch (aws_type) {
@@ -166,6 +164,7 @@ Status AwsCloudAccessCredentials::GetCredentialsProvider(
166164}
167165
168166#ifdef USE_AWS
167+ static Aws::SDKOptions sdkOptions;
169168
170169//
171170// The AWS credentials are specified to the constructor via
@@ -174,7 +173,8 @@ Status AwsCloudAccessCredentials::GetCredentialsProvider(
174173AwsEnv::AwsEnv (Env* underlying_env, const CloudEnvOptions& _cloud_env_options,
175174 const std::shared_ptr<Logger>& info_log)
176175 : CloudEnvImpl(_cloud_env_options, underlying_env, info_log) {
177- Aws::InitAPI (Aws::SDKOptions ());
176+ Aws::InitAPI (sdkOptions); // **TODO: Move this into PrepareOptions and do it
177+ // conditionally (first time)
178178 if (cloud_env_options.src_bucket .GetRegion ().empty () ||
179179 cloud_env_options.dest_bucket .GetRegion ().empty ()) {
180180 std::string region;
@@ -192,7 +192,11 @@ AwsEnv::AwsEnv(Env* underlying_env, const CloudEnvOptions& _cloud_env_options,
192192 base_env_ = underlying_env;
193193}
194194
195- void AwsEnv::Shutdown () { Aws::ShutdownAPI (Aws::SDKOptions ()); }
195+ AwsEnv::~AwsEnv () {
196+ // **TODO: Conditionally call shutdown (or make shutdown conditional on last...
197+ }
198+
199+ void AwsEnv::Shutdown () { Aws::ShutdownAPI (sdkOptions); }
196200
197201//
198202// All db in a bucket are stored in path /.rockset/dbid/<dbid>
0 commit comments