When does Cloud Storage Pubsub Notification object contain eventBasedHold field?

I have been using (Synchronous Pull) requests to fetch Pubsub Notifications for objects pushed to a bucket. Today suddenly the messages contained a field called "eventBasedHold" which (I think) had never shown up till now.

It crashed my program with a schema mismatch, as shown by below error message:
Caused by: org.apache.parquet.io.InvalidRecordException: Parquet/Avro schema mismatch: Avro field 'eventBasedHold' not found.

The eventBasedHold field disappeared in subsequent requests. The only thing that was different in my Synchronous Pull requests today was that I pulling events corresponding to a newly created folder in my bucket. You can assume a gap of a few minutes between the creation of the new folder and my Synchronous Pull requests.

0 1 107
1 REPLY 1

The eventBasedHold is one type of hold, which are metadata flags that you place on individual objects. While an object has a hold placed on it, the object cannot be deleted or replaced. You can, however, edit the metadata of the object, as shown in the documentation.

Cloud Storage offers the following types of holds:

  • Event-based holds
  • Temporary holds

An object can have one type of hold, both types, or neither hold placed on it. When an object is stored in a bucket without a retention policy, both hold types behave exactly the same. When an object is stored in a bucket with a retention policy, the hold types have different effects on the object when the hold is released:

  • An event-based hold resets the object's time in the bucket for the purposes of the retention period.
  • A temporary hold does not affect the object's time in the bucket for the purposes of the retention period.

You can manage individual object holds by:

In addition to placing holds on individual objects, you can enable the default event-based property on your bucket. When you do this, each new object that subsequently gets added to the bucket automatically has an event-based hold placed on it.

The following tasks show you how to set and view the default event-based hold property on a bucket: