Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu committed Jun 2, 2022
1 parent 904688f commit 443ba75
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Storages/StorageDeltaMerge.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class StorageDeltaMerge
mutable std::mutex decode_schema_mutex;
DecodingStorageSchemaSnapshotPtr decoding_schema_snapshot;
// The following two members must be used under the protection of table structure lock
bool decoding_schema_changed;
bool decoding_schema_changed = false;
// internal version for `decoding_schema_snapshot`
size_t decoding_schema_version = 1;

Expand Down
5 changes: 2 additions & 3 deletions dbms/src/Storages/Transaction/PartitionStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void writeRegionDataToStorage(
BlockUPtr block_ptr = nullptr;
if (need_decode)
{
LOG_FMT_DEBUG(log, "{} begin to decode table {}, region {}", FUNCTION_NAME, table_id, region->id());
LOG_FMT_TRACE(log, "{} begin to decode table {}, region {}", FUNCTION_NAME, table_id, region->id());
DecodingStorageSchemaSnapshotConstPtr decoding_schema_snapshot;
std::tie(decoding_schema_snapshot, block_ptr) = storage->getSchemaSnapshotAndBlockForDecoding(lock, true);
block_decoding_schema_version = decoding_schema_snapshot->decoding_schema_version;
Expand Down Expand Up @@ -155,7 +155,7 @@ static void writeRegionDataToStorage(
if (need_decode)
storage->releaseDecodingBlock(block_decoding_schema_version, std::move(block_ptr));

LOG_FMT_DEBUG(log, "{}: table {}, region {}, cost [region decode {}, write part {}] ms", FUNCTION_NAME, table_id, region->id(), region_decode_cost, write_part_cost);
LOG_FMT_TRACE(log, "{}: table {}, region {}, cost [region decode {}, write part {}] ms", FUNCTION_NAME, table_id, region->id(), region_decode_cost, write_part_cost);
return true;
};

Expand All @@ -169,7 +169,6 @@ static void writeRegionDataToStorage(
if (atomic_read_write(false))
return;
}
LOG_FMT_DEBUG(log, "{} try to sync schema", FUNCTION_NAME);

/// If first try failed, sync schema and force read then write.
{
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Storages/Transaction/SchemaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ void SchemaBuilder<Getter, NameMapper>::applyCreatePhysicalTable(DBInfoPtr db_in
ParserCreateQuery parser;
ASTPtr ast = parseQuery(parser, stmt.data(), stmt.data() + stmt.size(), "from syncSchema " + table_info->name, 0);

ASTCreateQuery * ast_create_query = typeid_cast<ASTCreateQuery *>(ast.get());
auto * ast_create_query = typeid_cast<ASTCreateQuery *>(ast.get());
ast_create_query->attach = true;
ast_create_query->if_not_exists = true;
ast_create_query->database = name_mapper.mapDatabaseName(*db_info);
Expand Down
6 changes: 3 additions & 3 deletions tests/fullstack-test2/ddl/alter_column_when_pk_is_handle.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.t

=> DBGInvoke __enable_schema_sync_service('false')

>> DBGInvoke __enable_fail_point(exception_after_drop_column_in_the_same_diff)
>> DBGInvoke __enable_fail_point(exception_between_schema_change_in_the_same_diff)

# stop decoding data
>> DBGInvoke __enable_fail_point(pause_before_apply_raft_cmd)

# Need to apply a lossy type change to reorganize data. issue#3714
mysql> alter table test.t modify c decimal(6,3)

# refresh schema and hit the `exception_after_drop_column_in_the_same_diff` failpoint
# refresh schema and hit the `exception_between_schema_change_in_the_same_diff` failpoint
>> DBGInvoke __refresh_schemas()

>> DBGInvoke __disable_fail_point(exception_after_drop_column_in_the_same_diff)
>> DBGInvoke __disable_fail_point(exception_between_schema_change_in_the_same_diff)

>> DBGInvoke __disable_fail_point(pause_before_apply_raft_cmd)

Expand Down

0 comments on commit 443ba75

Please sign in to comment.