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

[FLASH-386] DeltaMerge DDL support #190

Merged
merged 36 commits into from
Aug 28, 2019

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Aug 21, 2019

Design doc:
https://docs.google.com/document/d/1m2wqvr7QEsv7w4uRGlWzgX8IEb5nuV2iwH_sJSIP2qY/edit#

  • DM create table statement now accept TiDB::TableInfo as optional second param
  • Support for applying alter on DM tables. Details are in the design doc
    • Add Column
    • Drop Column
    • Modify Column DataType (including nullable <-> not null)
    • Rename Table
    • Rename Column
    • Create/Modify Column with non 'zero' default value
  • DM readChunkData now support read chunk column data as column_defines.
    If there are different between column_defines and chunk.columns, it will do cast / fill missing values as need
  • Add some test cases in tests/delta_merge

TODO:

  • Rename column name (FLASH-452)
  • Create/alter column with default value, which may change to a 'CAST' expr in AlterCommand::validate, will throw exception (FLASH-453)

}
}

void DeltaMergeStore::flushCache(const Context & db_context)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flowbehappy please take a look at here, should we acquire for a lock here?

Copy link
Contributor

Choose a reason for hiding this comment

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

DeltaMergeStore::flushCache does not need any lock. Because It does not update segments structure. But Segment:: flushCache do need a std::unique_lock lock(read_write_mutex) to synchronize between read threads on the Segment objects.

@JaySon-Huang
Copy link
Contributor Author

/run-integration-tests

@JaySon-Huang
Copy link
Contributor Author

/run-integration-tests

@JaySon-Huang JaySon-Huang merged commit e67dbf7 into pingcap:DeltaMergeEngine Aug 28, 2019
@JaySon-Huang JaySon-Huang deleted the dm-ddl branch August 28, 2019 06:37
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Sep 5, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Sep 12, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Sep 18, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Sep 23, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit that referenced this pull request Sep 26, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Oct 17, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Oct 18, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit that referenced this pull request Oct 22, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Oct 23, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Oct 30, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Nov 1, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Nov 1, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Nov 5, 2019
* cast DataType while reading from PageStorage

* add isLossyCast function

* alter for StroageDeltaMerge, WIP

* add Alter for StorageDeltaMerge

* add Alter for StorageDeltaMerge

* add TableInfo in StroageDeltaMerge

* rename table for StorageDeltaMerge

* fix bug: the TableInfo from TiDB

* add comments for DeltaMerge flush && cache

* more faster(?) way to cast mismatch datatype

* support cast for numeric type null/not null

* support for other data type just change null / not null

* isLossyCast -> isSupportedDataTypeCast

* isSupportedDataTypeCast add decimal detect

* rename function

* fix compile errors in gtests

* small fix

* fix broken tests

* support new column with non-zero default value

* remove unused code

* fix compile error in CI

* fix bug in table rename

* small fix

* minor fix

* refine cast function in chunk

* update DeltaMergeStore's segments within lock

* [WIP]Add test cases for default value ddl. Still has bugs

* fix bugs after rebasing to latest master

* add some TODO marks

* fix compile error in gtests && remove unused comments

* fix broken gtests

* flush cached chunks in delta instead of doing DeltaMerge when ddl-changes apply

* use TypeIndex instead of typeid_cast

* clean up data after tests

* address comment
JaySon-Huang pushed a commit that referenced this pull request Aug 6, 2024
Lloyd-Pottiger pushed a commit to Lloyd-Pottiger/tiflash that referenced this pull request Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants