Skip to content

Storage - STG102 object level smart access#48392

Open
browndav-msft wants to merge 24 commits intoAzure:feature/storage/stg102basefrom
browndav-msft:stg102/ObjectLevelSmartAccess
Open

Storage - STG102 object level smart access#48392
browndav-msft wants to merge 24 commits intoAzure:feature/storage/stg102basefrom
browndav-msft:stg102/ObjectLevelSmartAccess

Conversation

@browndav-msft
Copy link
Member

No description provided.

@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Mar 12, 2026
browndav-msft and others added 11 commits March 12, 2026 10:43
- We needed to add AccessTier smartAccessTier to all constructors in BlobProperties, which is different than what is recommended in BlobPropertiesInternal. Made a deliberate decision to go this route, but will go the other route, if necessessary
@test
@RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2026-02-04")
public void getInferredTierWhenAssignedSmart() {
    // Arrange
    // Create a file in a file system with the smart tiering feature enabled, and set the access tier to smart.
    // Did this manually to prove feature works
    fc = premiumDataLakeServiceClient.getFileSystemClient("5333bf800setblobaccesstiersmart26f99030889cd17d8581")
        .getFileClient("5333bf801setblobaccesstiersmart26f71508c0c760a5e356");

    Response<PathProperties> response = fc.getPropertiesWithResponse(null, null, null);
    HttpHeaders headers = response.getHeaders();
    PathProperties properties = response.getValue();

    validateBasicHeaders(headers);

    assertEquals(AccessTier.SMART, properties.getAccessTier());
    assertEquals(AccessTier.HOT, properties.getSmartAccessTier());
}
@ibrandes ibrandes changed the title Stg102/object level smart access Storage - STG102 object level smart access Mar 16, 2026
Copy link
Member

@ibrandes ibrandes left a comment

Choose a reason for hiding this comment

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

had a couple more suggestions for further polishing

Comment on lines +427 to +431
@Override
public AccessTier getSmartAccessTier() {
return null;
}

Copy link
Member

Choose a reason for hiding this comment

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

this looks weird without context - maybe we should add a comment that says something like "Null because this property is set through BlobPropertiesConstructorProxy"

Copy link
Member Author

Choose a reason for hiding this comment

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

@ibrandes I had to trace this, but this should return smartAccessTier. It took me a while to figure it out, but I'm going to make the change to the code. The public API remains unchanged, but the service returns smartAccessTier, so this should return a value.


@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06")
@Test
public void startCopyFromURLSmartAccessTier() {
Copy link
Member

Choose a reason for hiding this comment

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

we also need to add these tests to BlobBaseAsyncApiTests

Comment on lines +2583 to +2612
@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06")
@Test
public void uploadStreamAccessTierSmart() {

Flux<BlobItem> response
= primaryBlobServiceAsyncClient.createBlobContainer(generateContainerName()).flatMapMany(cc -> {
BlockBlobAsyncClient bc = cc.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient();
return bc.upload(DATA.getDefaultFlux(), DATA.getDefaultData().remaining())
.then(bc.setAccessTierWithResponse(AccessTier.SMART, null, null))
.flatMap(r -> {
HttpHeaders headers = r.getHeaders();

assertTrue(r.getStatusCode() == 200 || r.getStatusCode() == 202);
assertNotNull(headers.getValue(X_MS_VERSION));
assertNotNull(headers.getValue(X_MS_REQUEST_ID));
return Mono.empty();
})
.then(bc.getProperties())
.flatMap(r -> {
assertEquals(AccessTier.SMART, r.getAccessTier());
return Mono.empty();
})
.thenMany(cc.listBlobs());
});

StepVerifier.create(response)
.assertNext(r -> assertEquals(AccessTier.SMART, r.getProperties().getAccessTier()))
.verifyComplete();
}

Copy link
Member

Choose a reason for hiding this comment

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

this test is a lot more complex than it needs to be - if you use a blobclient instead of a blockblob you can use uploadWithResponse which lets us set the access tier and upload data at the same time:

@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06")
    @Test
    public void uploadStreamAccessTierSmart() {
        bc = ccAsync.getBlobAsyncClient(generateBlobName());
        BlobParallelUploadOptions options = new BlobParallelUploadOptions(DATA.getDefaultFlux())
            .setTier(AccessTier.SMART);
        Mono<Response<BlobProperties>> response = bc.uploadWithResponse(options)
            .then(bc.getPropertiesWithResponse(null));

        StepVerifier.create(response)
            .assertNext(r -> {
                assertEquals(AccessTier.SMART, r.getValue().getAccessTier());
                assertNotNull(r.getValue().getSmartAccessTier());
            })
            .verifyComplete();
    }

Comment on lines +133 to +134
static final HttpHeaderName X_MS_ACCESS_TIER_INFERRED = HttpHeaderName.fromString("x-ms-access-tier-inferred");
static final HttpHeaderName X_MS_SMART_ACCESS_TIER = HttpHeaderName.fromString("x-ms-smart-access-tier");
Copy link
Member

Choose a reason for hiding this comment

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

i added these by mistake - these can be removed

protected DataLakeFileSystemAsyncClient dataLakeFileSystemAsyncClient;
protected DataLakeServiceClient primaryDataLakeServiceClient;
protected DataLakeServiceAsyncClient primaryDataLakeServiceAsyncClient;
protected DataLakeServiceClient premiumDataLakeServiceClient;
Copy link
Member

Choose a reason for hiding this comment

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

this can be removed since we aren't adding tests for datalake

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

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants