Repository: matrixorigin/matrixone
Pull request #3837 (2022-07-09 08:14:16)

logservice: some minor refactoring and cleanups
**What type of PR is this?**

- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [x] Code Refactoring

**Which issue(s) this PR fixes:**

issue #

**What this PR does / why we need it:**

some minor refactoring and cleanups

**Special notes for your reviewer:**

Not Available

**Additional documentation (e.g. design docs, usage docs, etc.):**

Not Available



Patch:
diff --git a/pkg/hakeeper/rsm.go b/pkg/hakeeper/rsm.go
index 0bb55a1dd..9a1063b0f 100644
--- a/pkg/hakeeper/rsm.go
+++ b/pkg/hakeeper/rsm.go
@@ -44,18 +44,7 @@ const (
 	// DefaultHAKeeperShardID is the shard ID assigned to the special HAKeeper
 	// shard.
 	DefaultHAKeeperShardID uint64 = 0
-	headerSize                    = 2
-)
-
-const (
-	createLogShardTag uint16 = iota + 0xAE01
-	tickTag
-	dnHeartbeatTag
-	logHeartbeatTag
-	getIDTag
-	updateScheduleCommandTag
-	setStateTag
-	initialClusterRequestTag
+	headerSize                    = 4
 )
 
 type StateQuery struct{}
@@ -68,8 +57,8 @@ type stateMachine struct {
 	state     pb.HAKeeperRSMState
 }
 
-func parseCmdTag(cmd []byte) uint16 {
-	return binaryEnc.Uint16(cmd)
+func parseCmdTag(cmd []byte) pb.HAKeeperUpdateType {
+	return pb.HAKeeperUpdateType(binaryEnc.Uint32(cmd))
 }
 
 func GetInitialClusterRequestCmd(numOfLogShards uint64,
@@ -84,18 +73,18 @@ func GetInitialClusterRequestCmd(numOfLogShards uint64,
 		panic(err)
 	}
 	cmd := make([]byte, headerSize+len(payload))
-	binaryEnc.PutUint16(cmd, initialClusterRequestTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.InitialClusterUpdate))
 	copy(cmd[headerSize:], payload)
 	return cmd
 }
 
 func isInitialClusterRequestCmd(cmd []byte) bool {
-	return parseCmdTag(cmd) == initialClusterRequestTag
+	return parseCmdTag(cmd) == pb.InitialClusterUpdate
 }
 
 func parseInitialClusterRequestCmd(cmd []byte) pb.InitialClusterRequest {
-	if parseCmdTag(cmd) != initialClusterRequestTag {
-		panic("not a initialClusterRequestTag")
+	if parseCmdTag(cmd) != pb.InitialClusterUpdate {
+		panic("not a initial cluster update")
 	}
 	payload := cmd[headerSize:]
 	var result pb.InitialClusterRequest
@@ -111,7 +100,7 @@ func GetUpdateCommandsCmd(term uint64, cmds []pb.ScheduleCommand) []byte {
 		Commands: cmds,
 	}
 	data := make([]byte, headerSize+b.Size())
-	binaryEnc.PutUint16(data, updateScheduleCommandTag)
+	binaryEnc.PutUint32(data, uint32(pb.ScheduleCommandUpdate))
 	if _, err := b.MarshalTo(data[headerSize:]); err != nil {
 		panic(err)
 	}
@@ -119,40 +108,25 @@ func GetUpdateCommandsCmd(term uint64, cmds []pb.ScheduleCommand) []byte {
 }
 
 func isUpdateCommandsCmd(cmd []byte) bool {
-	return parseCmdTag(cmd) == updateScheduleCommandTag
+	return parseCmdTag(cmd) == pb.ScheduleCommandUpdate
 }
 
 func GetGetIDCmd(count uint64) []byte {
 	cmd := make([]byte, headerSize+8)
-	binaryEnc.PutUint16(cmd, getIDTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.GetIDUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], count)
 	return cmd
 }
 
-func getCreateLogShardCmd(name string) []byte {
-	return getLogShardCmd(name, createLogShardTag)
-}
-
-func getLogShardCmd(name string, tag uint16) []byte {
-	cmd := make([]byte, headerSize+len(name))
-	binaryEnc.PutUint16(cmd, tag)
-	copy(cmd[headerSize:], []byte(name))
-	return cmd
-}
-
-func isCreateLogShardCmd(cmd []byte) (string, bool) {
-	return isLogShardCmd(cmd, createLogShardTag)
-}
-
 func isDNHeartbeatCmd(cmd []byte) bool {
-	return isHeartbeatCmd(cmd, dnHeartbeatTag)
+	return isHeartbeatCmd(cmd, pb.DNHeartbeatUpdate)
 }
 
 func isLogHeartbeatCmd(cmd []byte) bool {
-	return isHeartbeatCmd(cmd, logHeartbeatTag)
+	return isHeartbeatCmd(cmd, pb.LogHeartbeatUpdate)
 }
 
-func isHeartbeatCmd(cmd []byte, tag uint16) bool {
+func isHeartbeatCmd(cmd []byte, tag pb.HAKeeperUpdateType) bool {
 	if len(cmd) <= headerSize {
 		return false
 	}
@@ -163,22 +137,12 @@ func parseHeartbeatCmd(cmd []byte) []byte {
 	return cmd[headerSize:]
 }
 
-func isLogShardCmd(cmd []byte, tag uint16) (string, bool) {
-	if len(cmd) <= headerSize {
-		return "", false
-	}
-	if parseCmdTag(cmd) == tag {
-		return string(cmd[headerSize:]), true
-	}
-	return "", false
-}
-
 func isTickCmd(cmd []byte) bool {
-	return len(cmd) == headerSize && binaryEnc.Uint16(cmd) == tickTag
+	return len(cmd) == headerSize && parseCmdTag(cmd) == pb.TickUpdate
 }
 
 func isGetIDCmd(cmd []byte) bool {
-	return len(cmd) == headerSize+8 && binaryEnc.Uint16(cmd) == getIDTag
+	return len(cmd) == headerSize+8 && parseCmdTag(cmd) == pb.GetIDUpdate
 }
 
 func parseGetIDCmd(cmd []byte) uint64 {
@@ -186,7 +150,7 @@ func parseGetIDCmd(cmd []byte) uint64 {
 }
 
 func isSetStateCmd(cmd []byte) bool {
-	return len(cmd) == headerSize+4 && binaryEnc.Uint16(cmd) == setStateTag
+	return len(cmd) == headerSize+4 && parseCmdTag(cmd) == pb.SetStateUpdate
 }
 
 func parseSetStateCmd(cmd []byte) pb.HAKeeperState {
@@ -195,28 +159,28 @@ func parseSetStateCmd(cmd []byte) pb.HAKeeperState {
 
 func GetSetStateCmd(state pb.HAKeeperState) []byte {
 	cmd := make([]byte, headerSize+4)
-	binaryEnc.PutUint16(cmd, setStateTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.SetStateUpdate))
 	binaryEnc.PutUint32(cmd[headerSize:], uint32(state))
 	return cmd
 }
 
 func GetTickCmd() []byte {
 	cmd := make([]byte, headerSize)
-	binaryEnc.PutUint16(cmd, tickTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.TickUpdate))
 	return cmd
 }
 
 func GetLogStoreHeartbeatCmd(data []byte) []byte {
-	return getHeartbeatCmd(data, logHeartbeatTag)
+	return getHeartbeatCmd(data, pb.LogHeartbeatUpdate)
 }
 
 func GetDNStoreHeartbeatCmd(data []byte) []byte {
-	return getHeartbeatCmd(data, dnHeartbeatTag)
+	return getHeartbeatCmd(data, pb.DNHeartbeatUpdate)
 }
 
-func getHeartbeatCmd(data []byte, tag uint16) []byte {
+func getHeartbeatCmd(data []byte, tag pb.HAKeeperUpdateType) []byte {
 	cmd := make([]byte, headerSize+len(data))
-	binaryEnc.PutUint16(cmd, tag)
+	binaryEnc.PutUint32(cmd, uint32(tag))
 	copy(cmd[headerSize:], data)
 	return cmd
 }
@@ -278,20 +242,6 @@ func (s *stateMachine) handleUpdateCommandsCmd(cmd []byte) sm.Result {
 	return sm.Result{}
 }
 
-func (s *stateMachine) handleCreateLogShardCmd(cmd []byte) sm.Result {
-	name, ok := isCreateLogShardCmd(cmd)
-	if !ok {
-		panic(moerr.NewError(moerr.INVALID_INPUT, "not create log shard cmd"))
-	}
-	if shardID, ok := s.state.LogShards[name]; ok {
-		data := make([]byte, 8)
-		binaryEnc.PutUint64(data, shardID)
-		return sm.Result{Value: 0, Data: data}
-	}
-	s.state.LogShards[name] = s.assignID()
-	return sm.Result{Value: s.state.NextID}
-}
-
 func (s *stateMachine) handleDNHeartbeat(cmd []byte) sm.Result {
 	data := parseHeartbeatCmd(cmd)
 	var hb pb.DNStoreHeartbeat
@@ -399,9 +349,7 @@ func (s *stateMachine) Update(e sm.Entry) (sm.Result, error) {
 	// TODO: we need to make sure InitialClusterRequestCmd is the
 	// first user cmd added to the Raft log
 	cmd := e.Cmd
-	if _, ok := isCreateLogShardCmd(cmd); ok {
-		return s.handleCreateLogShardCmd(cmd), nil
-	} else if isDNHeartbeatCmd(cmd) {
+	if isDNHeartbeatCmd(cmd) {
 		return s.handleDNHeartbeat(cmd), nil
 	} else if isLogHeartbeatCmd(cmd) {
 		return s.handleLogHeartbeat(cmd), nil
diff --git a/pkg/logservice/client.go b/pkg/logservice/client.go
index 60a201eb9..9d6161b01 100644
--- a/pkg/logservice/client.go
+++ b/pkg/logservice/client.go
@@ -65,9 +65,9 @@ type Client interface {
 	Close() error
 	Config() ClientConfig
 	Append(ctx context.Context, rec pb.LogRecord) (Lsn, error)
-	Read(ctx context.Context, firstIndex Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error)
-	Truncate(ctx context.Context, index Lsn) error
-	GetTruncatedIndex(ctx context.Context) (Lsn, error)
+	Read(ctx context.Context, firstLsn Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error)
+	Truncate(ctx context.Context, lsn Lsn) error
+	GetTruncatedLsn(ctx context.Context) (Lsn, error)
 	GetTSOTimestamp(ctx context.Context, count uint64) (uint64, error)
 }
 
@@ -152,8 +152,8 @@ func (c *client) Append(ctx context.Context, rec pb.LogRecord) (Lsn, error) {
 // Lsn indicates the next Lsn to use to resume the read, or it means
 // everything available has been read when it equals to the specified Lsn.
 func (c *client) Read(ctx context.Context,
-	firstIndex Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error) {
-	return c.read(ctx, firstIndex, maxSize)
+	firstLsn Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error) {
+	return c.read(ctx, firstLsn, maxSize)
 }
 
 // Truncate truncates the Log Service log at the specified Lsn with Lsn
@@ -167,10 +167,10 @@ func (c *client) Truncate(ctx context.Context, lsn Lsn) error {
 	return c.truncate(ctx, lsn)
 }
 
-// GetTruncatedIndex returns the largest Lsn value that has been specified for
+// GetTruncatedLsn returns the largest Lsn value that has been specified for
 // truncation.
-func (c *client) GetTruncatedIndex(ctx context.Context) (Lsn, error) {
-	return c.getTruncatedIndex(ctx)
+func (c *client) GetTruncatedLsn(ctx context.Context) (Lsn, error) {
+	return c.getTruncatedLsn(ctx)
 }
 
 // GetTSOTimestamp requests a total of count unique timestamps from the TSO and
@@ -196,7 +196,7 @@ func (c *client) connectReadOnly(ctx context.Context) error {
 }
 
 func (c *client) request(ctx context.Context,
-	mt pb.MethodType, payload []byte, index Lsn,
+	mt pb.MethodType, payload []byte, lsn Lsn,
 	maxSize uint64) (pb.Response, []pb.LogRecord, error) {
 	timeout, err := getTimeoutFromContext(ctx)
 	if err != nil {
@@ -208,7 +208,7 @@ func (c *client) request(ctx context.Context,
 		LogRequest: pb.LogRequest{
 			ShardID: c.cfg.ShardID,
 			DNID:    c.cfg.ReplicaID,
-			Index:   index,
+			Lsn:     lsn,
 			MaxSize: maxSize,
 		},
 	}
@@ -289,16 +289,16 @@ func (c *client) append(ctx context.Context, rec pb.LogRecord) (Lsn, error) {
 	if err != nil {
 		return 0, err
 	}
-	return resp.LogResponse.Index, nil
+	return resp.LogResponse.Lsn, nil
 }
 
 func (c *client) read(ctx context.Context,
-	firstIndex Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error) {
-	resp, recs, err := c.request(ctx, pb.READ, nil, firstIndex, maxSize)
+	firstLsn Lsn, maxSize uint64) ([]pb.LogRecord, Lsn, error) {
+	resp, recs, err := c.request(ctx, pb.READ, nil, firstLsn, maxSize)
 	if err != nil {
 		return nil, 0, err
 	}
-	return recs, resp.LogResponse.LastIndex, nil
+	return recs, resp.LogResponse.LastLsn, nil
 }
 
 func (c *client) truncate(ctx context.Context, lsn Lsn) error {
@@ -306,12 +306,12 @@ func (c *client) truncate(ctx context.Context, lsn Lsn) error {
 	return err
 }
 
-func (c *client) getTruncatedIndex(ctx context.Context) (Lsn, error) {
+func (c *client) getTruncatedLsn(ctx context.Context) (Lsn, error) {
 	resp, _, err := c.request(ctx, pb.GET_TRUNCATE, nil, 0, 0)
 	if err != nil {
 		return 0, err
 	}
-	return resp.LogResponse.Index, nil
+	return resp.LogResponse.Lsn, nil
 }
 
 func getRPCClient(ctx context.Context, target string, pool *sync.Pool) (morpc.RPCClient, error) {
diff --git a/pkg/logservice/commands.go b/pkg/logservice/commands.go
index 31dda6bbd..c57e84b2c 100644
--- a/pkg/logservice/commands.go
+++ b/pkg/logservice/commands.go
@@ -66,12 +66,12 @@ func (s *Service) handleStartReplica(cmd pb.ScheduleCommand) {
 	shardID := cmd.ConfigChange.Replica.ShardID
 	replicaID := cmd.ConfigChange.Replica.ReplicaID
 	if shardID == hakeeper.DefaultHAKeeperShardID {
-		if err := s.store.StartHAKeeperReplica(replicaID,
+		if err := s.store.startHAKeeperReplica(replicaID,
 			cmd.ConfigChange.InitialMembers, false); err != nil {
 			plog.Errorf("failed to start HAKeeper replica %v", err)
 		}
 	} else {
-		if err := s.store.StartReplica(shardID,
+		if err := s.store.startReplica(shardID,
 			replicaID, cmd.ConfigChange.InitialMembers, false); err != nil {
 			plog.Errorf("failed to start log replica %v", err)
 		}
diff --git a/pkg/logservice/errors.go b/pkg/logservice/errors.go
index 3b2b5dfcc..31450fcaf 100644
--- a/pkg/logservice/errors.go
+++ b/pkg/logservice/errors.go
@@ -49,7 +49,7 @@ func getErrorToCodeMapping() []errorToCode {
 		{dragonboat.ErrClosed, pb.SystemClosed, true},
 		{dragonboat.ErrInvalidRange, pb.OutOfRange, true},
 
-		{ErrInvalidTruncateIndex, pb.IndexAlreadyTruncated, true},
+		{ErrInvalidTruncateLsn, pb.LsnAlreadyTruncated, true},
 		{ErrNotLeaseHolder, pb.NotLeaseHolder, true},
 	}
 }
diff --git a/pkg/logservice/rsm.go b/pkg/logservice/rsm.go
index c74f4d216..c4d865744 100644
--- a/pkg/logservice/rsm.go
+++ b/pkg/logservice/rsm.go
@@ -29,37 +29,29 @@ var (
 
 const (
 	firstLogShardID uint64 = 1
-	headerSize             = 2
-)
-
-const (
-	leaseHolderIDTag uint16 = iota + 0xBF01
-	truncatedIndexTag
-	userEntryTag
-	indexTag
-	tsoTag
+	headerSize             = 4
 )
 
 // used to indicate query types
 type leaseHolderIDQuery struct{}
 type indexQuery struct{}
-type truncatedIndexQuery struct{}
-type leaseHistoryQuery struct{ index uint64 }
+type truncatedLsnQuery struct{}
+type leaseHistoryQuery struct{ lsn uint64 }
 
 func getAppendCmd(cmd []byte, replicaID uint64) []byte {
 	if len(cmd) < headerSize+8 {
 		panic("cmd too small")
 	}
-	binaryEnc.PutUint16(cmd, userEntryTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], replicaID)
 	return cmd
 }
 
-func parseCmdTag(cmd []byte) uint16 {
-	return binaryEnc.Uint16(cmd)
+func parseCmdTag(cmd []byte) pb.UpdateType {
+	return pb.UpdateType(binaryEnc.Uint32(cmd))
 }
 
-func parseTruncatedIndex(cmd []byte) uint64 {
+func parseTruncatedLsn(cmd []byte) uint64 {
 	return binaryEnc.Uint64(cmd[headerSize:])
 }
 
@@ -73,21 +65,21 @@ func parseTsoUpdateCmd(cmd []byte) uint64 {
 
 func getSetLeaseHolderCmd(leaseHolderID uint64) []byte {
 	cmd := make([]byte, headerSize+8)
-	binaryEnc.PutUint16(cmd, leaseHolderIDTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.LeaseHolderIDUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], leaseHolderID)
 	return cmd
 }
 
-func getSetTruncatedIndexCmd(index uint64) []byte {
+func getSetTruncatedLsnCmd(lsn uint64) []byte {
 	cmd := make([]byte, headerSize+8)
-	binaryEnc.PutUint16(cmd, truncatedIndexTag)
-	binaryEnc.PutUint64(cmd[headerSize:], index)
+	binaryEnc.PutUint32(cmd, uint32(pb.TruncatedLSNUpdate))
+	binaryEnc.PutUint64(cmd[headerSize:], lsn)
 	return cmd
 }
 
 func getTsoUpdateCmd(count uint64) []byte {
 	cmd := make([]byte, headerSize+8)
-	binaryEnc.PutUint16(cmd, tsoTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.TSOUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], count)
 	return cmd
 }
@@ -96,25 +88,25 @@ func isTsoUpdate(cmd []byte) bool {
 	if len(cmd) != headerSize+8 {
 		return false
 	}
-	return parseCmdTag(cmd) == tsoTag
+	return parseCmdTag(cmd) == pb.TSOUpdate
 }
 
 func isSetLeaseHolderUpdate(cmd []byte) bool {
-	return tagMatch(cmd, leaseHolderIDTag)
+	return tagMatch(cmd, pb.LeaseHolderIDUpdate)
 }
 
-func isSetTruncatedIndexUpdate(cmd []byte) bool {
-	return tagMatch(cmd, truncatedIndexTag)
+func isSetTruncatedLsnUpdate(cmd []byte) bool {
+	return tagMatch(cmd, pb.TruncatedLSNUpdate)
 }
 
 func isUserUpdate(cmd []byte) bool {
 	if len(cmd) < headerSize+8 {
 		return false
 	}
-	return parseCmdTag(cmd) == userEntryTag
+	return parseCmdTag(cmd) == pb.UserEntryUpdate
 }
 
-func tagMatch(cmd []byte, expectedTag uint16) bool {
+func tagMatch(cmd []byte, expectedTag pb.UpdateType) bool {
 	if len(cmd) != headerSize+8 {
 		return false
 	}
@@ -141,20 +133,20 @@ func newStateMachine(shardID uint64, replicaID uint64) sm.IStateMachine {
 	}
 }
 
-func (s *stateMachine) truncateLeaseHistory(index uint64) {
-	_, index = s.getLeaseHistory(index)
+func (s *stateMachine) truncateLeaseHistory(lsn uint64) {
+	_, lsn = s.getLeaseHistory(lsn)
 	for key := range s.state.LeaseHistory {
-		if key < index {
+		if key < lsn {
 			delete(s.state.LeaseHistory, key)
 		}
 	}
 }
 
-func (s *stateMachine) getLeaseHistory(index uint64) (uint64, uint64) {
+func (s *stateMachine) getLeaseHistory(lsn uint64) (uint64, uint64) {
 	max := uint64(0)
 	lease := uint64(0)
 	for key, val := range s.state.LeaseHistory {
-		if key >= index {
+		if key >= lsn {
 			continue
 		}
 		if key > max {
@@ -171,14 +163,14 @@ func (s *stateMachine) handleSetLeaseHolderID(cmd []byte) sm.Result {
 	return sm.Result{}
 }
 
-func (s *stateMachine) handleTruncateIndex(cmd []byte) sm.Result {
-	index := parseTruncatedIndex(cmd)
-	if index > s.state.TruncatedIndex {
-		s.state.TruncatedIndex = index
-		s.truncateLeaseHistory(index)
+func (s *stateMachine) handleTruncateLsn(cmd []byte) sm.Result {
+	lsn := parseTruncatedLsn(cmd)
+	if lsn > s.state.TruncatedLsn {
+		s.state.TruncatedLsn = lsn
+		s.truncateLeaseHistory(lsn)
 		return sm.Result{}
 	}
-	return sm.Result{Value: s.state.TruncatedIndex}
+	return sm.Result{Value: s.state.TruncatedLsn}
 }
 
 // handleUserUpdate returns an empty sm.Result on success or it returns a
@@ -209,8 +201,8 @@ func (s *stateMachine) Update(e sm.Entry) (sm.Result, error) {
 	s.state.Index = e.Index
 	if isSetLeaseHolderUpdate(cmd) {
 		return s.handleSetLeaseHolderID(cmd), nil
-	} else if isSetTruncatedIndexUpdate(cmd) {
-		return s.handleTruncateIndex(cmd), nil
+	} else if isSetTruncatedLsnUpdate(cmd) {
+		return s.handleTruncateLsn(cmd), nil
 	} else if isUserUpdate(cmd) {
 		return s.handleUserUpdate(cmd), nil
 	} else if isTsoUpdate(cmd) {
@@ -224,10 +216,10 @@ func (s *stateMachine) Lookup(query interface{}) (interface{}, error) {
 		return s.state.Index, nil
 	} else if _, ok := query.(leaseHolderIDQuery); ok {
 		return s.state.LeaseHolderID, nil
-	} else if _, ok := query.(truncatedIndexQuery); ok {
-		return s.state.TruncatedIndex, nil
+	} else if _, ok := query.(truncatedLsnQuery); ok {
+		return s.state.TruncatedLsn, nil
 	} else if v, ok := query.(leaseHistoryQuery); ok {
-		lease, _ := s.getLeaseHistory(v.index)
+		lease, _ := s.getLeaseHistory(v.lsn)
 		return lease, nil
 	}
 	panic("unknown lookup command type")
diff --git a/pkg/logservice/service.go b/pkg/logservice/service.go
index 61736c421..a7c7d9d66 100644
--- a/pkg/logservice/service.go
+++ b/pkg/logservice/service.go
@@ -105,7 +105,7 @@ func NewService(cfg Config) (*Service, error) {
 	// replicas already known to the local store
 	if err := server.Start(); err != nil {
 		plog.Errorf("failed to start the server %v", err)
-		if err := store.Close(); err != nil {
+		if err := store.close(); err != nil {
 			plog.Errorf("failed to close the store, %v", err)
 		}
 		return nil, err
@@ -116,12 +116,12 @@ func NewService(cfg Config) (*Service, error) {
 
 func (s *Service) Close() (err error) {
 	err = firstError(err, s.server.Close())
-	err = firstError(err, s.store.Close())
+	err = firstError(err, s.store.close())
 	return err
 }
 
 func (s *Service) ID() string {
-	return s.store.ID()
+	return s.store.id()
 }
 
 func (s *Service) handleRPCRequest(req morpc.Message,
@@ -180,7 +180,7 @@ func (s *Service) handleTsoUpdate(req pb.Request) pb.Response {
 	defer cancel()
 	r := req.TsoRequest
 	resp := getResponse(req)
-	if v, err := s.store.TsoUpdate(ctx, r.Count); err != nil {
+	if v, err := s.store.tsoUpdate(ctx, r.Count); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	} else {
 		resp.TsoResponse.Value = v
@@ -193,7 +193,7 @@ func (s *Service) handleConnect(req pb.Request) pb.Response {
 	defer cancel()
 	r := req.LogRequest
 	resp := getResponse(req)
-	if err := s.store.GetOrExtendDNLease(ctx, r.ShardID, r.DNID); err != nil {
+	if err := s.store.getOrExtendDNLease(ctx, r.ShardID, r.DNID); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	}
 	return resp
@@ -205,7 +205,7 @@ func (s *Service) handleConnectRO(req pb.Request) pb.Response {
 	r := req.LogRequest
 	resp := getResponse(req)
 	// we only check whether the specified shard is available
-	if _, err := s.store.GetTruncatedIndex(ctx, r.ShardID); err != nil {
+	if _, err := s.store.getTruncatedLsn(ctx, r.ShardID); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	}
 	return resp
@@ -216,11 +216,11 @@ func (s *Service) handleAppend(req pb.Request, payload []byte) pb.Response {
 	defer cancel()
 	r := req.LogRequest
 	resp := getResponse(req)
-	lsn, err := s.store.Append(ctx, r.ShardID, payload)
+	lsn, err := s.store.append(ctx, r.ShardID, payload)
 	if err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	} else {
-		resp.LogResponse.Index = lsn
+		resp.LogResponse.Lsn = lsn
 	}
 	return resp
 }
@@ -230,11 +230,11 @@ func (s *Service) handleRead(req pb.Request) (pb.Response, pb.LogRecordResponse)
 	defer cancel()
 	r := req.LogRequest
 	resp := getResponse(req)
-	records, lsn, err := s.store.QueryLog(ctx, r.ShardID, r.Index, r.MaxSize)
+	records, lsn, err := s.store.queryLog(ctx, r.ShardID, r.Lsn, r.MaxSize)
 	if err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	} else {
-		resp.LogResponse.LastIndex = lsn
+		resp.LogResponse.LastLsn = lsn
 	}
 	return resp, pb.LogRecordResponse{Records: records}
 }
@@ -244,7 +244,7 @@ func (s *Service) handleTruncate(req pb.Request) pb.Response {
 	defer cancel()
 	r := req.LogRequest
 	resp := getResponse(req)
-	if err := s.store.TruncateLog(ctx, r.ShardID, r.Index); err != nil {
+	if err := s.store.truncateLog(ctx, r.ShardID, r.Lsn); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	}
 	return resp
@@ -255,11 +255,11 @@ func (s *Service) handleGetTruncatedIndex(req pb.Request) pb.Response {
 	defer cancel()
 	r := req.LogRequest
 	resp := getResponse(req)
-	index, err := s.store.GetTruncatedIndex(ctx, r.ShardID)
+	lsn, err := s.store.getTruncatedLsn(ctx, r.ShardID)
 	if err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 	} else {
-		resp.LogResponse.Index = index
+		resp.LogResponse.Lsn = lsn
 	}
 	return resp
 }
@@ -270,11 +270,11 @@ func (s *Service) handleLogHeartbeat(req pb.Request) pb.Response {
 	defer cancel()
 	hb := req.LogHeartbeat
 	resp := getResponse(req)
-	if err := s.store.AddLogStoreHeartbeat(ctx, hb); err != nil {
+	if err := s.store.addLogStoreHeartbeat(ctx, hb); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 		return resp
 	}
-	if cb, err := s.store.GetCommandBatch(ctx, hb.UUID); err != nil {
+	if cb, err := s.store.getCommandBatch(ctx, hb.UUID); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 		return resp
 	} else {
@@ -289,11 +289,11 @@ func (s *Service) handleDNHeartbeat(req pb.Request) pb.Response {
 	defer cancel()
 	hb := req.DNHeartbeat
 	resp := getResponse(req)
-	if err := s.store.AddDNStoreHeartbeat(ctx, hb); err != nil {
+	if err := s.store.addDNStoreHeartbeat(ctx, hb); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 		return resp
 	}
-	if cb, err := s.store.GetCommandBatch(ctx, hb.UUID); err != nil {
+	if cb, err := s.store.getCommandBatch(ctx, hb.UUID); err != nil {
 		resp.ErrorCode, resp.ErrorMessage = toErrorCode(err)
 		return resp
 	} else {
diff --git a/pkg/logservice/store.go b/pkg/logservice/store.go
index a5b739e9a..f0ee6ce39 100644
--- a/pkg/logservice/store.go
+++ b/pkg/logservice/store.go
@@ -34,9 +34,9 @@ import (
 )
 
 var (
-	ErrInvalidTruncateIndex = moerr.NewError(moerr.INVALID_INPUT, "invalid input")
-	ErrNotLeaseHolder       = moerr.NewError(moerr.INVALID_STATE, "not lease holder")
-	ErrInvalidShardID       = moerr.NewError(moerr.INVALID_INPUT, "invalid shard ID")
+	ErrInvalidTruncateLsn = moerr.NewError(moerr.INVALID_INPUT, "invalid input")
+	ErrNotLeaseHolder     = moerr.NewError(moerr.INVALID_STATE, "not lease holder")
+	ErrInvalidShardID     = moerr.NewError(moerr.INVALID_INPUT, "invalid shard ID")
 
 	ErrOutOfRange = dragonboat.ErrInvalidRange
 )
@@ -130,7 +130,7 @@ func newLogStore(cfg Config) (*store, error) {
 	return ls, nil
 }
 
-func (l *store) Close() error {
+func (l *store) close() error {
 	l.stopper.Stop()
 	if l.nh != nil {
 		l.nh.Close()
@@ -138,11 +138,11 @@ func (l *store) Close() error {
 	return nil
 }
 
-func (l *store) ID() string {
+func (l *store) id() string {
 	return l.nh.ID()
 }
 
-func (l *store) StartHAKeeperReplica(replicaID uint64,
+func (l *store) startHAKeeperReplica(replicaID uint64,
 	initialReplicas map[uint64]dragonboat.Target, join bool) error {
 	l.haKeeperReplicaID = replicaID
 	raftConfig := getRaftConfig(hakeeper.DefaultHAKeeperShardID, replicaID)
@@ -156,7 +156,7 @@ func (l *store) StartHAKeeperReplica(replicaID uint64,
 	return nil
 }
 
-func (l *store) StartReplica(shardID uint64, replicaID uint64,
+func (l *store) startReplica(shardID uint64, replicaID uint64,
 	initialReplicas map[uint64]dragonboat.Target, join bool) error {
 	if shardID == hakeeper.DefaultHAKeeperShardID {
 		return ErrInvalidShardID
@@ -263,7 +263,7 @@ func (l *store) read(ctx context.Context,
 	}
 }
 
-func (l *store) GetOrExtendDNLease(ctx context.Context,
+func (l *store) getOrExtendDNLease(ctx context.Context,
 	shardID uint64, dnID uint64) error {
 	session := l.nh.GetNoOPSession(shardID)
 	cmd := getSetLeaseHolderCmd(dnID)
@@ -271,10 +271,10 @@ func (l *store) GetOrExtendDNLease(ctx context.Context,
 	return err
 }
 
-func (l *store) TruncateLog(ctx context.Context,
+func (l *store) truncateLog(ctx context.Context,
 	shardID uint64, index Lsn) error {
 	session := l.nh.GetNoOPSession(shardID)
-	cmd := getSetTruncatedIndexCmd(index)
+	cmd := getSetTruncatedLsnCmd(index)
 	result, err := l.propose(ctx, session, cmd)
 	if err != nil {
 		plog.Errorf("propose truncate log cmd failed, %v", err)
@@ -282,7 +282,7 @@ func (l *store) TruncateLog(ctx context.Context,
 	}
 	if result.Value > 0 {
 		plog.Errorf("shardID %d already truncated to index %d", shardID, result.Value)
-		return errors.Wrapf(ErrInvalidTruncateIndex, "already truncated to %d", result.Value)
+		return errors.Wrapf(ErrInvalidTruncateLsn, "already truncated to %d", result.Value)
 	}
 	l.mu.Lock()
 	l.mu.pendingTruncate[shardID] = struct{}{}
@@ -291,7 +291,7 @@ func (l *store) TruncateLog(ctx context.Context,
 	return nil
 }
 
-func (l *store) Append(ctx context.Context,
+func (l *store) append(ctx context.Context,
 	shardID uint64, cmd []byte) (Lsn, error) {
 	if !isUserUpdate(cmd) {
 		panic(moerr.NewError(moerr.INVALID_INPUT, "not user update"))
@@ -313,16 +313,16 @@ func (l *store) Append(ctx context.Context,
 	return result.Value, nil
 }
 
-func (l *store) GetTruncatedIndex(ctx context.Context,
+func (l *store) getTruncatedLsn(ctx context.Context,
 	shardID uint64) (uint64, error) {
-	v, err := l.read(ctx, shardID, truncatedIndexQuery{})
+	v, err := l.read(ctx, shardID, truncatedLsnQuery{})
 	if err != nil {
 		return 0, err
 	}
 	return v.(uint64), nil
 }
 
-func (l *store) TsoUpdate(ctx context.Context, count uint64) (uint64, error) {
+func (l *store) tsoUpdate(ctx context.Context, count uint64) (uint64, error) {
 	cmd := getTsoUpdateCmd(count)
 	session := l.nh.GetNoOPSession(firstLogShardID)
 	result, err := l.propose(ctx, session, cmd)
@@ -333,7 +333,7 @@ func (l *store) TsoUpdate(ctx context.Context, count uint64) (uint64, error) {
 	return result.Value, nil
 }
 
-func (l *store) AddLogStoreHeartbeat(ctx context.Context,
+func (l *store) addLogStoreHeartbeat(ctx context.Context,
 	hb pb.LogStoreHeartbeat) error {
 	data := MustMarshal(&hb)
 	cmd := hakeeper.GetLogStoreHeartbeatCmd(data)
@@ -345,7 +345,7 @@ func (l *store) AddLogStoreHeartbeat(ctx context.Context,
 	return nil
 }
 
-func (l *store) AddDNStoreHeartbeat(ctx context.Context,
+func (l *store) addDNStoreHeartbeat(ctx context.Context,
 	hb pb.DNStoreHeartbeat) error {
 	data := MustMarshal(&hb)
 	cmd := hakeeper.GetDNStoreHeartbeatCmd(data)
@@ -357,7 +357,7 @@ func (l *store) AddDNStoreHeartbeat(ctx context.Context,
 	return nil
 }
 
-func (l *store) GetCommandBatch(ctx context.Context,
+func (l *store) getCommandBatch(ctx context.Context,
 	uuid string) (pb.CommandBatch, error) {
 	v, err := l.read(ctx,
 		hakeeper.DefaultHAKeeperShardID, &hakeeper.ScheduleCommandQuery{UUID: uuid})
@@ -388,7 +388,7 @@ func (l *store) getLeaseHolderID(ctx context.Context,
 	if isSetLeaseHolderUpdate(e.Cmd) {
 		return parseLeaseHolderID(e.Cmd), nil
 	}
-	v, err := l.read(ctx, shardID, leaseHistoryQuery{index: e.Index})
+	v, err := l.read(ctx, shardID, leaseHistoryQuery{lsn: e.Index})
 	if err != nil {
 		plog.Errorf("failed to read, %v", err)
 		return 0, err
@@ -430,8 +430,8 @@ func (l *store) markEntries(ctx context.Context,
 		if isRaftInternalEntry(e) {
 			// raft internal stuff
 			result = append(result, LogRecord{
-				Type:  pb.Internal,
-				Index: e.Index,
+				Type: pb.Internal,
+				Lsn:  e.Index,
 			})
 			continue
 		}
@@ -439,8 +439,8 @@ func (l *store) markEntries(ctx context.Context,
 		if isSetLeaseHolderUpdate(cmd) {
 			leaseHolderID = parseLeaseHolderID(cmd)
 			result = append(result, LogRecord{
-				Type:  pb.LeaseUpdate,
-				Index: e.Index,
+				Type: pb.LeaseUpdate,
+				Lsn:  e.Index,
 			})
 			continue
 		}
@@ -448,15 +448,15 @@ func (l *store) markEntries(ctx context.Context,
 			if parseLeaseHolderID(cmd) != leaseHolderID {
 				// lease not match, skip
 				result = append(result, LogRecord{
-					Type:  pb.LeaseUpdate,
-					Index: e.Index,
+					Type: pb.LeaseUpdate,
+					Lsn:  e.Index,
 				})
 				continue
 			}
 			result = append(result, LogRecord{
-				Data:  cmd,
-				Type:  pb.UserRecord,
-				Index: e.Index,
+				Data: cmd,
+				Type: pb.UserRecord,
+				Lsn:  e.Index,
 			})
 		}
 	}
@@ -474,7 +474,7 @@ func getNextIndex(entries []raftpb.Entry, firstIndex Lsn, lastIndex Lsn) Lsn {
 	return firstIndex
 }
 
-func (l *store) QueryLog(ctx context.Context, shardID uint64,
+func (l *store) queryLog(ctx context.Context, shardID uint64,
 	firstIndex Lsn, maxSize uint64) ([]LogRecord, Lsn, error) {
 	v, err := l.read(ctx, shardID, indexQuery{})
 	if err != nil {
@@ -532,7 +532,7 @@ func (l *store) truncationWorker(ctx context.Context) {
 		case <-ctx.Done():
 			return
 		case <-l.mu.truncateCh:
-			if err := l.truncateLog(ctx); err != nil {
+			if err := l.processTruncateLog(ctx); err != nil {
 				panic(err)
 			}
 		}
@@ -569,7 +569,7 @@ func (l *store) hakeeperTick() {
 }
 
 // TODO: add tests for this
-func (l *store) truncateLog(ctx context.Context) error {
+func (l *store) processTruncateLog(ctx context.Context) error {
 	l.mu.Lock()
 	pendings := l.mu.pendingTruncate
 	l.mu.pendingTruncate = make(map[uint64]struct{})
@@ -585,17 +585,17 @@ func (l *store) truncateLog(ctx context.Context) error {
 		if err := func() error {
 			ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
 			defer cancel()
-			index, err := l.GetTruncatedIndex(ctx, shardID)
+			lsn, err := l.getTruncatedLsn(ctx, shardID)
 			if err != nil {
 				plog.Errorf("GetTruncatedIndex failed, %v", err)
 				// FIXME: check error type, see whether it is a tmp one
 				return err
 			}
 			// the first 4 entries for a 3-replica raft group are tiny anyway
-			if index > 1 {
+			if lsn > 1 {
 				opts := dragonboat.SnapshotOption{
 					OverrideCompactionOverhead: true,
-					CompactionIndex:            index - 1,
+					CompactionIndex:            lsn - 1,
 				}
 				if _, err := l.nh.SyncRequestSnapshot(ctx, shardID, opts); err != nil {
 					plog.Errorf("SyncRequestSnapshot failed, %v", err)
diff --git a/pkg/pb/logservice/logservice.pb.go b/pkg/pb/logservice/logservice.pb.go
index 4d63101f6..ab1f421f9 100644
--- a/pkg/pb/logservice/logservice.pb.go
+++ b/pkg/pb/logservice/logservice.pb.go
@@ -25,6 +25,37 @@ var _ = math.Inf
 // proto package needs to be updated.
 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
 
+type UpdateType int32
+
+const (
+	LeaseHolderIDUpdate UpdateType = 0
+	TruncatedLSNUpdate  UpdateType = 1
+	UserEntryUpdate     UpdateType = 2
+	TSOUpdate           UpdateType = 3
+)
+
+var UpdateType_name = map[int32]string{
+	0: "LeaseHolderIDUpdate",
+	1: "TruncatedLSNUpdate",
+	2: "UserEntryUpdate",
+	3: "TSOUpdate",
+}
+
+var UpdateType_value = map[string]int32{
+	"LeaseHolderIDUpdate": 0,
+	"TruncatedLSNUpdate":  1,
+	"UserEntryUpdate":     2,
+	"TSOUpdate":           3,
+}
+
+func (x UpdateType) String() string {
+	return proto.EnumName(UpdateType_name, int32(x))
+}
+
+func (UpdateType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_fd1040c5381ab5a7, []int{0}
+}
+
 type MethodType int32
 
 const (
@@ -68,7 +99,7 @@ func (x MethodType) String() string {
 }
 
 func (MethodType) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{0}
+	return fileDescriptor_fd1040c5381ab5a7, []int{1}
 }
 
 type RecordType int32
@@ -99,26 +130,26 @@ func (x RecordType) String() string {
 }
 
 func (RecordType) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{1}
+	return fileDescriptor_fd1040c5381ab5a7, []int{2}
 }
 
 type ErrorCode int32
 
 const (
-	NoError               ErrorCode = 0
-	Timeout               ErrorCode = 1
-	Canceled              ErrorCode = 2
-	InvalidShard          ErrorCode = 3
-	InvalidTimeout        ErrorCode = 4
-	InvalidPayload        ErrorCode = 5
-	InvalidPayloadSize    ErrorCode = 6
-	Rejected              ErrorCode = 7
-	ShardNotReady         ErrorCode = 8
-	SystemClosed          ErrorCode = 9
-	IndexAlreadyTruncated ErrorCode = 100
-	OutOfRange            ErrorCode = 101
-	NotLeaseHolder        ErrorCode = 102
-	OtherSystemError      ErrorCode = 1000
+	NoError             ErrorCode = 0
+	Timeout             ErrorCode = 1
+	Canceled            ErrorCode = 2
+	InvalidShard        ErrorCode = 3
+	InvalidTimeout      ErrorCode = 4
+	InvalidPayload      ErrorCode = 5
+	InvalidPayloadSize  ErrorCode = 6
+	Rejected            ErrorCode = 7
+	ShardNotReady       ErrorCode = 8
+	SystemClosed        ErrorCode = 9
+	LsnAlreadyTruncated ErrorCode = 100
+	OutOfRange          ErrorCode = 101
+	NotLeaseHolder      ErrorCode = 102
+	OtherSystemError    ErrorCode = 1000
 )
 
 var ErrorCode_name = map[int32]string{
@@ -132,27 +163,27 @@ var ErrorCode_name = map[int32]string{
 	7:    "Rejected",
 	8:    "ShardNotReady",
 	9:    "SystemClosed",
-	100:  "IndexAlreadyTruncated",
+	100:  "LsnAlreadyTruncated",
 	101:  "OutOfRange",
 	102:  "NotLeaseHolder",
 	1000: "OtherSystemError",
 }
 
 var ErrorCode_value = map[string]int32{
-	"NoError":               0,
-	"Timeout":               1,
-	"Canceled":              2,
-	"InvalidShard":          3,
-	"InvalidTimeout":        4,
-	"InvalidPayload":        5,
-	"InvalidPayloadSize":    6,
-	"Rejected":              7,
-	"ShardNotReady":         8,
-	"SystemClosed":          9,
-	"IndexAlreadyTruncated": 100,
-	"OutOfRange":            101,
-	"NotLeaseHolder":        102,
-	"OtherSystemError":      1000,
+	"NoError":             0,
+	"Timeout":             1,
+	"Canceled":            2,
+	"InvalidShard":        3,
+	"InvalidTimeout":      4,
+	"InvalidPayload":      5,
+	"InvalidPayloadSize":  6,
+	"Rejected":            7,
+	"ShardNotReady":       8,
+	"SystemClosed":        9,
+	"LsnAlreadyTruncated": 100,
+	"OutOfRange":          101,
+	"NotLeaseHolder":      102,
+	"OtherSystemError":    1000,
 }
 
 func (x ErrorCode) String() string {
@@ -160,7 +191,47 @@ func (x ErrorCode) String() string {
 }
 
 func (ErrorCode) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{2}
+	return fileDescriptor_fd1040c5381ab5a7, []int{3}
+}
+
+type HAKeeperUpdateType int32
+
+const (
+	TickUpdate            HAKeeperUpdateType = 0
+	DNHeartbeatUpdate     HAKeeperUpdateType = 1
+	LogHeartbeatUpdate    HAKeeperUpdateType = 2
+	GetIDUpdate           HAKeeperUpdateType = 3
+	ScheduleCommandUpdate HAKeeperUpdateType = 4
+	SetStateUpdate        HAKeeperUpdateType = 5
+	InitialClusterUpdate  HAKeeperUpdateType = 6
+)
+
+var HAKeeperUpdateType_name = map[int32]string{
+	0: "TickUpdate",
+	1: "DNHeartbeatUpdate",
+	2: "LogHeartbeatUpdate",
+	3: "GetIDUpdate",
+	4: "ScheduleCommandUpdate",
+	5: "SetStateUpdate",
+	6: "InitialClusterUpdate",
+}
+
+var HAKeeperUpdateType_value = map[string]int32{
+	"TickUpdate":            0,
+	"DNHeartbeatUpdate":     1,
+	"LogHeartbeatUpdate":    2,
+	"GetIDUpdate":           3,
+	"ScheduleCommandUpdate": 4,
+	"SetStateUpdate":        5,
+	"InitialClusterUpdate":  6,
+}
+
+func (x HAKeeperUpdateType) String() string {
+	return proto.EnumName(HAKeeperUpdateType_name, int32(x))
+}
+
+func (HAKeeperUpdateType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_fd1040c5381ab5a7, []int{4}
 }
 
 type HAKeeperState int32
@@ -194,7 +265,7 @@ func (x HAKeeperState) String() string {
 }
 
 func (HAKeeperState) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{3}
+	return fileDescriptor_fd1040c5381ab5a7, []int{5}
 }
 
 // ConfigChangeType indicates config change command type.
@@ -226,7 +297,7 @@ func (x ConfigChangeType) String() string {
 }
 
 func (ConfigChangeType) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{4}
+	return fileDescriptor_fd1040c5381ab5a7, []int{6}
 }
 
 // ServiceType specifies type of service
@@ -252,7 +323,7 @@ func (x ServiceType) String() string {
 }
 
 func (ServiceType) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_fd1040c5381ab5a7, []int{5}
+	return fileDescriptor_fd1040c5381ab5a7, []int{7}
 }
 
 // LogShardInfo contains information a log shard.
@@ -602,7 +673,7 @@ type RSMState struct {
 	Tso                  uint64            `protobuf:"varint,1,opt,name=Tso,proto3" json:"Tso,omitempty"`
 	Index                uint64            `protobuf:"varint,2,opt,name=Index,proto3" json:"Index,omitempty"`
 	LeaseHolderID        uint64            `protobuf:"varint,3,opt,name=LeaseHolderID,proto3" json:"LeaseHolderID,omitempty"`
-	TruncatedIndex       uint64            `protobuf:"varint,4,opt,name=TruncatedIndex,proto3" json:"TruncatedIndex,omitempty"`
+	TruncatedLsn         uint64            `protobuf:"varint,4,opt,name=TruncatedLsn,proto3" json:"TruncatedLsn,omitempty"`
 	LeaseHistory         map[uint64]uint64 `protobuf:"bytes,5,rep,name=LeaseHistory,proto3" json:"LeaseHistory,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
 	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
 	XXX_unrecognized     []byte            `json:"-"`
@@ -663,9 +734,9 @@ func (m *RSMState) GetLeaseHolderID() uint64 {
 	return 0
 }
 
-func (m *RSMState) GetTruncatedIndex() uint64 {
+func (m *RSMState) GetTruncatedLsn() uint64 {
 	if m != nil {
-		return m.TruncatedIndex
+		return m.TruncatedLsn
 	}
 	return 0
 }
@@ -679,7 +750,7 @@ func (m *RSMState) GetLeaseHistory() map[uint64]uint64 {
 
 // LogRecord is what we store into the LogService.
 type LogRecord struct {
-	Index                uint64     `protobuf:"varint,1,opt,name=Index,proto3" json:"Index,omitempty"`
+	Lsn                  uint64     `protobuf:"varint,1,opt,name=Lsn,proto3" json:"Lsn,omitempty"`
 	Type                 RecordType `protobuf:"varint,2,opt,name=Type,proto3,enum=logservice.RecordType" json:"Type,omitempty"`
 	Data                 []byte     `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
@@ -720,9 +791,9 @@ func (m *LogRecord) XXX_DiscardUnknown() {
 
 var xxx_messageInfo_LogRecord proto.InternalMessageInfo
 
-func (m *LogRecord) GetIndex() uint64 {
+func (m *LogRecord) GetLsn() uint64 {
 	if m != nil {
-		return m.Index
+		return m.Lsn
 	}
 	return 0
 }
@@ -744,7 +815,7 @@ func (m *LogRecord) GetData() []byte {
 type LogRequest struct {
 	Name                 string   `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
 	ShardID              uint64   `protobuf:"varint,2,opt,name=ShardID,proto3" json:"ShardID,omitempty"`
-	Index                uint64   `protobuf:"varint,3,opt,name=Index,proto3" json:"Index,omitempty"`
+	Lsn                  uint64   `protobuf:"varint,3,opt,name=Lsn,proto3" json:"Lsn,omitempty"`
 	MaxSize              uint64   `protobuf:"varint,4,opt,name=MaxSize,proto3" json:"MaxSize,omitempty"`
 	DNShardID            uint64   `protobuf:"varint,5,opt,name=DNShardID,proto3" json:"DNShardID,omitempty"`
 	DNID                 uint64   `protobuf:"varint,6,opt,name=DNID,proto3" json:"DNID,omitempty"`
@@ -800,9 +871,9 @@ func (m *LogRequest) GetShardID() uint64 {
 	return 0
 }
 
-func (m *LogRequest) GetIndex() uint64 {
+func (m *LogRequest) GetLsn() uint64 {
 	if m != nil {
-		return m.Index
+		return m.Lsn
 	}
 	return 0
 }
@@ -972,8 +1043,8 @@ func (m *Request) GetTsoRequest() TsoRequest {
 
 type LogResponse struct {
 	ShardID              uint64   `protobuf:"varint,1,opt,name=ShardID,proto3" json:"ShardID,omitempty"`
-	Index                uint64   `protobuf:"varint,2,opt,name=Index,proto3" json:"Index,omitempty"`
-	LastIndex            uint64   `protobuf:"varint,3,opt,name=LastIndex,proto3" json:"LastIndex,omitempty"`
+	Lsn                  uint64   `protobuf:"varint,2,opt,name=Lsn,proto3" json:"Lsn,omitempty"`
+	LastLsn              uint64   `protobuf:"varint,3,opt,name=LastLsn,proto3" json:"LastLsn,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
@@ -1019,16 +1090,16 @@ func (m *LogResponse) GetShardID() uint64 {
 	return 0
 }
 
-func (m *LogResponse) GetIndex() uint64 {
+func (m *LogResponse) GetLsn() uint64 {
 	if m != nil {
-		return m.Index
+		return m.Lsn
 	}
 	return 0
 }
 
-func (m *LogResponse) GetLastIndex() uint64 {
+func (m *LogResponse) GetLastLsn() uint64 {
 	if m != nil {
-		return m.LastIndex
+		return m.LastLsn
 	}
 	return 0
 }
@@ -2107,9 +2178,11 @@ func (m *HAKeeperRSMState) GetClusterInfo() ClusterInfo {
 }
 
 func init() {
+	proto.RegisterEnum("logservice.UpdateType", UpdateType_name, UpdateType_value)
 	proto.RegisterEnum("logservice.MethodType", MethodType_name, MethodType_value)
 	proto.RegisterEnum("logservice.RecordType", RecordType_name, RecordType_value)
 	proto.RegisterEnum("logservice.ErrorCode", ErrorCode_name, ErrorCode_value)
+	proto.RegisterEnum("logservice.HAKeeperUpdateType", HAKeeperUpdateType_name, HAKeeperUpdateType_value)
 	proto.RegisterEnum("logservice.HAKeeperState", HAKeeperState_name, HAKeeperState_value)
 	proto.RegisterEnum("logservice.ConfigChangeType", ConfigChangeType_name, ConfigChangeType_value)
 	proto.RegisterEnum("logservice.ServiceType", ServiceType_name, ServiceType_value)
@@ -2153,133 +2226,139 @@ func init() {
 func init() { proto.RegisterFile("logservice.proto", fileDescriptor_fd1040c5381ab5a7) }
 
 var fileDescriptor_fd1040c5381ab5a7 = []byte{
-	// 2013 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x6f, 0x23, 0x49,
-	0x15, 0x4f, 0xdb, 0x8e, 0x3f, 0x9e, 0x93, 0x4c, 0x4f, 0xcd, 0x64, 0xc6, 0x9b, 0x1d, 0x66, 0x42,
-	0xb3, 0x8c, 0x86, 0xb0, 0x9b, 0x48, 0x89, 0x16, 0xb1, 0x90, 0xdd, 0x91, 0x63, 0x7b, 0x67, 0xb2,
-	0x24, 0xce, 0xa8, 0xed, 0xa0, 0x15, 0x68, 0x35, 0xea, 0xb8, 0x2b, 0x76, 0x13,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 0x49, 0x06, 0xe6, 0x99, 0x39,
+	0x21, 0x93, 0x14, 0x8c, 0x5e, 0x97, 0x05, 0x13, 0x49, 0xc8, 0x56, 0xdf, 0xd7, 0x9e, 0x20, 0x5c,
+	0x29, 0x6f, 0x25, 0x31, 0xc5, 0x5c, 0xe2, 0x85, 0xdc, 0xf4, 0xe5, 0xd2, 0x38, 0x68, 0xbd, 0xfc,
+	0xfb, 0xfd, 0xa5, 0xaf, 0x5e, 0xdd, 0x37, 0x5e, 0xbe, 0xba, 0x6f, 0xfc, 0xed, 0xd5, 0x7d, 0xe3,
+	0x67, 0x7b, 0xca, 0x7f, 0x02, 0x63, 0x87, 0x85, 0xde, 0x8b, 0x20, 0xf4, 0x06, 0x9e, 0x2f, 0x17,
+	0x3e, 0xdd, 0x99, 0x5c, 0x0c, 0x76, 0x26, 0x67, 0x3b, 0x69, 0x23, 0x3b, 0xcb, 0xe3, 0x1f, 0x02,
+	0x7b, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x35, 0x0a, 0x83, 0x6f, 0x18, 0x00, 0x00,
 }
 
 func (m *LogShardInfo) Marshal() (dAtA []byte, err error) {
@@ -2581,8 +2660,8 @@ func (m *RSMState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 			dAtA[i] = 0x2a
 		}
 	}
-	if m.TruncatedIndex != 0 {
-		i = encodeVarintLogservice(dAtA, i, uint64(m.TruncatedIndex))
+	if m.TruncatedLsn != 0 {
+		i = encodeVarintLogservice(dAtA, i, uint64(m.TruncatedLsn))
 		i--
 		dAtA[i] = 0x20
 	}
@@ -2640,8 +2719,8 @@ func (m *LogRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 		i--
 		dAtA[i] = 0x10
 	}
-	if m.Index != 0 {
-		i = encodeVarintLogservice(dAtA, i, uint64(m.Index))
+	if m.Lsn != 0 {
+		i = encodeVarintLogservice(dAtA, i, uint64(m.Lsn))
 		i--
 		dAtA[i] = 0x8
 	}
@@ -2687,8 +2766,8 @@ func (m *LogRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 		i--
 		dAtA[i] = 0x20
 	}
-	if m.Index != 0 {
-		i = encodeVarintLogservice(dAtA, i, uint64(m.Index))
+	if m.Lsn != 0 {
+		i = encodeVarintLogservice(dAtA, i, uint64(m.Lsn))
 		i--
 		dAtA[i] = 0x18
 	}
@@ -2845,13 +2924,13 @@ func (m *LogResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 		i -= len(m.XXX_unrecognized)
 		copy(dAtA[i:], m.XXX_unrecognized)
 	}
-	if m.LastIndex != 0 {
-		i = encodeVarintLogservice(dAtA, i, uint64(m.LastIndex))
+	if m.LastLsn != 0 {
+		i = encodeVarintLogservice(dAtA, i, uint64(m.LastLsn))
 		i--
 		dAtA[i] = 0x18
 	}
-	if m.Index != 0 {
-		i = encodeVarintLogservice(dAtA, i, uint64(m.Index))
+	if m.Lsn != 0 {
+		i = encodeVarintLogservice(dAtA, i, uint64(m.Lsn))
 		i--
 		dAtA[i] = 0x10
 	}
@@ -3944,8 +4023,8 @@ func (m *RSMState) Size() (n int) {
 	if m.LeaseHolderID != 0 {
 		n += 1 + sovLogservice(uint64(m.LeaseHolderID))
 	}
-	if m.TruncatedIndex != 0 {
-		n += 1 + sovLogservice(uint64(m.TruncatedIndex))
+	if m.TruncatedLsn != 0 {
+		n += 1 + sovLogservice(uint64(m.TruncatedLsn))
 	}
 	if len(m.LeaseHistory) > 0 {
 		for k, v := range m.LeaseHistory {
@@ -3967,8 +4046,8 @@ func (m *LogRecord) Size() (n int) {
 	}
 	var l int
 	_ = l
-	if m.Index != 0 {
-		n += 1 + sovLogservice(uint64(m.Index))
+	if m.Lsn != 0 {
+		n += 1 + sovLogservice(uint64(m.Lsn))
 	}
 	if m.Type != 0 {
 		n += 1 + sovLogservice(uint64(m.Type))
@@ -3996,8 +4075,8 @@ func (m *LogRequest) Size() (n int) {
 	if m.ShardID != 0 {
 		n += 1 + sovLogservice(uint64(m.ShardID))
 	}
-	if m.Index != 0 {
-		n += 1 + sovLogservice(uint64(m.Index))
+	if m.Lsn != 0 {
+		n += 1 + sovLogservice(uint64(m.Lsn))
 	}
 	if m.MaxSize != 0 {
 		n += 1 + sovLogservice(uint64(m.MaxSize))
@@ -4067,11 +4146,11 @@ func (m *LogResponse) Size() (n int) {
 	if m.ShardID != 0 {
 		n += 1 + sovLogservice(uint64(m.ShardID))
 	}
-	if m.Index != 0 {
-		n += 1 + sovLogservice(uint64(m.Index))
+	if m.Lsn != 0 {
+		n += 1 + sovLogservice(uint64(m.Lsn))
 	}
-	if m.LastIndex != 0 {
-		n += 1 + sovLogservice(uint64(m.LastIndex))
+	if m.LastLsn != 0 {
+		n += 1 + sovLogservice(uint64(m.LastLsn))
 	}
 	if m.XXX_unrecognized != nil {
 		n += len(m.XXX_unrecognized)
@@ -5337,9 +5416,9 @@ func (m *RSMState) Unmarshal(dAtA []byte) error {
 			}
 		case 4:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field TruncatedIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field TruncatedLsn", wireType)
 			}
-			m.TruncatedIndex = 0
+			m.TruncatedLsn = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowLogservice
@@ -5349,7 +5428,7 @@ func (m *RSMState) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.TruncatedIndex |= uint64(b&0x7F) << shift
+				m.TruncatedLsn |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
@@ -5506,9 +5585,9 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error {
 		switch fieldNum {
 		case 1:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field Lsn", wireType)
 			}
-			m.Index = 0
+			m.Lsn = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowLogservice
@@ -5518,7 +5597,7 @@ func (m *LogRecord) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.Index |= uint64(b&0x7F) << shift
+				m.Lsn |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
@@ -5680,9 +5759,9 @@ func (m *LogRequest) Unmarshal(dAtA []byte) error {
 			}
 		case 3:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field Lsn", wireType)
 			}
-			m.Index = 0
+			m.Lsn = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowLogservice
@@ -5692,7 +5771,7 @@ func (m *LogRequest) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.Index |= uint64(b&0x7F) << shift
+				m.Lsn |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
@@ -6136,9 +6215,9 @@ func (m *LogResponse) Unmarshal(dAtA []byte) error {
 			}
 		case 2:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field Lsn", wireType)
 			}
-			m.Index = 0
+			m.Lsn = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowLogservice
@@ -6148,16 +6227,16 @@ func (m *LogResponse) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.Index |= uint64(b&0x7F) << shift
+				m.Lsn |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
 			}
 		case 3:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field LastIndex", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field LastLsn", wireType)
 			}
-			m.LastIndex = 0
+			m.LastLsn = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowLogservice
@@ -6167,7 +6246,7 @@ func (m *LogResponse) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.LastIndex |= uint64(b&0x7F) << shift
+				m.LastLsn |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
diff --git a/proto/logservice.proto b/proto/logservice.proto
index af003709e..341573b9a 100644
--- a/proto/logservice.proto
+++ b/proto/logservice.proto
@@ -20,6 +20,13 @@ import "metadata.proto";
 
 option (gogoproto.goproto_enum_prefix_all) = false;
 
+enum UpdateType {
+  LeaseHolderIDUpdate = 0;
+  TruncatedLSNUpdate  = 1;
+  UserEntryUpdate     = 2;
+  TSOUpdate           = 3;
+}
+
 // LogShardInfo contains information a log shard.
 message LogShardInfo {
   // ShardID is the ID of a Log shard.
@@ -88,8 +95,8 @@ message RSMState {
   uint64 Tso = 1;
   uint64 Index = 2;
   uint64 LeaseHolderID = 3;
-  uint64 TruncatedIndex = 4;
-  map<uint64, uint64> LeaseHistory = 5; // log index -> truncate index
+  uint64 TruncatedLsn = 4;
+  map<uint64, uint64> LeaseHistory = 5; // log lsn -> truncate lsn
 }
 
 enum MethodType {
@@ -113,7 +120,7 @@ enum RecordType {
 
 // LogRecord is what we store into the LogService.
 message LogRecord {
-  uint64 Index    = 1;
+  uint64 Lsn    = 1;
   RecordType Type = 2;
   bytes Data      = 3;
 };
@@ -121,7 +128,7 @@ message LogRecord {
 message LogRequest {
   string Name         = 1;
   uint64 ShardID      = 2;
-  uint64 Index        = 3;
+  uint64 Lsn          = 3;
   uint64 MaxSize      = 4;
   uint64 DNShardID    = 5;
   uint64 DNID         = 6;
@@ -153,7 +160,7 @@ enum ErrorCode {
   ShardNotReady         = 8;
   SystemClosed          = 9;
 
-  IndexAlreadyTruncated = 100;
+  LsnAlreadyTruncated = 100;
   OutOfRange            = 101;
   NotLeaseHolder        = 102;
 
@@ -162,8 +169,8 @@ enum ErrorCode {
 
 message LogResponse {
   uint64 ShardID      = 1;
-  uint64 Index        = 2;
-  uint64 LastIndex    = 3;
+  uint64 Lsn          = 2;
+  uint64 LastLsn      = 3;
 }
 
 message Response {
@@ -188,6 +195,16 @@ message TsoResponse {
 // HAKeeper related pb
 //
 
+enum HAKeeperUpdateType {
+  TickUpdate            = 0;
+  DNHeartbeatUpdate     = 1;
+  LogHeartbeatUpdate    = 2;
+  GetIDUpdate           = 3;
+  ScheduleCommandUpdate = 4;
+  SetStateUpdate        = 5;
+  InitialClusterUpdate  = 6;
+}
+
 enum HAKeeperState {
   HAKeeperCreated                    = 0;
   HAKeeperBootstrapping              = 1;


Test patch:
diff --git a/pkg/hakeeper/rsm_test.go b/pkg/hakeeper/rsm_test.go
index 3c6581ef9..e04814b26 100644
--- a/pkg/hakeeper/rsm_test.go
+++ b/pkg/hakeeper/rsm_test.go
@@ -33,13 +33,6 @@ func TestAssignID(t *testing.T) {
 	assert.Equal(t, uint64(1), tsm.state.NextID)
 }
 
-func TestCreateLogShardCmd(t *testing.T) {
-	cmd := getCreateLogShardCmd("test")
-	name, ok := isCreateLogShardCmd(cmd)
-	assert.True(t, ok)
-	assert.Equal(t, "test", name)
-}
-
 func TestHAKeeperStateMachineCanBeCreated(t *testing.T) {
 	defer func() {
 		if r := recover(); r == nil {
@@ -66,47 +59,6 @@ func TestHAKeeperStateMachineSnapshot(t *testing.T) {
 	assert.True(t, tsm1.replicaID != tsm2.replicaID)
 }
 
-func TestHAKeeperLogShardCanBeCreated(t *testing.T) {
-	cmd := getCreateLogShardCmd("test1")
-	tsm1 := NewStateMachine(0, 1).(*stateMachine)
-	tsm1.state.NextID = 100
-
-	result, err := tsm1.Update(sm.Entry{Cmd: cmd})
-	assert.Nil(t, err)
-	assert.Equal(t, sm.Result{Value: 101}, result)
-	assert.Equal(t, uint64(101), tsm1.state.NextID)
-
-	tsm1.state.NextID = 200
-	result, err = tsm1.Update(sm.Entry{Cmd: cmd})
-	assert.Nil(t, err)
-	data := make([]byte, 8)
-	binaryEnc.PutUint64(data, 101)
-	assert.Equal(t, sm.Result{Data: data}, result)
-}
-
-func TestHAKeeperQueryLogShardID(t *testing.T) {
-	cmd := getCreateLogShardCmd("test1")
-	tsm1 := NewStateMachine(0, 1).(*stateMachine)
-	tsm1.state.NextID = 100
-	result, err := tsm1.Update(sm.Entry{Cmd: cmd})
-	assert.Nil(t, err)
-	assert.Equal(t, sm.Result{Value: 101}, result)
-
-	q1 := &logShardIDQuery{name: "test1"}
-	r, err := tsm1.Lookup(q1)
-	assert.NoError(t, err)
-	r1, ok := r.(*logShardIDQueryResult)
-	assert.True(t, ok)
-	assert.Equal(t, uint64(101), r1.id)
-
-	q2 := &logShardIDQuery{name: "test2"}
-	r, err = tsm1.Lookup(q2)
-	assert.NoError(t, err)
-	r2, ok := r.(*logShardIDQueryResult)
-	assert.True(t, ok)
-	assert.Equal(t, uint64(0), r2.id)
-}
-
 func TestHAKeeperCanBeClosed(t *testing.T) {
 	tsm1 := NewStateMachine(0, 1).(*stateMachine)
 	assert.Nil(t, tsm1.Close())
diff --git a/pkg/logservice/client_test.go b/pkg/logservice/client_test.go
index 4e606b86f..0b7fe237a 100644
--- a/pkg/logservice/client_test.go
+++ b/pkg/logservice/client_test.go
@@ -42,7 +42,7 @@ func runClientTest(t *testing.T,
 
 	init := make(map[uint64]string)
 	init[2] = service.ID()
-	assert.NoError(t, service.store.StartReplica(1, 2, init, false))
+	assert.NoError(t, service.store.startReplica(1, 2, init, false))
 
 	scfg := ClientConfig{
 		ReadOnly:         readOnly,
@@ -170,11 +170,11 @@ func TestClientTruncate(t *testing.T) {
 		assert.Equal(t, uint64(4), lsn)
 
 		require.NoError(t, c.Truncate(ctx, 4))
-		lsn, err = c.GetTruncatedIndex(ctx)
+		lsn, err = c.GetTruncatedLsn(ctx)
 		assert.NoError(t, err)
 		assert.Equal(t, Lsn(4), lsn)
 
-		assert.Equal(t, ErrInvalidTruncateIndex, c.Truncate(ctx, 3))
+		assert.Equal(t, ErrInvalidTruncateLsn, c.Truncate(ctx, 3))
 	}
 	runClientTest(t, false, fn)
 }
diff --git a/pkg/logservice/commands_test.go b/pkg/logservice/commands_test.go
index 16467483d..c6cd2579d 100644
--- a/pkg/logservice/commands_test.go
+++ b/pkg/logservice/commands_test.go
@@ -76,8 +76,8 @@ func TestHandleAddReplica(t *testing.T) {
 	store1, store2, err := getTestStores()
 	require.NoError(t, err)
 	defer func() {
-		require.NoError(t, store1.Close())
-		require.NoError(t, store2.Close())
+		require.NoError(t, store1.close())
+		require.NoError(t, store2.close())
 	}()
 
 	service1 := Service{
@@ -104,8 +104,8 @@ func TestHandleRemoveReplica(t *testing.T) {
 	store1, store2, err := getTestStores()
 	require.NoError(t, err)
 	defer func() {
-		require.NoError(t, store1.Close())
-		require.NoError(t, store2.Close())
+		require.NoError(t, store1.close())
+		require.NoError(t, store2.close())
 	}()
 
 	service1 := Service{
diff --git a/pkg/logservice/errors_test.go b/pkg/logservice/errors_test.go
index 7a9351b87..73ef72fce 100644
--- a/pkg/logservice/errors_test.go
+++ b/pkg/logservice/errors_test.go
@@ -69,7 +69,7 @@ func TestIsTempError(t *testing.T) {
 
 		{ErrDeadlineNotSet, false},
 		{ErrInvalidDeadline, false},
-		{ErrInvalidTruncateIndex, false},
+		{ErrInvalidTruncateLsn, false},
 		{ErrNotLeaseHolder, false},
 		{ErrOutOfRange, false},
 		{ErrInvalidShardID, false},
diff --git a/pkg/logservice/hachecker_test.go b/pkg/logservice/hachecker_test.go
index 556fab5a4..33a690945 100644
--- a/pkg/logservice/hachecker_test.go
+++ b/pkg/logservice/hachecker_test.go
@@ -107,11 +107,11 @@ func runHAKeeperStoreTest(t *testing.T, fn func(*testing.T, *store)) {
 	store, err := getTestStore(cfg)
 	assert.NoError(t, err)
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 	peers := make(map[uint64]dragonboat.Target)
-	peers[1] = store.ID()
-	assert.NoError(t, store.StartHAKeeperReplica(1, peers, false))
+	peers[1] = store.id()
+	assert.NoError(t, store.startHAKeeperReplica(1, peers, false))
 	fn(t, store)
 }
 
@@ -159,14 +159,14 @@ func testBootstrap(t *testing.T, fail bool) {
 		m := store.getHeartbeatMessage()
 		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 		defer cancel()
-		assert.NoError(t, store.AddLogStoreHeartbeat(ctx, m))
+		assert.NoError(t, store.addLogStoreHeartbeat(ctx, m))
 
 		dnMsg := pb.DNStoreHeartbeat{
-			UUID:   store.ID(),
+			UUID:   store.id(),
 			Shards: make([]pb.DNShardInfo, 0),
 		}
 		dnMsg.Shards = append(dnMsg.Shards, pb.DNShardInfo{ShardID: 2, ReplicaID: 3})
-		assert.NoError(t, store.AddDNStoreHeartbeat(ctx, dnMsg))
+		assert.NoError(t, store.addDNStoreHeartbeat(ctx, dnMsg))
 
 		_, term, err := store.isLeaderHAKeeper()
 		require.NoError(t, err)
@@ -193,14 +193,14 @@ func testBootstrap(t *testing.T, fail bool) {
 			assert.Equal(t, pb.HAKeeperBootstrapFailed, state.State)
 		} else {
 			// FIXME: waiting for the bootstrap code to be fixed
-			cb, err := store.GetCommandBatch(ctx, store.ID())
+			cb, err := store.getCommandBatch(ctx, store.id())
 			require.NoError(t, err)
 			require.Equal(t, 1, len(cb.Commands))
 			service := &Service{store: store}
 			service.handleStartReplica(cb.Commands[0])
 
 			m := store.getHeartbeatMessage()
-			assert.NoError(t, store.AddLogStoreHeartbeat(ctx, m))
+			assert.NoError(t, store.addLogStoreHeartbeat(ctx, m))
 
 			state, err = store.getCheckerState()
 			require.NoError(t, err)
diff --git a/pkg/logservice/rsm_test.go b/pkg/logservice/rsm_test.go
index 5cb6102d8..8a1764005 100644
--- a/pkg/logservice/rsm_test.go
+++ b/pkg/logservice/rsm_test.go
@@ -20,6 +20,8 @@ import (
 
 	sm "github.com/lni/dragonboat/v4/statemachine"
 	"github.com/stretchr/testify/assert"
+
+	pb "github.com/matrixorigin/matrixone/pkg/pb/logservice"
 )
 
 func TestGetLeaseHistory(t *testing.T) {
@@ -81,23 +83,23 @@ func TestTruncateLeaseHistory(t *testing.T) {
 func TestGetSetLeaseHolderCmd(t *testing.T) {
 	cmd := getSetLeaseHolderCmd(100)
 	assert.True(t, isSetLeaseHolderUpdate(cmd))
-	cmd2 := getSetTruncatedIndexCmd(200)
+	cmd2 := getSetTruncatedLsnCmd(200)
 	assert.False(t, isSetLeaseHolderUpdate(cmd2))
 }
 
 func TestGetSetTruncatedIndexCmd(t *testing.T) {
-	cmd := getSetTruncatedIndexCmd(1234)
-	assert.True(t, isSetTruncatedIndexUpdate(cmd))
+	cmd := getSetTruncatedLsnCmd(1234)
+	assert.True(t, isSetTruncatedLsnUpdate(cmd))
 	cmd2 := getSetLeaseHolderCmd(1234)
-	assert.False(t, isSetTruncatedIndexUpdate(cmd2))
+	assert.False(t, isSetTruncatedLsnUpdate(cmd2))
 }
 
 func TestIsUserUpdate(t *testing.T) {
 	cmd := make([]byte, headerSize+8+1)
-	binaryEnc.PutUint16(cmd, userEntryTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 	assert.True(t, isUserUpdate(cmd))
 	cmd2 := getSetLeaseHolderCmd(1234)
-	cmd3 := getSetTruncatedIndexCmd(200)
+	cmd3 := getSetTruncatedLsnCmd(200)
 	assert.False(t, isUserUpdate(cmd2))
 	assert.False(t, isUserUpdate(cmd3))
 }
@@ -138,7 +140,7 @@ func TestDNLeaseHolderCanBeUpdated(t *testing.T) {
 	assert.True(t, ok)
 	assert.Equal(t, uint64(1000), v)
 
-	cmd = getSetTruncatedIndexCmd(110)
+	cmd = getSetTruncatedLsnCmd(110)
 	e = sm.Entry{Cmd: cmd}
 	result, err = tsm.Update(e)
 	assert.Equal(t, sm.Result{}, result)
@@ -148,20 +150,20 @@ func TestDNLeaseHolderCanBeUpdated(t *testing.T) {
 }
 
 func TestTruncatedIndexCanBeUpdated(t *testing.T) {
-	cmd := getSetTruncatedIndexCmd(200)
+	cmd := getSetTruncatedLsnCmd(200)
 	tsm := newStateMachine(1, 2).(*stateMachine)
 	e := sm.Entry{Cmd: cmd}
 	result, err := tsm.Update(e)
 	assert.Equal(t, sm.Result{}, result)
 	assert.Nil(t, err)
 
-	cmd2 := getSetTruncatedIndexCmd(220)
+	cmd2 := getSetTruncatedLsnCmd(220)
 	e2 := sm.Entry{Cmd: cmd2}
 	result, err = tsm.Update(e2)
 	assert.Equal(t, sm.Result{}, result)
 	assert.Nil(t, err)
 
-	cmd3 := getSetTruncatedIndexCmd(100)
+	cmd3 := getSetTruncatedLsnCmd(100)
 	e3 := sm.Entry{Cmd: cmd3}
 	result, err = tsm.Update(e3)
 	assert.Equal(t, sm.Result{Value: 220}, result)
@@ -170,7 +172,7 @@ func TestTruncatedIndexCanBeUpdated(t *testing.T) {
 
 func TestStateMachineUserUpdate(t *testing.T) {
 	cmd := make([]byte, headerSize+8+1)
-	binaryEnc.PutUint16(cmd, userEntryTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], uint64(1234))
 
 	tsm := newStateMachine(1, 2).(*stateMachine)
@@ -204,13 +206,13 @@ func TestStateMachineSnapshot(t *testing.T) {
 	buf := bytes.NewBuffer(nil)
 	tsm := newStateMachine(1, 2).(*stateMachine)
 	tsm.state.LeaseHolderID = 123456
-	tsm.state.TruncatedIndex = 456789
+	tsm.state.TruncatedLsn = 456789
 	assert.Nil(t, tsm.SaveSnapshot(buf, nil, nil))
 
 	tsm2 := newStateMachine(3, 4).(*stateMachine)
 	assert.Nil(t, tsm2.RecoverFromSnapshot(buf, nil, nil))
 	assert.Equal(t, tsm.state.LeaseHolderID, tsm2.state.LeaseHolderID)
-	assert.Equal(t, tsm.state.TruncatedIndex, tsm2.state.TruncatedIndex)
+	assert.Equal(t, tsm.state.TruncatedLsn, tsm2.state.TruncatedLsn)
 	assert.Equal(t, uint64(3), tsm2.shardID)
 	assert.Equal(t, uint64(4), tsm2.replicaID)
 }
@@ -219,14 +221,14 @@ func TestStateMachineLookup(t *testing.T) {
 	tsm := newStateMachine(1, 2).(*stateMachine)
 	tsm.state.Index = 1234
 	tsm.state.LeaseHolderID = 123456
-	tsm.state.TruncatedIndex = 456789
+	tsm.state.TruncatedLsn = 456789
 	v, err := tsm.Lookup(leaseHolderIDQuery{})
 	assert.Nil(t, err)
 	assert.Equal(t, tsm.state.LeaseHolderID, v.(uint64))
 
-	v2, err := tsm.Lookup(truncatedIndexQuery{})
+	v2, err := tsm.Lookup(truncatedLsnQuery{})
 	assert.Nil(t, err)
-	assert.Equal(t, tsm.state.TruncatedIndex, v2.(uint64))
+	assert.Equal(t, tsm.state.TruncatedLsn, v2.(uint64))
 
 	v3, err := tsm.Lookup(indexQuery{})
 	assert.Nil(t, err)
diff --git a/pkg/logservice/service_test.go b/pkg/logservice/service_test.go
index 880c3867f..b0826e3e0 100644
--- a/pkg/logservice/service_test.go
+++ b/pkg/logservice/service_test.go
@@ -50,13 +50,15 @@ func runServiceTest(t *testing.T,
 	defer vfs.ReportLeakedFD(cfg.FS, t)
 	service, err := NewService(cfg)
 	require.NoError(t, err)
+	peers := make(map[uint64]dragonboat.Target)
+	peers[1] = service.ID()
 	if startReplica {
 		peers := make(map[uint64]dragonboat.Target)
 		peers[1] = service.ID()
 		if hakeeper {
-			require.NoError(t, service.store.StartHAKeeperReplica(1, peers, false))
+			require.NoError(t, service.store.startHAKeeperReplica(1, peers, false))
 		} else {
-			require.NoError(t, service.store.StartReplica(1, 1, peers, false))
+			require.NoError(t, service.store.startReplica(1, 1, peers, false))
 		}
 	}
 	defer func() {
@@ -127,7 +129,7 @@ func TestServiceConnectRO(t *testing.T) {
 
 func getTestAppendCmd(id uint64, data []byte) []byte {
 	cmd := make([]byte, len(data)+headerSize+8)
-	binaryEnc.PutUint16(cmd, userEntryTag)
+	binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], id)
 	copy(cmd[headerSize+8:], data)
 	return cmd
@@ -245,7 +247,7 @@ func TestServiceHandleAppend(t *testing.T) {
 		resp = s.handleAppend(req, cmd)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(4), resp.LogResponse.Index)
+		assert.Equal(t, uint64(4), resp.LogResponse.Lsn)
 	}
 	runServiceTest(t, false, true, fn)
 }
@@ -276,7 +278,7 @@ func TestServiceHandleAppendWhenNotBeingTheLeaseHolder(t *testing.T) {
 		resp = s.handleAppend(req, cmd)
 		assert.Equal(t, pb.NotLeaseHolder, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(0), resp.LogResponse.Index)
+		assert.Equal(t, uint64(0), resp.LogResponse.Lsn)
 	}
 	runServiceTest(t, false, true, fn)
 }
@@ -307,21 +309,21 @@ func TestServiceHandleRead(t *testing.T) {
 		resp = s.handleAppend(req, cmd)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(4), resp.LogResponse.Index)
+		assert.Equal(t, uint64(4), resp.LogResponse.Lsn)
 
 		req = pb.Request{
 			Method:  pb.READ,
 			Timeout: int64(time.Second),
 			LogRequest: pb.LogRequest{
 				ShardID: 1,
-				Index:   1,
+				Lsn:     1,
 				MaxSize: 1024 * 32,
 			},
 		}
 		resp, records := s.handleRead(req)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(1), resp.LogResponse.LastIndex)
+		assert.Equal(t, uint64(1), resp.LogResponse.LastLsn)
 		require.Equal(t, 4, len(records.Records))
 		assert.Equal(t, pb.Internal, records.Records[0].Type)
 		assert.Equal(t, pb.Internal, records.Records[1].Type)
@@ -358,20 +360,20 @@ func TestServiceTruncate(t *testing.T) {
 		resp = s.handleAppend(req, cmd)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(4), resp.LogResponse.Index)
+		assert.Equal(t, uint64(4), resp.LogResponse.Lsn)
 
 		req = pb.Request{
 			Method:  pb.TRUNCATE,
 			Timeout: int64(time.Second),
 			LogRequest: pb.LogRequest{
 				ShardID: 1,
-				Index:   4,
+				Lsn:     4,
 			},
 		}
 		resp = s.handleTruncate(req)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(0), resp.LogResponse.Index)
+		assert.Equal(t, uint64(0), resp.LogResponse.Lsn)
 
 		req = pb.Request{
 			Method:  pb.GET_TRUNCATE,
@@ -383,18 +385,18 @@ func TestServiceTruncate(t *testing.T) {
 		resp = s.handleGetTruncatedIndex(req)
 		assert.Equal(t, pb.NoError, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
-		assert.Equal(t, uint64(4), resp.LogResponse.Index)
+		assert.Equal(t, uint64(4), resp.LogResponse.Lsn)
 
 		req = pb.Request{
 			Method:  pb.TRUNCATE,
 			Timeout: int64(time.Second),
 			LogRequest: pb.LogRequest{
 				ShardID: 1,
-				Index:   3,
+				Lsn:     3,
 			},
 		}
 		resp = s.handleTruncate(req)
-		assert.Equal(t, pb.IndexAlreadyTruncated, resp.ErrorCode)
+		assert.Equal(t, pb.LsnAlreadyTruncated, resp.ErrorCode)
 		assert.Equal(t, "", resp.ErrorMessage)
 	}
 	runServiceTest(t, false, true, fn)
@@ -458,7 +460,7 @@ func TestShardInfoCanBeQueried(t *testing.T) {
 	}()
 	peers1 := make(map[uint64]dragonboat.Target)
 	peers1[1] = service1.ID()
-	assert.NoError(t, service1.store.StartReplica(1, 1, peers1, false))
+	assert.NoError(t, service1.store.startReplica(1, 1, peers1, false))
 
 	service2, err := NewService(cfg2)
 	require.NoError(t, err)
@@ -467,7 +469,7 @@ func TestShardInfoCanBeQueried(t *testing.T) {
 	}()
 	peers2 := make(map[uint64]dragonboat.Target)
 	peers2[1] = service2.ID()
-	assert.NoError(t, service2.store.StartReplica(2, 1, peers2, false))
+	assert.NoError(t, service2.store.startReplica(2, 1, peers2, false))
 
 	nhID1 := service1.ID()
 	nhID2 := service2.ID()
diff --git a/pkg/logservice/store_test.go b/pkg/logservice/store_test.go
index 4bc81bd53..dc4221f9b 100644
--- a/pkg/logservice/store_test.go
+++ b/pkg/logservice/store_test.go
@@ -71,7 +71,7 @@ func TestStoreCanBeCreatedAndClosed(t *testing.T) {
 	store, err := newLogStore(cfg)
 	assert.NoError(t, err)
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 }
 
@@ -82,8 +82,8 @@ func getTestStore(cfg Config) (*store, error) {
 	}
 	peers := make(map[uint64]dragonboat.Target)
 	peers[2] = store.nh.ID()
-	if err := store.StartReplica(1, 2, peers, false); err != nil {
-		store.Close()
+	if err := store.startReplica(1, 2, peers, false); err != nil {
+		store.close()
 		return nil, err
 	}
 	return store, nil
@@ -97,9 +97,9 @@ func TestHAKeeperCanBeStarted(t *testing.T) {
 	assert.NoError(t, err)
 	peers := make(map[uint64]dragonboat.Target)
 	peers[2] = store.nh.ID()
-	assert.NoError(t, store.StartHAKeeperReplica(2, peers, false))
+	assert.NoError(t, store.startHAKeeperReplica(2, peers, false))
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 	mustHaveReplica(t, store, hakeeper.DefaultHAKeeperShardID, 2)
 }
@@ -111,7 +111,7 @@ func TestStateMachineCanBeStarted(t *testing.T) {
 	store, err := getTestStore(cfg)
 	assert.NoError(t, err)
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 	mustHaveReplica(t, store, 1, 2)
 }
@@ -123,7 +123,7 @@ func TestReplicaCanBeStopped(t *testing.T) {
 	store, err := getTestStore(cfg)
 	assert.NoError(t, err)
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 	mustHaveReplica(t, store, 1, 2)
 	store.stopReplica(1, 2)
@@ -137,14 +137,14 @@ func runStoreTest(t *testing.T, fn func(*testing.T, *store)) {
 	store, err := getTestStore(cfg)
 	assert.NoError(t, err)
 	defer func() {
-		assert.NoError(t, store.Close())
+		assert.NoError(t, store.close())
 	}()
 	fn(t, store)
 }
 
 func getTestUserEntry() []byte {
-	cmd := make([]byte, 2+8+8)
-	binaryEnc.PutUint16(cmd, userEntryTag)
+	cmd := make([]byte, headerSize+8+8)
+	binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 	binaryEnc.PutUint64(cmd[headerSize:], 100)
 	binaryEnc.PutUint64(cmd[headerSize+8:], 1234567890)
 	return cmd
@@ -154,7 +154,7 @@ func TestGetOrExtendLease(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
 	}
 	runStoreTest(t, fn)
 }
@@ -163,9 +163,9 @@ func TestAppendLog(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
 		cmd := getTestUserEntry()
-		lsn, err := store.Append(ctx, 1, cmd)
+		lsn, err := store.append(ctx, 1, cmd)
 		assert.NoError(t, err)
 		assert.Equal(t, uint64(4), lsn)
 	}
@@ -176,12 +176,12 @@ func TestAppendLogIsRejectedForMismatchedLeaseHolderID(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
-		cmd := make([]byte, 2+8+8)
-		binaryEnc.PutUint16(cmd, userEntryTag)
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
+		cmd := make([]byte, headerSize+8+8)
+		binaryEnc.PutUint32(cmd, uint32(pb.UserEntryUpdate))
 		binaryEnc.PutUint64(cmd[headerSize:], 101)
 		binaryEnc.PutUint64(cmd[headerSize+8:], 1234567890)
-		_, err := store.Append(ctx, 1, cmd)
+		_, err := store.append(ctx, 1, cmd)
 		assert.True(t, errors.Is(err, ErrNotLeaseHolder))
 	}
 	runStoreTest(t, fn)
@@ -191,10 +191,10 @@ func TestStoreTsoUpdate(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		v1, err := store.TsoUpdate(ctx, 100)
+		v1, err := store.tsoUpdate(ctx, 100)
 		require.NoError(t, err)
 		assert.Equal(t, uint64(1), v1)
-		v2, err := store.TsoUpdate(ctx, 1000)
+		v2, err := store.tsoUpdate(ctx, 1000)
 		require.NoError(t, err)
 		assert.Equal(t, uint64(101), v2)
 	}
@@ -205,13 +205,13 @@ func TestTruncateLog(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
 		cmd := getTestUserEntry()
-		_, err := store.Append(ctx, 1, cmd)
+		_, err := store.append(ctx, 1, cmd)
 		assert.NoError(t, err)
-		assert.NoError(t, store.TruncateLog(ctx, 1, 4))
-		err = store.TruncateLog(ctx, 1, 3)
-		assert.True(t, errors.Is(err, ErrInvalidTruncateIndex))
+		assert.NoError(t, store.truncateLog(ctx, 1, 4))
+		err = store.truncateLog(ctx, 1, 3)
+		assert.True(t, errors.Is(err, ErrInvalidTruncateLsn))
 	}
 	runStoreTest(t, fn)
 }
@@ -220,15 +220,15 @@ func TestGetTruncatedIndex(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		index, err := store.GetTruncatedIndex(ctx, 1)
+		index, err := store.getTruncatedLsn(ctx, 1)
 		assert.Equal(t, uint64(0), index)
 		assert.NoError(t, err)
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
 		cmd := getTestUserEntry()
-		_, err = store.Append(ctx, 1, cmd)
+		_, err = store.append(ctx, 1, cmd)
 		assert.NoError(t, err)
-		assert.NoError(t, store.TruncateLog(ctx, 1, 4))
-		index, err = store.GetTruncatedIndex(ctx, 1)
+		assert.NoError(t, store.truncateLog(ctx, 1, 4))
+		index, err = store.getTruncatedLsn(ctx, 1)
 		assert.Equal(t, uint64(4), index)
 		assert.NoError(t, err)
 	}
@@ -239,17 +239,17 @@ func TestQueryLog(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		ctx, cancel := context.WithTimeout(context.Background(), testIOTimeout)
 		defer cancel()
-		assert.NoError(t, store.GetOrExtendDNLease(ctx, 1, 100))
+		assert.NoError(t, store.getOrExtendDNLease(ctx, 1, 100))
 		cmd := getTestUserEntry()
-		_, err := store.Append(ctx, 1, cmd)
+		_, err := store.append(ctx, 1, cmd)
 		assert.NoError(t, err)
-		entries, lsn, err := store.QueryLog(ctx, 1, 4, math.MaxUint64)
+		entries, lsn, err := store.queryLog(ctx, 1, 4, math.MaxUint64)
 		assert.NoError(t, err)
 		assert.Equal(t, 1, len(entries))
 		assert.Equal(t, uint64(4), lsn)
 		assert.Equal(t, entries[0].Data, cmd)
 		// lease holder ID update cmd at entry index 3
-		entries, lsn, err = store.QueryLog(ctx, 1, 3, math.MaxUint64)
+		entries, lsn, err = store.queryLog(ctx, 1, 3, math.MaxUint64)
 		assert.NoError(t, err)
 		assert.Equal(t, 2, len(entries))
 		assert.Equal(t, uint64(3), lsn)
@@ -258,15 +258,15 @@ func TestQueryLog(t *testing.T) {
 		assert.Equal(t, pb.UserRecord, entries[1].Type)
 
 		// size limited
-		_, err = store.Append(ctx, 1, cmd)
+		_, err = store.append(ctx, 1, cmd)
 		assert.NoError(t, err)
-		entries, lsn, err = store.QueryLog(ctx, 1, 4, 1)
+		entries, lsn, err = store.queryLog(ctx, 1, 4, 1)
 		assert.NoError(t, err)
 		assert.Equal(t, 1, len(entries))
 		assert.Equal(t, uint64(5), lsn)
 		assert.Equal(t, entries[0].Data, cmd)
 		// more log available
-		entries, lsn, err = store.QueryLog(ctx, 1, 5, 1)
+		entries, lsn, err = store.queryLog(ctx, 1, 5, 1)
 		assert.NoError(t, err)
 		assert.Equal(t, 1, len(entries))
 		assert.Equal(t, uint64(5), lsn)
@@ -278,8 +278,8 @@ func TestQueryLog(t *testing.T) {
 func TestHAKeeperTick(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		peers := make(map[uint64]dragonboat.Target)
-		peers[1] = store.ID()
-		assert.NoError(t, store.StartHAKeeperReplica(1, peers, false))
+		peers[1] = store.id()
+		assert.NoError(t, store.startHAKeeperReplica(1, peers, false))
 		store.hakeeperTick()
 	}
 	runStoreTest(t, fn)
@@ -288,8 +288,8 @@ func TestHAKeeperTick(t *testing.T) {
 func TestAddScheduleCommands(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		peers := make(map[uint64]dragonboat.Target)
-		peers[1] = store.ID()
-		assert.NoError(t, store.StartHAKeeperReplica(1, peers, false))
+		peers[1] = store.id()
+		assert.NoError(t, store.startHAKeeperReplica(1, peers, false))
 		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 		defer cancel()
 		sc1 := pb.ScheduleCommand{
@@ -318,10 +318,10 @@ func TestAddScheduleCommands(t *testing.T) {
 		}
 		require.NoError(t,
 			store.addScheduleCommands(ctx, 1, []pb.ScheduleCommand{sc1, sc2, sc3}))
-		cb, err := store.GetCommandBatch(ctx, "uuid1")
+		cb, err := store.getCommandBatch(ctx, "uuid1")
 		require.NoError(t, err)
 		assert.Equal(t, []pb.ScheduleCommand{sc1, sc3}, cb.Commands)
-		cb, err = store.GetCommandBatch(ctx, "uuid2")
+		cb, err = store.getCommandBatch(ctx, "uuid2")
 		require.NoError(t, err)
 		assert.Equal(t, []pb.ScheduleCommand{sc2}, cb.Commands)
 	}
@@ -331,9 +331,9 @@ func TestAddScheduleCommands(t *testing.T) {
 func TestGetHeartbeatMessage(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		peers := make(map[uint64]dragonboat.Target)
-		peers[1] = store.ID()
-		assert.NoError(t, store.StartReplica(10, 1, peers, false))
-		assert.NoError(t, store.StartHAKeeperReplica(1, peers, false))
+		peers[1] = store.id()
+		assert.NoError(t, store.startReplica(10, 1, peers, false))
+		assert.NoError(t, store.startHAKeeperReplica(1, peers, false))
 
 		m := store.getHeartbeatMessage()
 		// hakeeper shard is included
@@ -345,20 +345,20 @@ func TestGetHeartbeatMessage(t *testing.T) {
 func TestAddHeartbeat(t *testing.T) {
 	fn := func(t *testing.T, store *store) {
 		peers := make(map[uint64]dragonboat.Target)
-		peers[1] = store.ID()
-		assert.NoError(t, store.StartHAKeeperReplica(1, peers, false))
+		peers[1] = store.id()
+		assert.NoError(t, store.startHAKeeperReplica(1, peers, false))
 
 		m := store.getHeartbeatMessage()
 		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 		defer cancel()
-		assert.NoError(t, store.AddLogStoreHeartbeat(ctx, m))
+		assert.NoError(t, store.addLogStoreHeartbeat(ctx, m))
 
 		dnMsg := pb.DNStoreHeartbeat{
-			UUID:   store.ID(),
+			UUID:   store.id(),
 			Shards: make([]pb.DNShardInfo, 0),
 		}
 		dnMsg.Shards = append(dnMsg.Shards, pb.DNShardInfo{ShardID: 2, ReplicaID: 3})
-		assert.NoError(t, store.AddDNStoreHeartbeat(ctx, dnMsg))
+		assert.NoError(t, store.addDNStoreHeartbeat(ctx, dnMsg))
 	}
 	runStoreTest(t, fn)
 }
@@ -428,13 +428,13 @@ func getTestStores() (*store, *store, error) {
 	peers1 := make(map[uint64]dragonboat.Target)
 	peers1[1] = store1.nh.ID()
 	peers1[2] = store2.nh.ID()
-	if err := store1.StartReplica(1, 1, peers1, false); err != nil {
+	if err := store1.startReplica(1, 1, peers1, false); err != nil {
 		return nil, nil, err
 	}
 	peers2 := make(map[uint64]dragonboat.Target)
 	peers2[1] = store1.nh.ID()
 	peers2[2] = store2.nh.ID()
-	if err := store2.StartReplica(1, 2, peers2, false); err != nil {
+	if err := store2.startReplica(1, 2, peers2, false); err != nil {
 		return nil, nil, err
 	}
 
@@ -463,8 +463,8 @@ func TestRemoveReplica(t *testing.T) {
 	store1, store2, err := getTestStores()
 	require.NoError(t, err)
 	defer func() {
-		require.NoError(t, store1.Close())
-		require.NoError(t, store2.Close())
+		require.NoError(t, store1.close())
+		require.NoError(t, store2.close())
 	}()
 	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 	defer cancel()