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-568: Fix schema version setting to -1 when bootstrap #278

Merged
merged 1 commit into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions dbms/src/Storages/Transaction/SchemaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#include <Parsers/ASTLiteral.h>
#include <Parsers/ASTRenameQuery.h>
#include <Parsers/ParserCreateQuery.h>
#include <Parsers/ParserDropQuery.h>
#include <Parsers/parseQuery.h>
#include <Storages/MutableSupport.h>
#include <Storages/Transaction/SchemaBuilder.h>
#include <Storages/Transaction/SchemaBuilder-internal.h>
#include <Storages/Transaction/SchemaBuilder.h>
#include <Storages/Transaction/TMTContext.h>
#include <Storages/Transaction/TypeMapping.h>

Expand Down Expand Up @@ -342,7 +341,8 @@ void SchemaBuilder<Getter>::applyAlterPartition(TiDB::DBInfoPtr db_info, TableID
orig_defs.begin(), orig_defs.end(), [&](const PartitionDefinition & orig_def) { return new_def.id == orig_def.id; });
if (it == orig_defs.end())
{
applyCreatePhysicalTableImpl(*db_info, table_info->producePartitionTableInfo(new_def.id));
auto part_table_info = table_info->producePartitionTableInfo(new_def.id);
applyCreatePhysicalTableImpl(*db_info, part_table_info);
}
}
}
Expand Down Expand Up @@ -551,8 +551,10 @@ String createTableStmt(const DBInfo & db_info, const TableInfo & table_info)
}

template <typename Getter>
void SchemaBuilder<Getter>::applyCreatePhysicalTableImpl(const TiDB::DBInfo & db_info, const TiDB::TableInfo & table_info)
void SchemaBuilder<Getter>::applyCreatePhysicalTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info)
{
table_info.schema_version = target_version;

String stmt = createTableStmt(db_info, table_info);

LOG_INFO(log, "try to create table with stmt: " << stmt);
Expand Down Expand Up @@ -586,7 +588,6 @@ void SchemaBuilder<Getter>::applyCreateTable(TiDB::DBInfoPtr db_info, Int64 tabl
template <typename Getter>
void SchemaBuilder<Getter>::applyCreateTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info)
{
table_info.schema_version = target_version;
if (table_info.isLogicalPartitionTable())
{
// create partition table.
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Storages/Transaction/SchemaBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct SchemaBuilder

void applyAlterPartition(TiDB::DBInfoPtr db_info, Int64 table_id);

void applyCreatePhysicalTableImpl(const TiDB::DBInfo & db_info, const TiDB::TableInfo & table_info);
void applyCreatePhysicalTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info);

void applyCreateTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info);

Expand Down