Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppendBlobClient.getOutputStream(boolean) to overwrite correctly if set to true #33086

Merged
merged 15 commits into from
Jan 20, 2023

Conversation

ibrahimrabab
Copy link
Contributor

Description

resolves #32602

When AppendBlobClient.getOutputStream(true) is called, the existing blob is not overwritten. Instead, new data gets appended to the existing data.

Changed javadoc for AppendBlobClient.getOutputStream() that specifies new data will be appended to the existing blob (which is the actual correct behavior) instead of getting overwritten.

Changed logic for AppendBlobClient.getOutputStream(boolean) to create a new blob that will overwrite existing blob if overwrite=true.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label Jan 18, 2023
@ibrahimrabab
Copy link
Contributor Author

/azp run java - storage - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

public BlobOutputStream getBlobOutputStream(boolean overwrite) {
AppendBlobRequestConditions requestConditions = null;
if (!overwrite) {
if (exists()) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to throw here or put the OutputStream into append mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it looks like in .NET when overwrite is false and blob exists, they continue to append. We should probably follow the same logic.

@ibrahimrabab
Copy link
Contributor Author

/azp run java - storage - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-storage-blob

@ibrahimrabab
Copy link
Contributor Author

/azp run java - storage - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ibrahimrabab
Copy link
Contributor Author

/azp run java - storage - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ibrahimrabab ibrahimrabab merged commit 712a36e into Azure:main Jan 20, 2023
@ibrahimrabab ibrahimrabab deleted the appendBlobOutputStream branch January 20, 2023 03:03
xinlian12 pushed a commit to xinlian12/azure-sdk-for-java that referenced this pull request Jan 24, 2023
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.

[QUERY] AppendBlobClient.getBlobOutputStream overwrites or not?
3 participants