Skip to content

Commit

Permalink
Remove unnecessary locks from TabletInfo
Browse files Browse the repository at this point in the history
TabletInfo attributes are getting written only once, on its initialization
It has nothing to mitigate with locks
  • Loading branch information
dkropachev committed Jun 22, 2024
1 parent dce12c1 commit ce11adb
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions host_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ type ReplicaInfo struct {

// Experimental, this interface and use may change
type TabletInfo struct {
mu sync.RWMutex
keyspaceName string
tableName string
firstToken int64
Expand All @@ -521,32 +520,22 @@ type TabletInfo struct {
}

func (t *TabletInfo) KeyspaceName() string {
t.mu.RLock()
defer t.mu.RUnlock()
return t.keyspaceName
}

func (t *TabletInfo) FirstToken() int64 {
t.mu.RLock()
defer t.mu.RUnlock()
return t.firstToken
}

func (t *TabletInfo) LastToken() int64 {
t.mu.RLock()
defer t.mu.RUnlock()
return t.lastToken
}

func (t *TabletInfo) TableName() string {
t.mu.RLock()
defer t.mu.RUnlock()
return t.tableName
}

func (t *TabletInfo) Replicas() []ReplicaInfo {
t.mu.RLock()
defer t.mu.RUnlock()
return t.replicas
}

Expand Down

0 comments on commit ce11adb

Please sign in to comment.