Skip to content

Commit

Permalink
DB Access Layer Merges: Address the review comments from GetTablePatt…
Browse files Browse the repository at this point in the history
  • Loading branch information
a-barboza authored Oct 11, 2023
1 parent cdd83d7 commit 2dadfdc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 0 additions & 4 deletions translib/db/db_keys_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ func (d *DB) ExistKeysPattern(ts *TableSpec, pat Key) (bool, error) {
// Run Lua script [Found = SUCCESS return]
if d.Opts.IsWriteDisabled && !exists {

//glog.Info("ExistKeysPattern: B4= ", luaScriptExistsKeysPatterns.Hash())

var luaExists interface{}
if luaExists, err = luaScriptExistsKeysPatterns.Run(d.client,
[]string{d.key2redis(ts, pat)}).Result(); err == nil {
Expand All @@ -133,8 +131,6 @@ func (d *DB) ExistKeysPattern(ts *TableSpec, pat Key) (bool, error) {
err = tlerr.TranslibDBScriptFail{Description: existsString}
}
}

//glog.Info("ExistKeysPattern: AF= ", luaScriptExistsKeysPatterns.Hash())
}

// Time End, Time, Peak
Expand Down
2 changes: 0 additions & 2 deletions translib/db/db_table_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ func (d *DB) GetTablePattern(ts *TableSpec, pat Key) (Table, error) {

keys = make([]Key, 0, len(tkNv)/2)
for i, v := range tkNv {
// glog.Info("GetTablePattern: i: ", i, " v: ", v)
if i%2 == 0 {
if redisKey, ok = v.(string); !ok {
err = tlerr.TranslibDBScriptFail{Description: "Unexpected key"}
return table, err
}
} else {
// glog.Info("GetTablePattern: i: ", i, " v: ", v)
if redisValue, ok = v.([]interface{}); !ok {
err = tlerr.TranslibDBScriptFail{Description: "Unexpected hash"}
return table, err
Expand Down
13 changes: 6 additions & 7 deletions translib/db/db_table_pattern_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package db

import (
"fmt"
"reflect"
"testing"
)
Expand Down Expand Up @@ -97,9 +96,9 @@ func TestGetTablePatternCompOrig(t *testing.T) {
delete(tOrig.patterns, db.key2redis(&ts, Key{Comp: []string{"*"}}))

if !reflect.DeepEqual(tPat, tOrig) {
fmt.Println("\ntPat: \n", tPat)
fmt.Println("\ntOrig: \n", tOrig)
t.Errorf("GetTable() != GetTablePattern")
t.Log("\ntPat: \n", tPat)
t.Log("\ntOrig: \n", tOrig)
t.Error("GetTable() != GetTablePattern")
}
}

Expand All @@ -116,9 +115,9 @@ func TestGetTablePatternCompOrigEmpty(t *testing.T) {
}

if !reflect.DeepEqual(tPat, tOrig) {
fmt.Println("\ntPat: \n", tPat)
fmt.Println("\ntOrig: \n", tOrig)
t.Errorf("Empty GetTable() != GetTablePattern")
t.Log("\ntPat: \n", tPat)
t.Log("\ntOrig: \n", tOrig)
t.Error("Empty GetTable() != GetTablePattern")
}
}

Expand Down

0 comments on commit 2dadfdc

Please sign in to comment.