Skip to content

Commit

Permalink
Merge branch '1.1-dev' of https://github.com/matrixorigin/matrixone i…
Browse files Browse the repository at this point in the history
…nto fix_15452_1.1_improve
  • Loading branch information
zhangxu19830126 committed Apr 14, 2024
2 parents d2dde3d + f7572ea commit 7bb6739
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/catalog/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ const (
MO_DATABASE_ID = 1
MO_TABLES_ID = 2
MO_COLUMNS_ID = 3

// MO_RESERVED_MAX is the max reserved table ID.
MO_RESERVED_MAX = 100
)

// index use to update constraint
Expand Down
7 changes: 5 additions & 2 deletions pkg/vm/engine/tae/catalog/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,25 @@ func (e *DBEntry) DropTableEntryByID(id uint64, txn txnif.AsyncTxn) (newEntry bo

func (e *DBEntry) CreateTableEntry(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory) (created *TableEntry, err error) {
e.Lock()
defer e.Unlock()
created = NewTableEntry(e, schema, txn, dataFactory)
err = e.AddEntryLocked(created, txn, false)
e.Unlock()

return created, err
}

func (e *DBEntry) CreateTableEntryWithTableId(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory, tableId uint64) (created *TableEntry, err error) {
e.Lock()
defer e.Unlock()
if tableId < pkgcatalog.MO_RESERVED_MAX {
return nil, moerr.NewInternalErrorNoCtx("reserved table ID %d", tableId)
}
//Deduplicate for tableId
if _, exist := e.entries[tableId]; exist {
return nil, moerr.GetOkExpectedDup()
}
created = NewTableEntryWithTableId(e, schema, txn, dataFactory, tableId)
err = e.AddEntryLocked(created, txn, false)
e.Unlock()

return created, err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/vm/engine/tae/db/test/storage_usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ func Test_RemoveStaleAccounts(t *testing.T) {
}

func mockCkpDataWithVersion(version uint32, cnt int) (ckpDats []*logtail.CheckpointData, usages [][]logtail.UsageData) {
allocator := atomic.Uint64{}
var allocator atomic.Uint64
allocator.Store(pkgcatalog.MO_RESERVED_MAX)
for i := 0; i < cnt; i++ {
data := logtail.NewCheckpointDataWithVersion(version, common.DebugAllocator)

Expand Down

0 comments on commit 7bb6739

Please sign in to comment.