Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: support check an index #5932

Merged
merged 11 commits into from Mar 5, 2018
Merged

*: support check an index #5932

merged 11 commits into from Mar 5, 2018

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Mar 1, 2018

Using IndexLoopUpReader to support admin check index option.

In next PR I will handle the case below:

index     data (handle, data): (1, 10), (2, 20), (4, 30)
table     data (handle, data): (1, 10), (2, 20), (4, 40)

@zimulala zimulala added the WIP label Mar 1, 2018
@zimulala zimulala removed the WIP label Mar 1, 2018
@zimulala
Copy link
Contributor Author

zimulala commented Mar 2, 2018

PTAL @coocood @shenli @winoros

@@ -403,6 +403,7 @@ func (s *testParserSuite) TestDMLStmt(c *C) {
{"admin show ddl;", true},
{"admin show ddl jobs;", true},
{"admin check table t1, t2;", true},
{"admin check index idx;", true},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idx is the table name, and index name is empty?

break
}
}
if idx == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check if the index state is public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
err := e.run(ctx)
e.done = true
return errors.Trace(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just call e.Next or extract a function?

}

for {
row, err := e.src.Next(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use NextChunk?

dbName string
tableName string
idxName string
src Executor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Executor/*IndexLookUpExecutor/ is more readable ?

@@ -878,6 +886,10 @@ func (w *tableWorker) executeTask(ctx context.Context, task *lookupTableTask) {
}
sort.Sort(task)
}

if w.isCheckOp && handleCnt != len(task.rows) {
err = errors.Errorf("handle count %d isn't equal to value count %d", handleCnt, len(task.rows))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the missing handle and corresponding index value in the error message.

@@ -409,6 +409,70 @@ func (e *CheckTableExec) run(ctx context.Context) error {
return nil
}

// CheckIndexExec represents the executor of check an index.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check -> checking

@@ -409,6 +409,70 @@ func (e *CheckTableExec) run(ctx context.Context) error {
return nil
}

// CheckIndexExec represents the executor of check an index.
// It is built from the "admin check index" statement, and it checks if the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it checks the consistency of the index data with the records of the table.

@zimulala
Copy link
Contributor Author

zimulala commented Mar 2, 2018

PTAL @lamxTyler @winoros @zz-jason @shenli

if err != nil {
return errors.Trace(err)
}
cnt := 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cnt is unused ?

@zimulala
Copy link
Contributor Author

zimulala commented Mar 5, 2018

PTAL @zz-jason

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 5, 2018
@shenli shenli added the Priority/P1 Features that will be implemented in the latest or next major/minor version label Mar 5, 2018
@shenli
Copy link
Member

shenli commented Mar 5, 2018

LGTM

@shenli
Copy link
Member

shenli commented Mar 5, 2018

/run-all-tests

@shenli shenli added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 5, 2018
@zimulala zimulala merged commit 3b1884e into pingcap:master Mar 5, 2018
@zimulala zimulala deleted the check-index branch March 5, 2018 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/P1 Features that will be implemented in the latest or next major/minor version status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants