Skip to content

Commit 44b3761

Browse files
authored
Add debug log for 2.0.1 (#20729)
1 parent 25b06b2 commit 44b3761

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

pkg/vm/engine/tae/txn/txnimpl/store.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,9 @@ func (store *txnStore) PrePrepare(ctx context.Context) (err error) {
746746
}
747747
approxSize := store.approxSize()
748748
if approxSize > MaxWalSize {
749-
return moerr.NewInternalError(ctx, fmt.Sprintf("WAL entry approxSize %d is too large, max is %d", approxSize, MaxWalSize))
749+
return moerr.NewInternalError(
750+
ctx, fmt.Sprintf("Txn %x WAL entry approxSize %d is too large, max is %d", store.txn.GetID(), approxSize, MaxWalSize),
751+
)
750752
}
751753
if approxSize > 50*mpool.MB {
752754
logutil.Warnf("[Large-WAL-Entry]txn %x, WAL entry approxSize %d", store.txn.GetID(), approxSize)

pkg/vm/engine/tae/txn/txnimpl/table.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,19 @@ func (tbl *txnTable) DoPrecommitDedupByPK(
11571157
pksZM index.ZM,
11581158
isTombstone bool,
11591159
) (err error) {
1160+
start := time.Now()
1161+
defer func() {
1162+
duration := time.Since(start)
1163+
if duration > time.Second {
1164+
logutil.Info(
1165+
"SLOW-LOG-DoPrecommitDedupByPK",
1166+
zap.String("txn", tbl.store.txn.String()),
1167+
zap.String("table", tbl.GetLocalSchema(isTombstone).Name),
1168+
zap.Bool("is-tombstone", isTombstone),
1169+
zap.Duration("duration", time.Since(start)),
1170+
)
1171+
}
1172+
}()
11601173
moprobe.WithRegion(context.Background(), moprobe.TxnTableDoPrecommitDedupByPK, func() {
11611174
var rowIDs containers.Vector
11621175
rowIDs, err = tbl.getBaseTable(isTombstone).preCommitGetRowsByPK(tbl.store.ctx, pks)

pkg/vm/engine/tae/txn/txnimpl/txndb.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers"
3030
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/handle"
3131
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/txnif"
32+
"go.uber.org/zap"
3233
)
3334

3435
type txnDB struct {
@@ -483,6 +484,14 @@ func (db *txnDB) PrePrepare(ctx context.Context) (err error) {
483484
}
484485
}
485486
v2.TxnTNPrePrepareDeduplicateDurationHistogram.Observe(time.Since(now).Seconds())
487+
if time.Since(now) > time.Second {
488+
logutil.Info(
489+
"SLOW-LOG-PrePrepareDedup",
490+
zap.String("txn", db.store.txn.String()),
491+
zap.String("db", db.entry.GetName()),
492+
zap.Duration("duration", time.Since(now)),
493+
)
494+
}
486495

487496
for _, table := range db.tables {
488497
if err = table.PrePrepare(); err != nil {

0 commit comments

Comments
 (0)