Skip to content

SNOW-3834837 migrate azure sdk to Azure SDK for C++ - #1044

Open
sfc-gh-ext-simba-hx wants to merge 10 commits into
masterfrom
SNOW-3834837-migrate-azure-sdk
Open

SNOW-3834837 migrate azure sdk to Azure SDK for C++#1044
sfc-gh-ext-simba-hx wants to merge 10 commits into
masterfrom
SNOW-3834837-migrate-azure-sdk

Conversation

@sfc-gh-ext-simba-hx

@sfc-gh-ext-simba-hx sfc-gh-ext-simba-hx commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

migrate to the latest azure sdk for c++ (azure-stoarge-blobs 12.18.0) from the deprecated azure-storage-cpplite (will remove in a separated PR to keep this PR in a reviewable amount of changed files)
Also fixed reading overflow around sf_strncpy which caused segment fault in test_unit_logger after the migration, tighten the boundary check and null terminator.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@sfc-gh-ext-simba-hx
sfc-gh-ext-simba-hx force-pushed the SNOW-3834837-migrate-azure-sdk branch from 9cad311 to 47b927a Compare August 6, 2026 23:53
@sfc-gh-ext-simba-hx
sfc-gh-ext-simba-hx force-pushed the SNOW-3834837-migrate-azure-sdk branch from 47b927a to 96a13fa Compare August 6, 2026 23:56
@sfc-gh-ext-simba-hx
sfc-gh-ext-simba-hx marked this pull request as ready for review August 7, 2026 02:56
@sfc-gh-ext-simba-hx
sfc-gh-ext-simba-hx requested a review from a team as a code owner August 7, 2026 02:56

try {
Azure::Storage::Blobs::BlobClientOptions options;
options.Retry.MaxRetries = m_maxRetries;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_maxRetries seems to be used uninitialized.

FileTransferAgent calls setMaxRetries() after getClient(), but Azure only reads retry options at construction. setMaxRetries only assigns the member and does not recreate/update the client.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed by passing maxRetries to Azure client constructor.

return m_length;
}

void Rewind() override

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-part upload uses this adapter around a non-seekable cipher stream. If MaxRetries > 0, Azure retry can re-read from EOF and upload empty/corrupt data or fail opaquely.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created m_blobServiceClientNoRetry with MaxRetries set to 0 for single-part upload.

Comment thread cpp/SnowflakeAzureClient.cpp Outdated
@@ -79,31 +82,48 @@ SnowflakeAzureClient::SnowflakeAzureClient(StageInfo *stageInfo,
std::string account_name = m_stageInfo->storageAccount;
std::string sas_key = m_stageInfo->credentials[azuresaskey];
std::string endpoint = account_name + "." + m_stageInfo->endPoint;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpplite client prefixed a scheme automatically, but the new one does not. Let's make sure that when https is enabled, the scheme prefix is there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code with cpplite hardcoded use_https as true. Hardcoded to add https prefix here.

Comment thread lib/client.c Outdated
if (copylen > size) {
return SF_STATUS_ERROR_BUFFER_TOO_SMALL;
}
sf_strncpy(value, size, CLIENT_CONFIG_FILE, size);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sf_strncpy(value, size, CLIENT_CONFIG_FILE, size);
sf_strncpy(value, size, CLIENT_CONFIG_FILE, copylen);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment thread cpp/SnowflakeAzureClient.cpp Outdated
auto response = blobClient.Download();
if (!response.Value.BodyStream)
{
CXX_LOG_ERROR("%s file donwload failed:: BodyStream is NULL",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CXX_LOG_ERROR("%s file donwload failed:: BodyStream is NULL",
CXX_LOG_ERROR("%s file download failed:: BodyStream is NULL",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Comment thread patches/azure-sdk-cpp-12.18.0.patch Outdated
virtual bool IsExpired() = 0;

+ /**
+ * @brief Checks whether this CURL connection is ued proxy.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ * @brief Checks whether this CURL connection is ued proxy.
+ * @brief Checks whether this CURL connection is used proxy.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants