mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-28 22:45:26 +08:00
Add rocksmq comments (#8474)
Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
parent
3aabc1d3ee
commit
5e25041254
@ -24,16 +24,23 @@ import (
|
|||||||
rocksdbkv "github.com/milvus-io/milvus/internal/kv/rocksdb"
|
rocksdbkv "github.com/milvus-io/milvus/internal/kv/rocksdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Global rocksmq instance that will be initialized only once
|
||||||
var Rmq *rocksmq
|
var Rmq *rocksmq
|
||||||
|
|
||||||
|
// once is used to init global rocksmq
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
|
// Params provide params that rocksmq needs
|
||||||
var params paramtable.BaseTable
|
var params paramtable.BaseTable
|
||||||
|
|
||||||
|
// InitRmq is deprecate implementation of global rocksmq. will be removed later
|
||||||
func InitRmq(rocksdbName string, idAllocator allocator.GIDAllocator) error {
|
func InitRmq(rocksdbName string, idAllocator allocator.GIDAllocator) error {
|
||||||
var err error
|
var err error
|
||||||
Rmq, err = NewRocksMQ(rocksdbName, idAllocator)
|
Rmq, err = NewRocksMQ(rocksdbName, idAllocator)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitRocksMQ init global rocksmq single instance
|
||||||
func InitRocksMQ() error {
|
func InitRocksMQ() error {
|
||||||
var err error
|
var err error
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
@ -68,6 +75,7 @@ func InitRocksMQ() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloseRocksMQ is used to close global rocksmq
|
||||||
func CloseRocksMQ() {
|
func CloseRocksMQ() {
|
||||||
log.Debug("Close Rocksmq!")
|
log.Debug("Close Rocksmq!")
|
||||||
if Rmq != nil && Rmq.store != nil {
|
if Rmq != nil && Rmq.store != nil {
|
||||||
|
|||||||
@ -28,10 +28,13 @@ import (
|
|||||||
rocksdbkv "github.com/milvus-io/milvus/internal/kv/rocksdb"
|
rocksdbkv "github.com/milvus-io/milvus/internal/kv/rocksdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// UniqueID is the type of message ID
|
||||||
type UniqueID = typeutil.UniqueID
|
type UniqueID = typeutil.UniqueID
|
||||||
|
|
||||||
|
// RocksmqPageSize is the size of a message page, default 2GB
|
||||||
var RocksmqPageSize int64 = 2 << 30
|
var RocksmqPageSize int64 = 2 << 30
|
||||||
|
|
||||||
|
// Const variable that will be used in rocksmqs
|
||||||
const (
|
const (
|
||||||
DefaultMessageID = "-1"
|
DefaultMessageID = "-1"
|
||||||
FixedChannelNameLen = 320
|
FixedChannelNameLen = 320
|
||||||
@ -109,6 +112,9 @@ type rocksmq struct {
|
|||||||
retentionInfo *retentionInfo
|
retentionInfo *retentionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1. New rocksmq instance based on rocksdb with name and rocksdbkv with kvname
|
||||||
|
// 2. Init retention info, load retention info to memory
|
||||||
|
// 3. Start retention goroutine
|
||||||
func NewRocksMQ(name string, idAllocator allocator.GIDAllocator) (*rocksmq, error) {
|
func NewRocksMQ(name string, idAllocator allocator.GIDAllocator) (*rocksmq, error) {
|
||||||
bbto := gorocksdb.NewDefaultBlockBasedTableOptions()
|
bbto := gorocksdb.NewDefaultBlockBasedTableOptions()
|
||||||
bbto.SetBlockCache(gorocksdb.NewLRUCache(RocksDBLRUCacheCapacity))
|
bbto.SetBlockCache(gorocksdb.NewLRUCache(RocksDBLRUCacheCapacity))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user