Skip to content

Commit ea199f7

Browse files
test(slo): xorm: add hash to where in read
1 parent 166562f commit ea199f7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/slo/xorm/storage.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,13 @@ func NewStorage(ctx context.Context, cfg *config.Config, poolSize int) (_ *Stora
102102
return nil, err
103103
}
104104

105-
s.x.DB().SetMaxOpenConns(poolSize)
106-
s.x.DB().SetMaxIdleConns(poolSize)
107-
s.x.DB().SetConnMaxIdleTime(time.Second)
105+
s.x.SetMaxOpenConns(poolSize)
106+
s.x.SetMaxIdleConns(poolSize)
107+
s.x.SetConnMaxIdleTime(time.Second)
108108

109-
s.x.SetTableMapper(newMapper(cfg.Table, "entry"))
109+
s.x.SetTableMapper(newMapper(cfg.Table, cfg.Table))
110110

111111
s.x.SetLogLevel(log.LOG_DEBUG)
112-
s.x.ShowSQL(true)
113112

114113
tableParams := map[string]string{
115114
"AUTO_PARTITIONING_BY_SIZE": "ENABLED",
@@ -136,7 +135,7 @@ func (s *Storage) Read(ctx context.Context, id generator.RowID) (row generator.R
136135

137136
err = retry.Do(ydb.WithTxControl(ctx, readTx), s.x.DB().DB,
138137
func(ctx context.Context, _ *sql.Conn) (err error) {
139-
has, err := s.x.Context(ctx).Get(&row)
138+
has, err := s.x.Context(ctx).Where("hash = Digest::NumericHash(?)", id).Get(&row)
140139
if err != nil {
141140
return fmt.Errorf("get entry error: %w", err)
142141
}

0 commit comments

Comments
 (0)