mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 03:17:50 +00:00
Fix inmem read only translation bug
This commit is contained in:
parent
2f76283f03
commit
1b068f75a8
1 changed files with 2 additions and 8 deletions
10
translate.go
10
translate.go
|
|
@ -286,10 +286,6 @@ func (s *InMemTranslateStore) SetReadOnly(v bool) {
|
|||
func (s *InMemTranslateStore) TranslateKey(key string) (uint64, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if s.readOnly {
|
||||
return 0, nil
|
||||
}
|
||||
return s.translateKey(key)
|
||||
}
|
||||
|
||||
|
|
@ -299,10 +295,6 @@ func (s *InMemTranslateStore) TranslateKeys(keys []string) (_ []uint64, err erro
|
|||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if s.readOnly {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
ids := make([]uint64, len(keys))
|
||||
for i := range keys {
|
||||
if ids[i], err = s.translateKey(keys[i]); err != nil {
|
||||
|
|
@ -316,6 +308,8 @@ func (s *InMemTranslateStore) translateKey(key string) (_ uint64, err error) {
|
|||
// Return id if it has been added.
|
||||
if id, ok := s.idsByKey[key]; ok {
|
||||
return id, nil
|
||||
} else if s.readOnly {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// Generate a new id and update db.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue