Skip to content

PBM-1776 GCS parallel upload (with storage close)#1344

Merged
jcechace merged 15 commits into
percona:devfrom
jcechace:PBM-1776-gcs-parallel-upload
Jul 21, 2026
Merged

PBM-1776 GCS parallel upload (with storage close)#1344
jcechace merged 15 commits into
percona:devfrom
jcechace:PBM-1776-gcs-parallel-upload

Conversation

@jcechace

@jcechace jcechace commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator
storage:
  type: gcs
  gcs:
    bucket: pbm-jakub
    prefix: pbm
    maxObjSizeGB: 1
    credentials:
      clientEmail: "pbm-jakub@dev-sandbox-348314.iam.gserviceaccount.com"
      privateKey: "..."
      clientType: grpc # json | grpc 
      parallelUploadConcurrency: 4 # number of concurrent parts, enabled requires > 1

Status will remain experimental due to ongoing work in GCS.
At least these need to be released:

@jcechace jcechace changed the title PBM-1776 GCS parallel upload (Adjusted) PBM-1776 GCS parallel upload (with storage close) Jun 30, 2026
Comment thread pbm/storage/gcs/config.go Outdated
// HMAC credentials continue to use the MinIO client and are not affected by this setting.
type ParallelUpload struct {
// Enabled enables Writer parallel uploads when clientType is grpc.
Enabled bool `bson:"enabled,omitempty" json:"enabled,omitempty" yaml:"enabled,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is redundant parameter, we can disable/enable it with MaxConcurrency

Comment thread pbm/storage/gcs/config.go Outdated

// PartSize is the size of each temporary part in bytes.
// If unset, PBM uses the computed ChunkSize for the uploaded object.
PartSize int `bson:"partSize,omitempty" json:"partSize,omitempty" yaml:"partSize,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ChunkSize can be reused here, or maybe even better use PartSize for both (json and grpc) but in that case it should be out of ParallelUpload block.

Comment thread pbm/storage/gcs/google_client.go Outdated
Comment on lines +165 to +166
if pu.PartSize > 0 {
partSize = fmt.Sprintf("%v (%v)", pu.PartSize, storage.PrettySize(int64(pu.PartSize)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

storage.ComputePartSize should be used for grps also

Comment thread pbm/restore/physical.go Outdated

stopHB chan struct{}
stopCleanupHB chan struct{}
hbWG sync.WaitGroup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather create local storage instance just for the HB and close it when HB is stopped. So, that we do not need to do this type of synchronization.

Comment thread pbm/restore/logical.go
storage storage.Storage
}

type storageReadCloser struct {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that it necessary to refactor logical restore to use single storage instance. This is workaround that's hard to follow, and I am not sure that it closes all flows.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That would be basically reverting https://github.com/percona/percona-backup-mongodb/pull/703/changes

I think the reason why each file get's it's own storage is shared state in Downloaders. We would be sharing this field arenas []*storage.Arena

@jcechace
jcechace marked this pull request as ready for review July 21, 2026 07:32
boris-ilijic
boris-ilijic previously approved these changes Jul 21, 2026
@jcechace
jcechace merged commit f66c74a into percona:dev Jul 21, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants