Skip to content

Commit

Permalink
Merge branch 'main' into enable-multiple-merges-on-one-table-at-once
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 23, 2024
2 parents c19bce4 + 2219aa0 commit 4c6d275
Show file tree
Hide file tree
Showing 167 changed files with 11,620 additions and 3,735 deletions.
26 changes: 13 additions & 13 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@

# pkg/common @fengttt
/pkg/common @zhangxu19830126
/pkg/common/mpool @m-schen
/pkg/common/mpool @reusee @XuPeng-SH
/pkg/common/malloc @reusee
/pkg/common/spool @reusee @m-schen
/pkg/common/spool @reusee @ouyuanning @aunjgr @badboynt1
/pkg/common/async @zhangxu19830126
/pkg/common/bitmap @aunjgr
/pkg/common/hashmap @aunjgr
Expand All @@ -77,7 +77,7 @@
# pkg/container
/pkg/container @XuPeng-SH
/pkg/container/vector @aunjgr @XuPeng-SH
/pkg/container/pSpool @m-schen
/pkg/container/pSpool @reusee @aunjgr @ouyuanning @badboynt1

# pkg/defines
/pkg/defines @daviszhen
Expand Down Expand Up @@ -116,15 +116,15 @@
/pkg/objectio @LeftHandCold @XuPeng-SH

# pkg/partition
/pkg/partition @aunjgr @m-schen
/pkg/partition @aunjgr @iamlinjunhong

# folders under pkg/pb contain code generated by pb, owners will be responsible
# for compatibility issues required for rolling upgrade.
/pkg/pb @zhangxu19830126
/pkg/pb/logservice @zhangxu19830126
/pkg/pb/metadata @zhangxu19830126
/pkg/pb/metric @aptend
/pkg/pb/pipeline @m-schen
/pkg/pb/pipeline @badboynt1 @ouyuanning @aunjgr
/pkg/pb/plan @ouyuanning @aunjgr
/pkg/pb/timestamp @zhangxu19830126
/pkg/pb/txn @zhangxu19830126
Expand All @@ -133,19 +133,19 @@
/pkg/perfcounter @reusee

# pkg/sort
/pkg/sort @aunjgr @m-schen
/pkg/sort @aunjgr @badboynt1

# pkg/bootstrap
/pkg/bootstrap @daviszhen @zhangxu19830126 @qingxinhome @LeftHandCold

# pkg/sql
/pkg/sql @aunjgr
/pkg/sql/colexec @m-schen
/pkg/sql/compile @m-schen @ouyuanning @aunjgr @badboynt1 @qingxinhome
/pkg/sql/colexec @badboynt1 @ouyuanning @aunjgr
/pkg/sql/compile @ouyuanning @aunjgr @badboynt1 @qingxinhome
/pkg/sql/models @qingxinhome
/pkg/sql/parsers @iamlinjunhong
/pkg/sql/plan @ouyuanning @aunjgr @badboynt1
/pkg/sql/plan/function @m-schen
/pkg/sql/plan/function @ouyuanning @qingxinhome @aujngr
/pkg/sql/plan/explain @ouyuanning @aunjgr @badboynt1 @qingxinhome
/pkg/sql/plan/tools @daviszhen @qingxinhome
/pkg/sql/colexec/indexjoin @aunjgr @badboynt1
Expand Down Expand Up @@ -181,7 +181,7 @@
/pkg/tests/txn @zhangxu19830126

# pkg/testutil
/pkg/testutil @m-schen
/pkg/testutil @ouyuanning @qingxinhome @daviszhen

