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 7254f1e commit 07356bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 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
4 changes: 2 additions & 2 deletions dbms/src/Storages/Transaction/tests/RowCodecTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ inline DecodingStorageSchemaSnapshotConstPtr getDecodingStorageSchemaSnapshot(co
if (handle_id != EXTRA_HANDLE_COLUMN_ID)
{
auto iter = std::find_if(store_columns.begin(), store_columns.end(), [&](const ColumnDefine & cd) { return cd.id == handle_id; });
return std::make_shared<DecodingStorageSchemaSnapshot>(std::make_shared<ColumnDefines>(store_columns), table_info, *iter);
return std::make_shared<DecodingStorageSchemaSnapshot>(std::make_shared<ColumnDefines>(store_columns), table_info, *iter, /* decoding_schema_version_ */1);
}
else
{
return std::make_shared<DecodingStorageSchemaSnapshot>(std::make_shared<ColumnDefines>(store_columns), table_info, store_columns[0]);
return std::make_shared<DecodingStorageSchemaSnapshot>(std::make_shared<ColumnDefines>(store_columns), table_info, store_columns[0], /* decoding_schema_version_ */1);
}
}

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 07356bc

Please sign in to comment.