vitessio/vitess · error · ErrPartSize
%w, currently set to %s
Error message
%w, currently set to %s
What it means
calculateUploadPartSize validates the configured part size bounds for S3 backups. When the resolved part size (or the minPartSize setting) falls below the minimum allowed (5MiB) or minPartSize exceeds the max (5GiB), it returns ErrPartSize wrapped with the current value.
Source
Thrown at go/vt/mysqlctl/s3backupstorage/s3.go:298
defaultUploadPartSize = 5 * 1024 * 1024 // 5MiB
minUploadPartSize = 5 * 1024 * 1024 // 5MiB - S3 requirement
maxUploadParts = 10000 // S3 limit
)
// Calculate s3 upload part size using the source filesize
partSizeBytes = defaultUploadPartSize
if filesize > 0 {
minimumPartSize := float64(filesize) / float64(maxUploadParts)
// Round up to ensure large enough partsize
calculatedPartSizeBytes := int64(math.Ceil(minimumPartSize))
if calculatedPartSizeBytes > partSizeBytes {
partSizeBytes = calculatedPartSizeBytes
}
}
if minPartSize != 0 && partSizeBytes < minPartSize {
if minPartSize > MaxPartSize || minPartSize < minUploadPartSize { // 5GiB and 5MiB respectively
return 0, fmt.Errorf(
"%w, currently set to %s",
ErrPartSize, humanize.IBytes(uint64(minPartSize)),
)
}
partSizeBytes = int64(minPartSize)
}
return
}
// Wait is part of the backupstorage.BackupHandle interface.
func (bh *S3BackupHandle) Wait() {
bh.waitGroup.Wait()
}
// EndBackup is part of the backupstorage.BackupHandle interface.
func (bh *S3BackupHandle) EndBackup(ctx context.Context) error {
if bh.readOnly {View on GitHub (pinned to 01a25a7d17)
Solutions
- Set the part-size config value to at least 5MiB (5242880 bytes)
- Ensure minPartSize is not greater than 5GiB (5368709120 bytes)
- Check the units in your config — values are in bytes, not MiB/GiB
- Fix the underlying ErrPartSize root cause message (it is wrapped here with 'currently set to' context)
Example fix
// before backup_storage_part_size: 1048576 // 1MiB, below 5MiB minimum // after backup_storage_part_size: 5242880 // 5MiB minimum
Defensive patterns
Strategy: validation
Validate before calling
const minUploadPartSize = 5 * 1024 * 1024
const MaxPartSize = 5 * 1024 * 1024 * 1024
partSize := cfg.BackupStoragePartSize
if partSize < minUploadPartSize || partSize > MaxPartSize {
return fmt.Errorf("part size %d outside [%d, %d]", partSize, minUploadPartSize, MaxPartSize)
} Try / catch
partSize, err := storage.calculateUploadPartSize(...)
if errors.Is(err, s3backupstorage.ErrPartSize) {
log.Error("invalid backup part size config", slog.Any("error", err))
return err
} Prevention
- Keep part-size config within [5MiB, 5GiB] in deployment tooling
- Document that values are bytes; add config schema validation
- Add startup-time validation of backup_storage flags
When it happens
Trigger: Running a backup (AddFile path) with S3BackupStorage where backup_storage_part_size / minPartSize configuration is smaller than 5MiB or minPartSize is larger than 5GiB; also triggered in tests exercising edge cases.
Common situations: Operators setting backup_storage_part_size to tiny values to save bandwidth; misconfigured environment producing minPartSize outside [5MiB, 5GiB]; unit mistakes (bytes vs MiB) in config.
Related errors
- --s3-backup-storage-bucket required
- ErrPartSize
- AddFile cannot be called on read-only backup
- EndBackup cannot be called on read-only backup
- AbortBackup cannot be called on read-only backup
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/30f079f0592e8168.
Report an issue: GitHub.