# pkg/txn
/pkg/txn @zhangxu19830126
Expand All @@ -203,8 +203,8 @@
# engines and engine related stuff
/pkg/vm @XuPeng-SH
/pkg/vm/engine @XuPeng-SH
/pkg/vm/pipeline @m-schen
/pkg/vm/process @m-schen @aunjgr
/pkg/vm/pipeline @ouyuanning @badboynt1 @aunjgr
/pkg/vm/process @reusee @aunjgr @badboynt1 @XuPeng-SH
/pkg/vm/message @badboynt1
/pkg/vm/engine/disttae @XuPeng-SH @triump2020
/pkg/vm/engine/disttae/logtailreplay @triump2020 @XuPeng-SH
Expand All @@ -230,7 +230,7 @@
/proto/logservice.proto @zhangxu19830126
/proto/metadata.proto @zhangxu19830126
/proto/metric.proto @aptend
/proto/pipeline.proto @m-schen
/proto/pipeline.proto @ouyuanning @aunjgr @badboynt1
/proto/plan.proto @aunjgr
/proto/timestamp.proto @zhangxu19830126
/proto/txn.proto @zhangxu19830126
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/aws/smithy-go v1.22.1
github.com/axiomhq/hyperloglog v0.0.0-20230201085229-3ddf4bad03dc
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5
github.com/cespare/xxhash/v2 v2.2.0
github.com/cespare/xxhash/v2 v2.3.0
github.com/cockroachdb/errors v1.9.1
github.com/confluentinc/confluent-kafka-go/v2 v2.4.0
github.com/containerd/cgroups/v3 v3.0.1
Expand Down Expand Up @@ -87,8 +87,8 @@ require (
golang.org/x/sync v0.8.0
golang.org/x/sys v0.26.0
gonum.org/v1/gonum v0.14.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.34.2
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.36.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

Expand Down Expand Up @@ -204,7 +204,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/tools v0.26.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

Expand Down
26 changes: 12 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
Expand Down Expand Up @@ -949,8 +949,8 @@ golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ=
golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -1073,28 +1073,26 @@ gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6d
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
google.golang.org/genproto v0.0.0-20240325203815-454cdb8f5daa h1:ePqxpG3LVx+feAUOx8YmR5T7rc0rdzK8DyxM8cQ9zq0=
google.golang.org/genproto v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:CnZenrTdRJb7jc+jOm0Rkywq+9wh0QC4U8tyiRbEPPM=
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4=
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw=
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand All @@ -1106,8 +1104,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
86 changes: 84 additions & 2 deletions pkg/backup/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ package backup
import (
"context"
"fmt"
"github.com/panjf2000/ants/v2"
"github.com/prashantv/gostub"
"path"
"sync"
"testing"
"time"

"github.com/panjf2000/ants/v2"
"github.com/prashantv/gostub"

"github.com/matrixorigin/matrixone/pkg/common/runtime"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/defines"
"github.com/matrixorigin/matrixone/pkg/fileservice"
"github.com/matrixorigin/matrixone/pkg/logservice"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
"github.com/matrixorigin/matrixone/pkg/util/fault"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/catalog"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/testutil"
Expand Down Expand Up @@ -339,6 +341,86 @@ func TestBackupData3(t *testing.T) {

}

func TestBackupData4(t *testing.T) {
defer testutils.AfterTest(t)()
testutils.EnsureNoLeak(t)
ctx := context.Background()

fault.Enable()
defer fault.Disable()
fault.AddFaultPoint(ctx, "back up UT", ":::", "echo", 0, "debug", false)
defer fault.RemoveFaultPoint(ctx, "back up UT")

opts := config.WithLongScanAndCKPOpts(nil)
db := testutil.NewTestEngine(ctx, ModuleName, t, opts)
defer db.Close()
defer opts.Fs.Close(ctx)

schema := catalog.MockSchemaAll(13, 3)
schema.Extra.BlockMaxRows = 10
schema.Extra.ObjectMaxBlocks = 10
db.BindSchema(schema)

totalRows := 20
bat := catalog.MockBatch(schema, int(totalRows))
defer bat.Close()
db.CreateRelAndAppend2(bat, true)
t.Log(db.Catalog.SimplePPString(common.PPL1))

dir := path.Join(db.Dir, "/local")
c := fileservice.Config{
Name: defines.LocalFileServiceName,
Backend: "DISK",
DataDir: dir,
}
service, err := fileservice.NewFileService(ctx, c, nil)
assert.Nil(t, err)
defer service.Close(ctx)
backupTime := time.Now().UTC()
currTs := types.BuildTS(backupTime.UnixNano(), 0)
locations := make([]string, 0)
locations = append(locations, backupTime.Format(time.DateTime))
location, err := db.ForceCheckpointForBackup(ctx, currTs, 20*time.Second)
assert.Nil(t, err)
db.BGCheckpointRunner.DisableCheckpoint()
locations = append(locations, location)
compacted := db.BGCheckpointRunner.GetCompacted()
checkpoints := db.BGCheckpointRunner.GetAllCheckpointsForBackup(compacted)
files := make(map[string]string, 0)
for _, candidate := range checkpoints {
if files[candidate.GetLocation().Name().String()] == "" {
var loc string
loc = candidate.GetLocation().String()
loc += ":"
loc += fmt.Sprintf("%d", candidate.GetVersion())
files[candidate.GetLocation().Name().String()] = loc
}
}
for _, location := range files {
locations = append(locations, location)
}
fileList := make([]*taeFile, 0)
err = execBackup(ctx, "", db.Opts.Fs, service, locations, 1, types.TS{}, "full", &fileList)
assert.Nil(t, err)
fileMap := make(map[string]struct{})
for _, file := range fileList {
_, ok := fileMap[file.path]
assert.True(t, !ok)
fileMap[file.path] = struct{}{}
}
db.Opts.Fs = service
db.Restart(ctx)
t.Log(db.Catalog.SimplePPString(3))
txn, rel := testutil.GetDefaultRelation(t, db.DB, schema.Name)
testutil.CheckAllColRowsByScan(t, rel, int(totalRows), true)
assert.NoError(t, txn.Commit(context.Background()))
db.MergeBlocks(true)
db.ForceGlobalCheckpoint(ctx, db.TxnMgr.Now(), time.Second, time.Second)
t.Log(db.Catalog.SimplePPString(3))
db.Restart(ctx)

}

func Test_saveTaeFilesList(t *testing.T) {
type args struct {
ctx context.Context
Expand Down
23 changes: 20 additions & 3 deletions pkg/bootstrap/versions/upgrade_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ import (
"github.com/matrixorigin/matrixone/pkg/util/executor"
)

const (
// system tenant default role ID and user ID
sysAdminRoleID = 0
sysRootID = 0

// general tenant default role ID and user ID
accountAdminRoleID = 2
accountAdminUserID = 2
)

const (
T_any = "ANY"
T_bool = "BOOL"
Expand Down Expand Up @@ -131,6 +141,13 @@ type UpgradeEntry struct {

// Upgrade entity execution upgrade entrance
func (u *UpgradeEntry) Upgrade(txn executor.TxnExecutor, accountId uint32) error {
userId := uint32(sysRootID)
roleId := uint32(sysAdminRoleID)
if accountId != catalog.System_Account {
userId = accountAdminUserID
roleId = accountAdminRoleID
}

exist, err := u.CheckFunc(txn, accountId)
if err != nil {
getLogger(txn.Txn().TxnOptions().CN).Error("execute upgrade entry check error", zap.Error(err), zap.String("upgrade entry", u.String()))
Expand All @@ -142,7 +159,7 @@ func (u *UpgradeEntry) Upgrade(txn executor.TxnExecutor, accountId uint32) error
} else {
// 1. First, judge whether there is prefix sql
if u.PreSql != "" {
res, err := txn.Exec(u.PreSql, executor.StatementOption{}.WithAccountID(accountId))
res, err := txn.Exec(u.PreSql, executor.StatementOption{}.WithAccountID(accountId).WithUserID(userId).WithRoleID(roleId))
if err != nil {
getLogger(txn.Txn().TxnOptions().CN).Error("execute upgrade entry pre-sql error", zap.Error(err), zap.String("upgrade entry", u.String()))
return err
Expand All @@ -151,7 +168,7 @@ func (u *UpgradeEntry) Upgrade(txn executor.TxnExecutor, accountId uint32) error
}

// 2. Second, Execute upgrade sql
res, err := txn.Exec(u.UpgSql, executor.StatementOption{}.WithAccountID(accountId))
res, err := txn.Exec(u.UpgSql, executor.StatementOption{}.WithAccountID(accountId).WithUserID(userId).WithRoleID(roleId))
if err != nil {
getLogger(txn.Txn().TxnOptions().CN).Error("execute upgrade entry sql error", zap.Error(err), zap.String("upgrade entry", u.String()))
return err
Expand All @@ -160,7 +177,7 @@ func (u *UpgradeEntry) Upgrade(txn executor.TxnExecutor, accountId uint32) error

// 2. Third, after the upgrade is completed, judge whether there is post-sql
if u.PostSql != "" {
res, err = txn.Exec(u.PostSql, executor.StatementOption{}.WithAccountID(accountId))
res, err = txn.Exec(u.PostSql, executor.StatementOption{}.WithAccountID(accountId).WithUserID(userId).WithRoleID(roleId))
if err != nil {
getLogger(txn.Txn().TxnOptions().CN).Error("execute upgrade entry post-sql error", zap.Error(err), zap.String("upgrade entry", u.String()))
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/bootstrap/versions/v2_0_1/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ func Test_HandleTenantUpgrade(t *testing.T) {
return executor.Result{}, nil
}, txnOperator)

upg_mo_user_add_password_last_changed.Upgrade(executor, uint32(0))
upg_mo_user_add_lock_time.Upgrade(executor, uint32(0))
upg_mo_user_add_password_last_changed.Upgrade(executor, uint32(1))
upg_mo_user_add_lock_time.Upgrade(executor, uint32(1))
},
)
runtime.RunTest(
Expand Down
2 changes: 1 addition & 1 deletion pkg/cdc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func AesCFBDecode(ctx context.Context, data string) (string, error) {
return AesCFBDecodeWithKey(ctx, data, []byte(AesKey))
}

func AesCFBDecodeWithKey(ctx context.Context, data string, aesKey []byte) (string, error) {
var AesCFBDecodeWithKey = func(ctx context.Context, data string, aesKey []byte) (string, error) {
if len(aesKey) == 0 {
return "", moerr.NewInternalErrorNoCtx("AesKey is not initialized")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cnservice/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func (s *service) getTxnSender() (sender rpc.TxnSender, err error) {
resp.CNOpResponse = &txn.CNOpResponse{Payload: payload}
}
case txn.TxnMethod_Commit:
_, err = storage.Commit(ctx, req.Txn)
_, err = storage.Commit(ctx, req.Txn, nil, nil)
if err == nil {
resp.Txn.Status = txn.TxnStatus_Committed
}
Expand Down
Loading

0 comments on commit 4c6d275

Please sign in to comment.