From 0121976e346ad9f07d52bfc6a84881d0f28ebdfe Mon Sep 17 00:00:00 2001 From: gouhongshen Date: Fri, 17 Jan 2025 10:55:49 +0800 Subject: [PATCH] notify global stats --- pkg/vm/engine/disttae/mo_table_stats.go | 3 ++- pkg/vm/engine/disttae/txn_table.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/vm/engine/disttae/mo_table_stats.go b/pkg/vm/engine/disttae/mo_table_stats.go index bb6489b81e1d3..ce76f9250c71f 100644 --- a/pkg/vm/engine/disttae/mo_table_stats.go +++ b/pkg/vm/engine/disttae/mo_table_stats.go @@ -2245,10 +2245,11 @@ func subscribeTable( databaseName: tbl.dbName, } + txnTbl.eng = eng txnTbl.relKind = tbl.relKind txnTbl.primarySeqnum = tbl.pkSequence - if pState, err = eng.(*Engine).PushClient().toSubscribeTable(ctx, &txnTbl); err != nil { + if pState, err = txnTbl.tryToSubscribe(ctx); err != nil { return nil, err } diff --git a/pkg/vm/engine/disttae/txn_table.go b/pkg/vm/engine/disttae/txn_table.go index c03ba0ee37740..86263dc32b48c 100644 --- a/pkg/vm/engine/disttae/txn_table.go +++ b/pkg/vm/engine/disttae/txn_table.go @@ -1240,6 +1240,11 @@ func (tbl *txnTable) isCreatedInTxn(ctx context.Context) (bool, error) { return tbl.createdInTxn, nil } + // test or mo_table_stats + if tbl.db.op == nil { + return false, nil + } + if tbl.db.op.IsSnapOp() || catalog.IsSystemTable(tbl.tableId) { // if the operation is snapshot read, isCreatedInTxn can not be called by AlterTable // So if the snapshot read want to subcribe logtail tail, let it go ahead.