googleapis / googleapis/google-cloud-java

[java-storage] Update blob metadata conflict throws a non-retryable StorageException

Abierto
#12,630 0 comentarios 0 reacciones 0 asignados Ver en GitHub
api: storage
Lenguaje dominante
Java
Estrellas
2.1k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
154

Descripción

#### Description

I'm updating the metadata of a blob. When concurrent updates are done, a StorageException is thrown as expected, mentioning a conflict. However, the exception is marked as non-retryable, while the exception message prompts to try again, which is contradictory.
I'd expect the exception to be retryable in that case.

#### Environment details

Using google-cloud-storage 2.52.3 and kotlin 2.0.0

#### Steps to reproduce

1. Try updating the metadata of a blob in 2 concurrent processes

#### Code example

```kotlin
storage
.get(blobId)
.toBuilder()
.setMetadata(
mapOf(
"MyKey" to "MyValue"
)
).build()
.update()
```

#### Stack trace
```
com.google.cloud.storage.StorageException: The metadata for object "path/to/my/blob" was edited during the operation. Please try again.
at com.google.cloud.storage.StorageException.translate(StorageException.java:230)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:360)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.patch(HttpStorageRpc.java:719)
at com.google.cloud.storage.StorageImpl.lambda$update$19(StorageImpl.java:609)
at com.google.cloud.storage.Retrying$DefaultRetrier.run(Retrying.java:165)
at com.google.cloud.storage.Retrying$HttpRetrier.run(Retrying.java:206)
at com.google.cloud.storage.StorageImpl.run(StorageImpl.java:1619)
at com.google.cloud.storage.StorageImpl.update(StorageImpl.java:607)
at com.google.cloud.storage.Blob.update(Blob.java:865)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 409 Conflict
POST https://storage.googleapis.com/storage/v1/b/my-bucket/o/path%2Fto%2Fmy%2Fblob?projection=full
{
"code" : 409,
"errors" : [ {
"domain" : "global",
"message" : "The metadata for object \"path/to/my/blob\" was edited during the operation. Please try again.",
"reason" : "conflict"
} ],
"message" : "The metadata for object \"path/to/my/blob\" was edited during the operation. Please try again."
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:118)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:37)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$3.interceptResponse(AbstractGoogleClientRequest.java:479)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1111)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:565)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:506)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:616)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.patch(HttpStorageRpc.java:716)
... 28 common frames omitted
```

Following these steps guarantees the quickest resolution possible.

Thanks!

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.