Skip to content

Commit

Permalink
chore: address some problems in PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Sep 27, 2023
1 parent 8be5c6c commit 22e184c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions deploy/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
minCPU: 2
maxIops: 1024
minIops: 1024
iopsWeight:
logDiskSize:
- zone: zone2
type:
Expand Down
2 changes: 1 addition & 1 deletion distribution/oceanbase/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
docker build -t $1 --build-arg GOPROXY=$(go env GOPROXY) --build-arg VERSION=$2 .
docker build -t $1 --build-arg GOPROXY=${GOPROXY} --build-arg VERSION=$2 .
5 changes: 3 additions & 2 deletions pkg/oceanbase/const/config/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package config
import "time"

const (
TenantSqlTimeout = 600 * time.Second
PollingJobSleepTime = 1 * time.Second
TenantSqlTimeout = 600 * time.Second
PollingJobSleepTime = 1 * time.Second
TenantRestoreTimeOut = 600 * time.Second
)
6 changes: 3 additions & 3 deletions pkg/oceanbase/operation/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ package operation

import (
"fmt"
"time"

"github.com/pkg/errors"

"github.com/oceanbase/ob-operator/pkg/oceanbase/const/config"
"github.com/oceanbase/ob-operator/pkg/oceanbase/const/sql"
"github.com/oceanbase/ob-operator/pkg/oceanbase/model"
)
Expand All @@ -33,7 +33,7 @@ func (m *OceanbaseOperationManager) SetRestorePassword(password string) error {

func (m *OceanbaseOperationManager) StartRestoreWithLimit(tenantName, uri, restoreOption string, limitKey, limitValue any) error {
sqlStatement := fmt.Sprintf(sql.StartRestoreWithLimit, tenantName, limitKey)
err := m.ExecWithTimeout(600*time.Second, sqlStatement, uri, limitValue, restoreOption)
err := m.ExecWithTimeout(config.TenantRestoreTimeOut, sqlStatement, uri, limitValue, restoreOption)
if err != nil {
m.Logger.Error(err, "Got exception when start restore with limit")
return errors.Wrap(err, "Start restore with limit")
Expand All @@ -42,7 +42,7 @@ func (m *OceanbaseOperationManager) StartRestoreWithLimit(tenantName, uri, resto
}

func (m *OceanbaseOperationManager) StartRestoreUnlimited(tenantName, uri, restoreOption string) error {
err := m.ExecWithTimeout(600*time.Second, fmt.Sprintf(sql.StartRestoreUnlimited, tenantName), uri, restoreOption)
err := m.ExecWithTimeout(config.TenantRestoreTimeOut, fmt.Sprintf(sql.StartRestoreUnlimited, tenantName), uri, restoreOption)
if err != nil {
m.Logger.Error(err, "Got exception when start restore unlimited")
return errors.Wrap(err, "Start restore unlimited")
Expand Down
3 changes: 1 addition & 2 deletions pkg/resource/obtenantrestore_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ func (m *ObTenantRestoreManager) checkRestoreProgress() error {
m.Recorder.Event(m.Resource, corev1.EventTypeWarning, "Restore job is failed", "Restore job is failed")
m.Resource.Status.Status = constants.RestoreJobFailed
}
}
if restoreJob == nil {
} else {
restoreHistory, err := con.GetLatestRestoreHistoryOfTenant(m.Resource.Spec.TargetTenant)
if err != nil {
return err
Expand Down

0 comments on commit 22e184c

Please sign in to comment.