Skip to content

Add support for unfinalized appendable objects #720

@cojenco

Description

@cojenco

To support unfinalized appendable objects in the testbench, the blob (metadata size, media, etc) needs to be updated in the database within Upload.process_bidi_write_object_grpc, which mainly handles the bidi write business logic.

Below is an example of how blob.media and blob.metadata.size could be updated to the database. This would support test cases where size or data needs to read back for unfinalized appendable objects.

Testbench implementaton details should be decided based on the internal design doc and needed test cases.

upload.media += content
# ...
                
# Update appendable blob size and media here, as an example.
# TODO: (1) Update_time, size and crc are updated in object metadata.
# TODO: (2) Whether the testbench checks for flush or/and performs a background force-close.
if is_appendable:
    def update_appendable_blob(blob, unused_generation):
        blob.media = upload.media
        blob.metadata.size = len(upload.media)
        return blob

    blob = db.do_update_object(
        upload.bucket.name,
        upload.metadata.name,
        update_fn=update_appendable_blob,
        context=context,
        generation=upload.metadata.generation,
    )

# Currently, the testbench will always checkpoint and flush data for testing purposes,
# instead of the 15 seconds interval used in the GCS server.
# TODO(#592): Refactor testbench checkpointing to more closely follow GCS server behavior.
upload.media += content

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions