Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

support stale-read testcase #416

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented Jun 3, 2021

What problem does this PR solve?

What is changed and how does it work?

Check List

Add stale-read testcases.

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: yisaer <[email protected]>

add stale-read test

Signed-off-by: yisaer <[email protected]>

add stale-read test

Signed-off-by: yisaer <[email protected]>
@Yisaer Yisaer force-pushed the support_stale_read_cluster branch from e9d1016 to ccb97e0 Compare June 3, 2021 13:09
Yisaer added 2 commits June 4, 2021 17:08
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
@Yisaer Yisaer marked this pull request as ready for review June 7, 2021 10:11
Signed-off-by: yisaer <[email protected]>

fix lint

Signed-off-by: yisaer <[email protected]>
@Yisaer Yisaer force-pushed the support_stale_read_cluster branch from 4a73dd9 to a88ccf0 Compare June 8, 2021 04:55
Comment on lines 97 to 107
setSQL := fmt.Sprintf(`SET TRANSACTION READ ONLY as of timestamp tidb_bounded_staleness('%v', '%v')`, previousStr, nowStr)
_, err := db.Exec(setSQL)
if err != nil {
return err
}
rows, err := db.Query("select id, k, c, pad from sbtest0 where k in (?, ?, ?)", rand.Intn(num), rand.Intn(num), rand.Intn(num))
defer rows.Close()
if err != nil {
return errors.WithStack(err)
}
return nil
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do COMMIT here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need to commit here.

testcase/stale-read/bench.go Outdated Show resolved Hide resolved
return nil
}

func (c *SysbenchCase) executeSelect(db *sql.DB) error {
Copy link
Member

Choose a reason for hiding this comment

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

I think a prepare test case is needed after pingcap/tidb#25156 is merged.

Copy link
Contributor Author

@Yisaer Yisaer Jun 9, 2021

Choose a reason for hiding this comment

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

we can add it after tidb#25156 merged.

Copy link
Member

Choose a reason for hiding this comment

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

What about adding a TODO.

func (c *SysbenchCase) executeSelect(db *sql.DB) error {
num := c.insertCount * c.rowsEachInsert
now := time.Now()
previous := now.Add(-3 * time.Second)
Copy link
Member

@JmPotato JmPotato Jun 8, 2021

Choose a reason for hiding this comment

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

What about making the staleness second 3s configurable as a cmd flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

}

// TODO: assert store read bytes/keys metrics
func handleStoreMetricsValue(smvms map[string][]StoreMetricsValue, duration time.Duration) {
Copy link
Member

Choose a reason for hiding this comment

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

What are you going to do with these metrics data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

asserting the key/byte loads of store is close with each other.

Signed-off-by: yisaer <[email protected]>
@Yisaer Yisaer requested a review from JmPotato June 9, 2021 06:39
Copy link
Member

@JmPotato JmPotato left a comment

Choose a reason for hiding this comment

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

Rest LGTM.

return nil
}

func (c *SysbenchCase) executeSelect(db *sql.DB) error {
Copy link
Member

Choose a reason for hiding this comment

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

What about adding a TODO.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants