当前位置:网站首页>Chang'an chain learning research - storage analysis wal mechanism
Chang'an chain learning research - storage analysis wal mechanism
2022-07-19 14:57:00 【InfoQ】

// register wal perhaps bfdb
if err = m.registerFileOrLogDB(chainId, storeConfig, logger); err != nil {
return err
}// register bfdb perhaps wal
func (m *Factory) registerFileOrLogDB(chainId string, storeConfig *conf.StorageConfig, logger protocol.Logger) error {
var (
err error
bfdb *blockfiledb.BlockFile
walLog *wal.Log
)
// Handle bfdb, To complete the registration
if !storeConfig.DisableBlockFileDb {
opts := blockfiledb.DefaultOptions
opts.NoCopy = true
opts.NoSync = storeConfig.LogDBSegmentAsync
if storeConfig.LogDBSegmentSize > 64 { // LogDBSegmentSize default is 64MB
opts.SegmentSize = storeConfig.LogDBSegmentSize * 1024 * 1024
}
bfdbPath := filepath.Join(storeConfig.StorePath, chainId, blockFilePath)
bfdb, err = blockfiledb.Open(bfdbPath, opts, logger)
if err != nil {
panic(fmt.Sprintf("open block file db failed, path:%s, error:%s", bfdbPath, err))
}
return m.ioc.Register(func() binlog.BinLogger { return bfdb })
}
// Handle wal, To complete the registration
opts := wal.DefaultOptions
opts.NoCopy = true
opts.NoSync = storeConfig.LogDBSegmentAsync
if storeConfig.LogDBSegmentSize > 0 {
// LogDBSegmentSize default is 20MB
opts.SegmentSize = storeConfig.LogDBSegmentSize * 1024 * 1024
}
walPath := filepath.Join(storeConfig.StorePath, chainId, walLogPath)
walLog, err = wal.Open(walPath, opts)
if err != nil {
panic(fmt.Sprintf("open wal log failed, path:%s, error:%s", walPath, err))
}
return m.ioc.Register(func() *wal.Log { return walLog })
}




walLog, err = wal.Open(walPath, opts)
return m.ioc.Register(func() *wal.Log { return walLog })
l := &Log{path: path, opts: *opts} Create a log example
l.scache.Resize(l.opts.SegmentCacheSize)
if err := os.MkdirAll(path, 0777); err != nil { establish wal Daily path
return nil, err
}
if err := l.load(); err != nil 边栏推荐
- Deep understanding of transaction isolation levels
- Pyside2 drawing embedded in Matplotlib
- Zhikanghu property elderly care service plan
- 学习记录[email protected]之moveActivityIdTo任务回退特殊案例分析
- End repeated development and personalize the login system in twoorthree times
- Excellent jar package startup shell script collection
- Scheduled tasks, VIM directly creates and modifies users
- 背包问题 (Knapsack problem)
- Sub database and sub table
- MySQL storage functions and triggers
猜你喜欢

UCAS. Deep learning Final review knowledge points summary notes

【MQTT从入门到提高系列 | 07】MQTT3.1.1之链路保活及断开

Unveil the mystery of service grid istio service mesh

【MQTT从入门到提高系列 | 06】MQTT3.1.1之SUBSCRIBE订阅工作流

csrf防护机制

Win10 Microsoft Store cannot be opened (enable TLS 1.2)
![[Axi] interpret the additional signals of the Axi protocol (QoS signal, region signal, and user signal)](/img/2b/15b3d831bba6aa772ad83f3ac91d23.png)
[Axi] interpret the additional signals of the Axi protocol (QoS signal, region signal, and user signal)

6U VPX high speed signal processing board based on ku115+mpsoc (xcku115 + zu9eg +dsp)

SQL wrong questions set of Niuke brush questions

3438. 数制转换
随机推荐
Notes on random nodes of force buckle 382 linked list
009 execution sequence of SQL statement of interview questions
论文阅读 TEMPORAL GRAPH NETWORKS FOR DEEP LEARNING ON DYNAMIC GRAPHS
Istio XDS配置生成实现
LabVIEW uses multithreading. Will the program run faster
Zabbix实现对Redis的监控
MySQL storage functions and triggers
Cilium & Hubble
Deployment 原理
The bill module of freeswitch
TDesign CompositionAPI 重构之路
DMA方式的特点
国科大. 深度学习. 期末试题与简要思路分析
PKI:TLS握手
Mvcc multi version concurrency control
Display module in pyGame
2021 national vocational college skills competition network construction and application events
Is it safe to buy funds in a securities account? I want to make a fixed investment in the fund
UCAS. Deep learning Final review knowledge points summary notes
Problème de la valeur maximale de la fenêtre coulissante