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

*: fix bad column offsets. #3754

Merged
merged 37 commits into from
Jul 28, 2017
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
669e2e8
*: fix bad column offsets.
hicqu Jul 14, 2017
50c258c
fix ci.
hicqu Jul 14, 2017
631a8ca
improve code.
hicqu Jul 14, 2017
c7a74c7
fix bug.
hicqu Jul 14, 2017
d2f8a91
Merge branch 'master' into qupeng/column-offset
hicqu Jul 14, 2017
b297477
Merge branch 'master' into qupeng/column-offset
hicqu Jul 17, 2017
22bb700
Merge branch 'master' into qupeng/column-offset
hicqu Jul 17, 2017
93240dd
address comments.
hicqu Jul 18, 2017
c8dde90
Merge branch 'master' into qupeng/column-offset
hicqu Jul 18, 2017
96a667a
fix ci.
hicqu Jul 18, 2017
397a44d
Merge branch 'master' into qupeng/column-offset
hicqu Jul 18, 2017
5b1cddc
address comments.
hicqu Jul 19, 2017
5846f7f
Merge branch 'master' into qupeng/column-offset
hicqu Jul 19, 2017
e20cb89
Merge branch 'master' into qupeng/column-offset
hicqu Jul 20, 2017
d65a7f3
address comments.
hicqu Jul 20, 2017
d8fb37b
Merge branch 'master' into qupeng/column-offset
hicqu Jul 20, 2017
f205635
address comments.
hicqu Jul 20, 2017
3d88b0f
Merge branch 'master' into qupeng/column-offset
hicqu Jul 20, 2017
d76b1e3
Merge branch 'qupeng/column-offset' of github.com:pingcap/tidb into q…
hicqu Jul 20, 2017
9d2b86a
Merge branch 'master' into qupeng/column-offset
hicqu Jul 21, 2017
42b202c
address comments.
hicqu Jul 21, 2017
ac2aa3c
address comments.
hicqu Jul 21, 2017
7383b86
Merge branch 'master' into qupeng/column-offset
hicqu Jul 21, 2017
5b0883d
address comments.
hicqu Jul 21, 2017
cbba317
address comments.
hicqu Jul 21, 2017
bb70730
Merge branch 'master' into qupeng/column-offset
hicqu Jul 21, 2017
906cf4e
fix bad comment.
hicqu Jul 21, 2017
370c1e4
Merge branch 'master' into qupeng/column-offset
hicqu Jul 21, 2017
1269693
Merge branch 'master' into qupeng/column-offset
hicqu Jul 24, 2017
f8f0df2
Merge branch 'master' into qupeng/column-offset
hicqu Jul 25, 2017
5b9e9e5
address comments.
hicqu Jul 25, 2017
7665b13
Merge branch 'master' into qupeng/column-offset
hicqu Jul 25, 2017
2f7b85f
Merge branch 'master' into qupeng/column-offset
hicqu Jul 26, 2017
1661ec3
ddl: fix ddl_db_change_test.go.
hicqu Jul 26, 2017
42939df
address comments.
hicqu Jul 27, 2017
dbf52ea
Merge branch 'master' into qupeng/column-offset
zimulala Jul 28, 2017
044478d
Merge branch 'master' into qupeng/column-offset
hicqu Jul 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments.
In UpdateRecord and InsertRecord, we should set write-only columns
origin default values, not default values.
  • Loading branch information
hicqu committed Jul 21, 2017
commit 5b0883da5851d0e578cd6f5cdccd1ab7951de252
4 changes: 2 additions & 2 deletions table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (t *Table) UpdateRecord(ctx context.Context, h int64, oldData, newData []ty
if col.State != model.StatePublic {
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't understand the new logic.
The old logic is: if the column state is not public but writable, and there is no column value yet, assign default value to it. (similar to reorganization...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no value yet should mean the value fetched from KV is the default value, but not the value fetched from KV is null.

Copy link
Contributor

Choose a reason for hiding this comment

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

"the value fetched from KV is the default value" who set the value to default value?

// if col is in write only or write reorganization state
// and the value is not default, we should use default value.
value, err = table.GetColDefaultValue(ctx, col.ToInfo())
value, err = table.GetColOriginDefaultValue(ctx, col.ToInfo())
if err != nil {
return errors.Trace(err)
}
Expand Down Expand Up @@ -354,7 +354,7 @@ func (t *Table) AddRecord(ctx context.Context, r []types.Datum) (recordID int64,
var value types.Datum
if col.State != model.StatePublic {
// if col is in write only or write reorganization state, we must add it with its default value.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/if/If.
This comment may need to be updated.

value, err = table.GetColDefaultValue(ctx, col.ToInfo())
value, err = table.GetColOriginDefaultValue(ctx, col.ToInfo())
if err != nil {
return 0, errors.Trace(err)
}
Expand Down