Skip to content

Adopt Azure sdk for Objectstore#1781

Open
Yavor16 wants to merge 2 commits intomasterfrom
adopt-azure-sdk
Open

Adopt Azure sdk for Objectstore#1781
Yavor16 wants to merge 2 commits intomasterfrom
adopt-azure-sdk

Conversation

@Yavor16
Copy link
Contributor

@Yavor16 Yavor16 commented Feb 19, 2026

No description provided.

@Yavor16 Yavor16 force-pushed the adopt-azure-sdk branch 3 times, most recently from 8abfeec to 0f289a1 Compare February 23, 2026 12:31
@sonarqubecloud
Copy link

Comment on lines +156 to +166
public String getContainerUriEndpoint(Map<String, Object> credentials) {
if (!credentials.containsKey(CONTAINER_URI)) {
return null;
}
try {
URL containerUri = new URL((String) credentials.get(CONTAINER_URI));
return new URL(containerUri.getProtocol(), containerUri.getHost(), containerUri.getPort(), "").toString();
} catch (MalformedURLException e) {
throw new IllegalStateException(Messages.CANNOT_PARSE_CONTAINER_URI_OF_OBJECT_STORE, e);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this method is only referenced by a protected method within the same class. Should we consider reducing its visibility from public to protected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it public so I can test it better using unit tests.

public void addFile(FileEntry fileEntry, InputStream content) throws FileStorageException {
BlobClient blobClient = containerClient.getBlobClient(fileEntry.getId());
try {
BlobParallelUploadOptions blobParallelUploadOptions = new BlobParallelUploadOptions(content);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this method blocking? What is the purpose of parallel here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the method is blocking. It is parallel because uploadWithResponse works only with parrallel upload options. The reason I use uploadWithResponse instead of simple upload() is because the basic upload method doesn't upload metadata during the upload of the file. The metadata can be set after the file has been uploaded. That means there is a very low chanse that our cleaner can remove the file because it doesn't have metadata. uploadWithResponse sets the metadata during the upload

BlobParallelUploadOptions blobParallelUploadOptions = new BlobParallelUploadOptions(content);
blobParallelUploadOptions.setMetadata(ObjectStoreMapper.createFileEntryMetadata(fileEntry));

blobClient.uploadWithResponse(blobParallelUploadOptions, ObjectStoreConstants.OBJECT_STORE_TOTAL_TIMEOUT_CONFIG_IN_MINUTES,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this method failing or just returning some http status code? It returns Response which has method getStatusCode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, but from I've read in the documentation it will throw exception, if is responce is different from 2**(link)

}

public Set<String> getAllEntriesNames() {
return containerClient.listBlobs()
Copy link
Contributor

Choose a reason for hiding this comment

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

timeout here?

<google-cloud.version>2.62.1</google-cloud.version>
<google-cloud-nio.version>0.128.11</google-cloud-nio.version>
<azure-storage-blob.version>12.33.1</azure-storage-blob.version>
<azure-core-http-okhttp.version>1.13.3</azure-core-http-okhttp.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

why okhttp was chosen over netty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was using the netty by default and we were having constantly crashed due to OOM. I decided to try the Azure Http Client and the crashed stopped and everything was fine

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.

4 participants