Skip to content

Commit

Permalink
make ts in checkpoint human readable (matrixorigin#18966)
Browse files Browse the repository at this point in the history
make ts in checkpoint human readable

Approved by: @daviszhen
  • Loading branch information
ck89119 authored Sep 24, 2024
1 parent 7a04342 commit 6b04a52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
21 changes: 0 additions & 21 deletions pkg/cdc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,6 @@ type DecoderOutput struct {
deleteAtmBatch *AtomicBatch
}

//func (d *DecoderOutput) ckpBatSize() int {
// if d.checkpointBat == nil {
// return 0
// }
// return d.checkpointBat.RowCount()
//}
//
//func (d *DecoderOutput) insertBatSize() int {
// if d.insertAtmBatch == nil || d.insertAtmBatch.Rows == nil {
// return 0
// }
// return d.insertAtmBatch.Rows.Len()
//}
//
//func (d *DecoderOutput) deleteBatSize() int {
// if d.deleteAtmBatch == nil || d.deleteAtmBatch.Rows == nil {
// return 0
// }
// return d.deleteAtmBatch.Rows.Len()
//}

type RowType int

const (
Expand Down
19 changes: 11 additions & 8 deletions pkg/frontend/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import (
"time"

"github.com/google/uuid"

"go.uber.org/zap"

"github.com/matrixorigin/matrixone/pkg/catalog"
cdc2 "github.com/matrixorigin/matrixone/pkg/cdc"
"github.com/matrixorigin/matrixone/pkg/common/moerr"
Expand All @@ -35,11 +32,13 @@ import (
"github.com/matrixorigin/matrixone/pkg/fileservice"
"github.com/matrixorigin/matrixone/pkg/logutil"
"github.com/matrixorigin/matrixone/pkg/pb/task"
"github.com/matrixorigin/matrixone/pkg/pb/timestamp"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
"github.com/matrixorigin/matrixone/pkg/taskservice"
"github.com/matrixorigin/matrixone/pkg/txn/client"
ie "github.com/matrixorigin/matrixone/pkg/util/internalExecutor"
"github.com/matrixorigin/matrixone/pkg/vm/engine"
"go.uber.org/zap"
)

const (
Expand Down Expand Up @@ -1703,9 +1702,10 @@ func handleShowCdc(ses *Session, execCtx *ExecCtx, st *tree.ShowCDC) (err error)

func getTaskCkp(ctx context.Context, bh BackgroundExec, accountId uint32, taskId string) (s string, err error) {
var (
dbName string
tblName string
watermark string
dbName string
tblName string
watermarkStr string
watermark timestamp.Timestamp
)

s = "{\n"
Expand All @@ -1729,11 +1729,14 @@ func getTaskCkp(ctx context.Context, bh BackgroundExec, accountId uint32, taskId
if tblName, err = result.GetString(ctx, i, 1); err != nil {
return
}
if watermark, err = result.GetString(ctx, i, 2); err != nil {
if watermarkStr, err = result.GetString(ctx, i, 2); err != nil {
return
}
if watermark, err = timestamp.ParseTimestamp(watermarkStr); err != nil {
return
}

s += fmt.Sprintf(" \"%s.%s\": %s,\n", dbName, tblName, watermark)
s += fmt.Sprintf(" \"%s.%s\": %s,\n", dbName, tblName, watermark.ToStdTime().String())
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/cdc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ func Test_getTaskCkp(t *testing.T) {
accountId: sysAccountID,
taskId: "taskID-1",
},
wantS: "{\n \"db1.tb1\": 0-0,\n}",
wantS: "{\n \"db1.tb1\": 1970-01-01 00:00:00 +0000 UTC,\n}",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 6b04a52

Please sign in to comment.