GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Delete retention of a non-current blob fails · Issue #2980 · googleapis/java-storage

This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Delete retention of a non-current blob fails #2980

Copy link
Copy link
Closed
#2997
#3006
Closed
Delete retention of a non-current blob fails#2980
#2997
#3006
Copy link
Assignees
BenWhitehead
Labels
api: storageIssues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@niriak
niriak
opened on Mar 11, 2025
Issue body actions

Environment details

Maven Artefact: com.google.cloud:google-cloud-storage:2.49.0
OS Type: Linux (Manjaro)
Java version: openjdk version "21.0.6" 2025-01-21

Steps to reproduce

  1. Create a bucket with versioning and object retention enabled
  2. Create a blob with retention in unlocked mode
  3. Delete the blob (live -> non-current)
  4. Delete the non-current blobs retention

Code example

Expected code to delete the non-current blobs retention:

var blobId = BlobId.of("my-bucket", "my-blob-name", 1741083479142854L);
var blob = storage.get(blobId, Storage.BlobGetOption.generationMatch());

var newblob = blob.toBuilder().setRetention(null).build();
newblob.update(Storage.BlobTargetOption.overrideUnlockedRetention(true), Storage.BlobTargetOption.generationMatch());

Stack trace

com.google.cloud.storage.StorageException: No such object: my-bucket/my-blob-name

	at com.google.cloud.storage.StorageException.translate(StorageException.java:209)
	at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:360)
	at com.google.cloud.storage.spi.v1.HttpStorageRpc.patch(HttpStorageRpc.java:718)
	at com.google.cloud.storage.StorageImpl.lambda$update$18(StorageImpl.java:592)
	at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:102)
	at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
	at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at com.google.cloud.storage.Retrying.run(Retrying.java:65)
	at com.google.cloud.storage.StorageImpl.run(StorageImpl.java:1611)
	at com.google.cloud.storage.StorageImpl.update(StorageImpl.java:590)
	at com.google.cloud.storage.Blob.update(Blob.java:855)
        [...]

Any additional information below

Expected behavior:
The code example deletes the blobs retention.

Actual behavior:
The code fails with an exception, stating the non-current blob is not found

Working workaround:
It looks like the generation information is not send in the update call by default. Marking the blobId generation field as changed seems to force the generation information to be submitted, at least in the current version of the maven artefact.

var newblob = blob.toBuilder().setBlobId(/* trigger a change to the generation */ BlobId.of(blobId.getBucket(), blobId.getName())).setBlobId(/* set generation to the correct one */ blobId).setRetention(null).build();
newblob.update(Storage.BlobTargetOption.overrideUnlockedRetention(true), Storage.BlobTargetOption.generationMatch());

Let me know if you need any more information.

Activity

  1. product-auto-label
    added
    api: storageIssues related to the googleapis/java-storage API.
    on Mar 11, 2025
  2. BenWhitehead
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Mar 12, 2025
  3. BenWhitehead
    self-assigned this
    on Mar 12, 2025
  4. BenWhitehead
    added a commit that references this issue on Mar 20, 2025

    fix: ensure object generation is sent for Storage#update(BlobInfo) us…

    This issue will close once commit 64cf731 is merged into the 'main' branch.
    64cf731
  5. BenWhitehead
    closed this as completedin #3006on Mar 21, 2025
  6. BenWhitehead
    added a commit that references this issue on Mar 21, 2025

    fix: ensure object generation is sent for Storage#update(BlobInfo) us…

    This issue will close once commit 2a3e0e7 is merged into the 'main' branch.
    2a3e0e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @BenWhitehead
    BenWhitehead

Labels

api: storageIssues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.