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

kv: merge batch get results to fix insert ignore in a transaction block #6215

Merged
merged 6 commits into from
Apr 4, 2018

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Apr 3, 2018

Merge the batch get results with buffer store to fix insert ignore bug when it is in a transaction block.
PTAL @coocood

@coocood
Copy link
Member

coocood commented Apr 3, 2018

@jackysp
If transaction IsReadOnly, we can by pass the merging.

kv/txn.go Outdated
// BatchGetValues gets values in batch.
// The values from buffer in transaction and the values from the storage node are merged together.
func BatchGetValues(txn Transaction, keys []Key) (map[string][]byte, error) {
bufferValues := make(map[string][]byte, len(keys))
Copy link
Member

Choose a reason for hiding this comment

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

Using a keys slice and a values slice has a lower cost.

@jackysp
Copy link
Member Author

jackysp commented Apr 3, 2018

PTAL @coocood

@coocood
Copy link
Member

coocood commented Apr 4, 2018

LGTM

@coocood coocood added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 4, 2018
@coocood
Copy link
Member

coocood commented Apr 4, 2018

/run-all-tests

@coocood coocood changed the title *: merge batch get results to fix insert ignore in a transaction block kv: merge batch get results to fix insert ignore in a transaction block Apr 4, 2018
continue
}
storageValues[string(key)] = bufferValues[i]
}
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 do CheckVisibility(txn.startTS) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

In (s *tikvSnapshot) BatchGet , it is already been checked.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ignore it.
We do it in BatchGet.

@coocood coocood added the type/bugfix This PR fixes a bug. label Apr 4, 2018
Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp merged commit 6ff44c7 into pingcap:master Apr 4, 2018
@jackysp jackysp deleted the txn_batchget branch May 22, 2018 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants