Skip to content

Commit

Permalink
adding cmd param for backup minio crossStorage (#420)
Browse files Browse the repository at this point in the history
Signed-off-by: mamoyal <[email protected]>
  • Loading branch information
MatanAmoyal1 authored Sep 5, 2024
1 parent 79a6915 commit 8d6fa7a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/backup_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ func (b *BackupContext) Check(ctx context.Context) string {
return "Failed to connect to storage backup path " + info + err.Error()
}

checkSrcPath := path.Join(b.milvusRootPath, "milvus_backup_check_src_"+string(time.Now().Unix()))
checkDstPath := path.Join(b.backupRootPath, "milvus_backup_check_dst_"+string(time.Now().Unix()))
checkSrcPath := path.Join(b.milvusRootPath, "milvus_backup_check_src_"+fmt.Sprint(time.Now().Unix()))
checkDstPath := path.Join(b.backupRootPath, "milvus_backup_check_dst_"+fmt.Sprint(time.Now().Unix()))

err = b.getMilvusStorageClient().Write(ctx, b.milvusBucketName, checkSrcPath, []byte{1})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/backup_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (h *Handlers) handleCreateBackup(c *gin.Context) (interface{}, error) {
// @Tags Backup
// @Produce application/json
// @Param request_id header string false "request_id"
// @Param collection_name query string true "collection_name"
// @Param collection_name query string false "collection_name"
// @Success 200 {object} backuppb.ListBackupsResponse
// @Router /list [get]
func (h *Handlers) handleListBackups(c *gin.Context) (interface{}, error) {
Expand Down
35 changes: 35 additions & 0 deletions core/paramtable/base_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,41 @@ func (gp *BaseTable) loadMinioConfig() {
if minioBackupRootPath != "" {
_ = gp.Save("minio.backupRootPath", minioBackupRootPath)
}

minioBackupAddress := os.Getenv("MINIO_BACKUP_ADDRESS")
if minioBackupAddress != "" {
_ = gp.Save("minio.backupAddress", minioBackupAddress)
}

minioBackupPort := os.Getenv("MINIO_BACKUP_PORT")
if minioBackupPort != "" {
_ = gp.Save("minio.backupPort", minioBackupPort)
}

minioBackupAccessKey := os.Getenv("MINIO_BACKUP_ACCESS_KEY")
if minioBackupAccessKey != "" {
_ = gp.Save("minio.backupAccessKeyID", minioBackupAccessKey)
}

minioBackupSecretKey := os.Getenv("MINIO_BACKUP_SECRET_KEY")
if minioBackupSecretKey != "" {
_ = gp.Save("minio.backupSecretAccessKey", minioBackupSecretKey)
}

minioBackupUseSSL := os.Getenv("MINIO_BACKUP_USE_SSL")
if minioBackupUseSSL != "" {
_ = gp.Save("minio.backupUseSSL", minioBackupUseSSL)
}

minioBackupUseIAM := os.Getenv("MINIO_BACKUP_USE_IAM")
if minioBackupUseIAM != "" {
_ = gp.Save("minio.backupUseIAM", minioBackupUseIAM)
}

minioBackupIAMEndpoint := os.Getenv("MINIO_BACKUP_IAM_ENDPOINT")
if minioBackupIAMEndpoint != "" {
_ = gp.Save("minio.backupIamEndpoint", minioBackupIAMEndpoint)
}
}

func (gp *BaseTable) loadMilvusConfig() {
Expand Down
4 changes: 2 additions & 2 deletions core/paramtable/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ func (p *MinioConfig) initBackupAccessKeyID() {
}

func (p *MinioConfig) initBackupSecretAccessKey() {
key := p.Base.LoadWithDefault("minio.secretAccessKey",
p.Base.LoadWithDefault("minio.backupSecretAccessKey", DefaultMinioSecretAccessKey))
key := p.Base.LoadWithDefault("minio.backupSecretAccessKey",
p.Base.LoadWithDefault("minio.secretAccessKey", DefaultMinioSecretAccessKey))
p.BackupSecretAccessKey = key
}

Expand Down

0 comments on commit 8d6fa7a

Please sign in to comment.