ddl: use the correct timezone to encode record for adding index (#46055)#46104
Merged
ti-chi-bot[bot] merged 2 commits intopingcap:release-6.5from Aug 17, 2023
Merged
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
12 tasks
zimulala
reviewed
Aug 15, 2023
| func buildDAGPB(sCtx sessionctx.Context, tblInfo *model.TableInfo, colInfos []*model.ColumnInfo) (*tipb.DAGRequest, error) { | ||
| dagReq := &tipb.DAGRequest{} | ||
| dagReq.TimeZoneName, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location()) | ||
| _, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location()) |
Contributor
There was a problem hiding this comment.
Why do we only need to change 'TimeZoneName' and not 'TimeZoneOffset'?
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release-6.5 #46104 +/- ##
================================================
Coverage ? 74.3184%
================================================
Files ? 1084
Lines ? 353658
Branches ? 0
================================================
Hits ? 262833
Misses ? 74377
Partials ? 16448 |
zimulala
approved these changes
Aug 15, 2023
wjhuang2016
approved these changes
Aug 16, 2023
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wjhuang2016, zimulala The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Member
|
/retest |
1 similar comment
Contributor
|
/retest |
Contributor
|
/retest-required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #46055
What problem does this PR solve?
Issue Number: close #46033
Problem Summary:
Normally, TiDB converts
timestampvalues to UTC before writing them to the storage, and converts them back when reading. For adding index, weIn step 1, the datum returned by
extractDatumByOffsets()is in UTC timezone. It is converted to UTC again in step 2. As a result, index timestamp is converted twice.Unistore DAG request decoding:
tidb/store/mockstore/unistore/cophandler/cop_handler.go
Lines 298 to 308 in 3846e80
TiKV DAG request decoding:
https://github.com/tikv/tikv/blob/14dd8cce96e064a029e58de8cf832c35d44e09a5/components/tidb_query_datatype/src/expr/ctx.rs#L86-L94
For Unistore and TiKV, the time zone name is always considered first, and the time zone offset second.
Thus, the way to
buildDAGPBis wrong:tidb/ddl/index_cop.go
Line 487 in 3846e80
We assigned both name and offset to
UTCand-0600respectively.UTCis kept but-0600is discarded during parsing the DAG request.What is changed and how it works?
Assign the time zone offset in
buildDAGPB, and leave time zone name to be empty.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.