Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 22dbafa

Browse files
erizocosmicoajnavarro
authored andcommitted
sql/plan: correctly count processed index rows globally instead of per partition
Signed-off-by: Miguel Molina <[email protected]> (cherry picked from commit 22c8983)
1 parent cdea792 commit 22dbafa

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sql/index/pilosa/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (idx *pilosaIndex) Expressions() []string {
143143
return idx.expressions
144144
}
145145

146-
func (pilosaIndex) Driver() string { return DriverID }
146+
func (*pilosaIndex) Driver() string { return DriverID }
147147

148148
func (idx *pilosaIndex) AscendGreaterOrEqual(keys ...interface{}) (sql.IndexLookup, error) {
149149
if len(keys) != len(idx.expressions) {

sql/plan/create_index.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ type loggingPartitionKeyValueIter struct {
398398
ctx *sql.Context
399399
log *logrus.Entry
400400
iter sql.PartitionIndexKeyValueIter
401+
rows uint64
401402
}
402403

403404
func newLoggingPartitionKeyValueIter(
@@ -418,7 +419,7 @@ func (i *loggingPartitionKeyValueIter) Next() (sql.Partition, sql.IndexKeyValueI
418419
return nil, nil, err
419420
}
420421

421-
return p, newLoggingKeyValueIter(i.ctx, i.log, iter), nil
422+
return p, newLoggingKeyValueIter(i.ctx, i.log, iter, &i.rows), nil
422423
}
423424

424425
func (i *loggingPartitionKeyValueIter) Close() error {
@@ -430,20 +431,22 @@ type loggingKeyValueIter struct {
430431
span opentracing.Span
431432
log *logrus.Entry
432433
iter sql.IndexKeyValueIter
433-
rows uint64
434+
rows *uint64
434435
start time.Time
435436
}
436437

437438
func newLoggingKeyValueIter(
438439
ctx *sql.Context,
439440
log *logrus.Entry,
440441
iter sql.IndexKeyValueIter,
442+
rows *uint64,
441443
) *loggingKeyValueIter {
442444
return &loggingKeyValueIter{
443445
ctx: ctx,
444446
log: log,
445447
iter: iter,
446448
start: time.Now(),
449+
rows: rows,
447450
}
448451
}
449452

@@ -456,13 +459,13 @@ func (i *loggingKeyValueIter) Next() ([]interface{}, []byte, error) {
456459
)
457460
}
458461

459-
i.rows++
460-
if i.rows%sql.IndexBatchSize == 0 {
462+
(*i.rows)++
463+
if *i.rows%sql.IndexBatchSize == 0 {
461464
duration := time.Since(i.start)
462465

463466
i.log.WithFields(logrus.Fields{
464467
"duration": duration,
465-
"rows": i.rows,
468+
"rows": *i.rows,
466469
}).Debugf("still creating index")
467470

468471
if i.span != nil {

0 commit comments

Comments
 (0)