Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.8k stars 320 forks source link

Azurite doesn't support get page ranges that differ between a specified snapshot and this page blob #812

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: Azurite doesn't support get page ranges that differ between a specified snapshot and this page blob.

To Reproduce: Please run the demo code as following:

import { BlobServiceClient, StorageSharedKeyCredential } from "@azure/storage-blob";
import { assert } from "chai";

async function main() {
    const blobServiceClient = new BlobServiceClient("<Azurite-https-endpoint>", new StorageSharedKeyCredential("<account-name>", "<account-key>"));
    const containerClient = blobServiceClient.getContainerClient("<container-name>");
    await containerClient.create();
    const pageBlobClient = containerClient.getPageBlobClient("<blob-name>");
    await pageBlobClient.create(1024);
    await pageBlobClient.uploadPages("b".repeat(1024), 0, 1024);
    const snapshotResult = await pageBlobClient.createSnapshot();
    await pageBlobClient.uploadPages("a".repeat(512), 0, 512);
    await pageBlobClient.clearPages(512, 512);
    await pageBlobClient.getPageRangesDiff(0, 1024, snapshotResult.snapshot!);
}

main().catch((err) => {
    assert.ok((err as any).code === "APINotImplemented");
});

Error Track: https://github.com/Azure/Azurite/blob/master/src/blob/handlers/PageBlobHandler.ts#L402 image Api getPageRangesDiff is not implemented in Azurite.

Expected Behavior: Azurite supports get page ranges that differ between a specified snapshot and this page blob.

@jongio for notification.

blueww commented 3 years ago

@zzhxiaofeng

Thanks for reporting this issue! Incremental copy is still not supported in Azurite.

Azurite welcome contribution. It would be great if you could raise a PR to fix it!