From dce23d9417bfb8546eba2d724e0045e739f0cea3 Mon Sep 17 00:00:00 2001 From: Wenbin1002 Date: Fri, 13 Sep 2024 17:34:40 +0800 Subject: [PATCH] update --- pkg/vm/engine/disttae/txn.go | 14 +++++++++++--- pkg/vm/engine/disttae/txn_table.go | 3 +-- pkg/vm/engine/disttae/types.go | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/vm/engine/disttae/txn.go b/pkg/vm/engine/disttae/txn.go index b03244090ed55..1eb5f8606c4fe 100644 --- a/pkg/vm/engine/disttae/txn.go +++ b/pkg/vm/engine/disttae/txn.go @@ -497,7 +497,7 @@ func (txn *Transaction) dumpBatchLocked(offset int) error { } } - if typ == PersistedDelete && cnt < txn.engine.insertEntryMaxCount { + if typ == DELETE && cnt < txn.engine.insertEntryMaxCount { return nil } @@ -570,7 +570,7 @@ func (txn *Transaction) dumpBatchLocked(offset int) error { if dumpAll { if txn.approximateInMemDeleteCnt >= txn.engine.insertEntryMaxCount { - if err := dump(PersistedDelete); err != nil { + if err := dump(DELETE); err != nil { return err } } @@ -647,7 +647,7 @@ func (txn *Transaction) WriteFileLocked( tnStore DNStore) error { txn.hasS3Op.Store(true) newBat := bat - if typ == INSERT || typ == PersistedDelete { + if typ == INSERT || typ == DELETE { newBat = batch.NewWithSize(len(bat.Vecs)) newBat.SetAttributes([]string{catalog.BlockMeta_MetaLoc, catalog.ObjectMeta_ObjectStats}) @@ -677,6 +677,14 @@ func (txn *Transaction) WriteFileLocked( databaseName, tableName) } + + if typ == INSERT { + typ = PersistedInsert + } + if typ == DELETE { + typ = PersistedDelete + } + txn.readOnly.Store(false) entry := Entry{ typ: typ, diff --git a/pkg/vm/engine/disttae/txn_table.go b/pkg/vm/engine/disttae/txn_table.go index cb747aede2e67..5060e80f7afa4 100644 --- a/pkg/vm/engine/disttae/txn_table.go +++ b/pkg/vm/engine/disttae/txn_table.go @@ -1454,8 +1454,7 @@ func (tbl *txnTable) EnhanceDelete(bat *batch.Batch, name string) error { if err != nil { return err } - - if err := tbl.getTxn().WriteFile(DELETE, tbl.accountId, tbl.db.databaseId, tbl.tableId, + if err := tbl.getTxn().WriteFile(PersistedDelete, tbl.accountId, tbl.db.databaseId, tbl.tableId, tbl.db.databaseName, tbl.tableName, fileName, copBat, tbl.getTxn().tnStores[0]); err != nil { return err } diff --git a/pkg/vm/engine/disttae/types.go b/pkg/vm/engine/disttae/types.go index d625e5c137819..0bd471a6bbb3c 100644 --- a/pkg/vm/engine/disttae/types.go +++ b/pkg/vm/engine/disttae/types.go @@ -67,6 +67,7 @@ const ( ALTER // alter command for TN. Update batches for mo_tables and mo_columns will fall into the category of INSERT and DELETE. PersistedInsert PersistedDelete + PersistedAlter ) type NoteLevel string @@ -84,6 +85,7 @@ var ( ALTER: "alter", PersistedInsert: "persisted_insert", PersistedDelete: "persisted_delete", + PersistedAlter: "persisted_alter", } )