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

update background pool #153

Merged
merged 4 commits into from
Aug 5, 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
4 changes: 2 additions & 2 deletions dbms/src/Storages/Transaction/RegionBlockReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ std::tuple<Block, bool> readRegionBlock(const TiDB::TableInfo & table_info,

std::unordered_set<ColumnID> col_id_included;

const size_t target_row_size = (!table_info.pk_is_handle ? table_info.columns.size() : table_info.columns.size() - 1) * 2;
const size_t target_col_size = (!table_info.pk_is_handle ? table_info.columns.size() : table_info.columns.size() - 1) * 2;

for (const auto & [handle, write_type, commit_ts, value] : data_list)
{
Expand Down Expand Up @@ -208,7 +208,7 @@ std::tuple<Block, bool> readRegionBlock(const TiDB::TableInfo & table_info,
}
}

if (row.size() != target_row_size)
if (row.size() != target_col_size)
throw Exception("decode row error.", ErrorCodes::LOGICAL_ERROR);

/// Transform `row` to columnar format.
Expand Down
24 changes: 13 additions & 11 deletions dbms/src/Storages/Transaction/SchemaSyncService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ namespace DB
SchemaSyncService::SchemaSyncService(DB::Context & context_)
: context(context_), background_pool(context_.getBackgroundPool()), log(&Logger::get("SchemaSyncService"))
{
handle = background_pool.addTask([&, this] {
try
{
return context.getTMTContext().getSchemaSyncer()->syncSchemas(context);
}
catch (const Exception & e)
{
LOG_WARNING(log, "Schema sync failed by " << e.message());
}
return false;
});
handle = background_pool.addTask(
[&, this] {
try
{
return context.getTMTContext().getSchemaSyncer()->syncSchemas(context);
}
catch (const Exception & e)
{
LOG_WARNING(log, "Schema sync failed by " << e.message());
}
return false;
},
false);
}

SchemaSyncService::~SchemaSyncService() { background_pool.removeTask(handle); }
Expand Down