From 8ee9c56f2a2b9868120844e13da814d744b48af1 Mon Sep 17 00:00:00 2001 From: XuPeng-SH Date: Wed, 11 Dec 2024 22:58:35 +0800 Subject: [PATCH] update 1 --- pkg/vm/engine/tae/txn/txnimpl/store.go | 4 +++- pkg/vm/engine/tae/txn/txnimpl/table.go | 13 +++++++++++++ pkg/vm/engine/tae/txn/txnimpl/txndb.go | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pkg/vm/engine/tae/txn/txnimpl/store.go b/pkg/vm/engine/tae/txn/txnimpl/store.go index 609af6426f745..6b1825b8a5636 100644 --- a/pkg/vm/engine/tae/txn/txnimpl/store.go +++ b/pkg/vm/engine/tae/txn/txnimpl/store.go @@ -746,7 +746,9 @@ func (store *txnStore) PrePrepare(ctx context.Context) (err error) { } approxSize := store.approxSize() if approxSize > MaxWalSize { - return moerr.NewInternalError(ctx, fmt.Sprintf("WAL entry approxSize %d is too large, max is %d", approxSize, MaxWalSize)) + return moerr.NewInternalError( + ctx, fmt.Sprintf("Txn %x WAL entry approxSize %d is too large, max is %d", store.txn.GetID(), approxSize, MaxWalSize), + ) } if approxSize > 50*mpool.MB { logutil.Warnf("[Large-WAL-Entry]txn %x, WAL entry approxSize %d", store.txn.GetID(), approxSize) diff --git a/pkg/vm/engine/tae/txn/txnimpl/table.go b/pkg/vm/engine/tae/txn/txnimpl/table.go index 035c37f32df58..d2b09d4c91e4a 100644 --- a/pkg/vm/engine/tae/txn/txnimpl/table.go +++ b/pkg/vm/engine/tae/txn/txnimpl/table.go @@ -1157,6 +1157,19 @@ func (tbl *txnTable) DoPrecommitDedupByPK( pksZM index.ZM, isTombstone bool, ) (err error) { + start := time.Now() + defer func() { + duration := time.Since(start) + if duration > time.Second { + logutil.Info( + "SLOW-LOG-DoPrecommitDedupByPK", + zap.String("txn", tbl.store.txn.String()), + zap.String("table", tbl.GetLocalSchema(isTombstone).Name), + zap.Bool("is-tombstone", isTombstone), + zap.Duration("duration", time.Since(start)), + ) + } + }() moprobe.WithRegion(context.Background(), moprobe.TxnTableDoPrecommitDedupByPK, func() { var rowIDs containers.Vector rowIDs, err = tbl.getBaseTable(isTombstone).preCommitGetRowsByPK(tbl.store.ctx, pks) diff --git a/pkg/vm/engine/tae/txn/txnimpl/txndb.go b/pkg/vm/engine/tae/txn/txnimpl/txndb.go index 76d5959dc0516..d9a80e558459d 100644 --- a/pkg/vm/engine/tae/txn/txnimpl/txndb.go +++ b/pkg/vm/engine/tae/txn/txnimpl/txndb.go @@ -29,6 +29,7 @@ import ( "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers" "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/handle" "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/txnif" + "go.uber.org/zap" ) type txnDB struct { @@ -483,6 +484,14 @@ func (db *txnDB) PrePrepare(ctx context.Context) (err error) { } } v2.TxnTNPrePrepareDeduplicateDurationHistogram.Observe(time.Since(now).Seconds()) + if time.Since(now) > time.Second { + logutil.Info( + "SLOW-LOG-PrePrepareDedup", + zap.String("txn", db.store.txn.String()), + zap.String("db", db.entry.GetName()), + zap.Duration("duration", time.Since(now)), + ) + } for _, table := range db.tables { if err = table.PrePrepare(); err != nil {