compact 源码解析
memoryStorage 接收并执行 compact
// MemoryStorage implements the Storage interface backed by an
// in-memory array.
type MemoryStorage struct {
// Protects access to all fields. Most methods of MemoryStorage are
// run on the raft goroutine, but Append() is run on an application
// goroutine.
sync.Mutex
hardState pb.HardState
snapshot pb.Snapshot
// ents[i] has raft log position i+snapshot.Metadata.Index
ents []pb.Entry
KVStore 获得和应用 compact entry 的方式
func (s *EtcdServer) apply
func (s *EtcdServer) applyEntryNormal
func (a *applierV3backend) Apply
func (a *applierV3backend) Compaction
func (s *store) Compact
func (s *store) compact
func (ti *treeIndex) Compact
func (ki *keyIndex) compact
func (ki *keyIndex) doCompact
func (s *store) scheduleCompaction
func (t *batchTx) UnsafeDelete
技巧
最后更新于