Skip to content

Commit

Permalink
Fix rough set test
Browse files Browse the repository at this point in the history
Signed-off-by: JaySon-Huang <[email protected]>
  • Loading branch information
JaySon-Huang committed Sep 6, 2022
1 parent abc7659 commit a457670
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 3 additions & 2 deletions dbms/src/Debug/dbgFuncMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ inline size_t getReadTSOForLog(const String & line)
{
std::regex rx(R"((0|[1-9][0-9]*))");
std::smatch m;
auto pos = line.find("read_tso=");
// Rely on that MPP task prefix "MPP<query:435802637197639681,task:1>"
auto pos = line.find("query:");
if (pos != std::string::npos && regex_search(line.cbegin() + pos, line.cend(), m, rx))
{
return std::stoul(m[1]);
Expand Down Expand Up @@ -61,7 +62,7 @@ void dbgFuncSearchLogForKey(Context & context, const ASTs & args, DBGInvoker::Pr
throw Exception("Args not matched, should be: key, thread_hint", ErrorCodes::BAD_ARGUMENTS);

auto key = safeGet<String>(typeid_cast<const ASTLiteral &>(*args[0]).value);
// the candidate line must be printed by a thread which also print a line contains `thread_hint`
// the candidate line must be printed by a thread which also print a line contains `tso_hint`
auto tso_hint = safeGet<String>(typeid_cast<const ASTLiteral &>(*args[1]).value);
auto log_path = context.getConfigRef().getString("logger.log");

Expand Down
13 changes: 5 additions & 8 deletions dbms/src/Storages/StorageDeltaMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <common/logger_useful.h>

#include <random>
#include "Common/Exception.h"

namespace DB
{
Expand Down Expand Up @@ -638,16 +639,12 @@ BlockInputStreams StorageDeltaMerge::read(
}

// Read with MVCC filtering
if (unlikely(!query_info.mvcc_query_info))
throw Exception("mvcc query info is null", ErrorCodes::LOGICAL_ERROR);

TMTContext & tmt = context.getTMTContext();
if (unlikely(!tmt.isInitialized()))
throw Exception("TMTContext is not initialized", ErrorCodes::LOGICAL_ERROR);
RUNTIME_CHECK(query_info.mvcc_query_info != nullptr);
RUNTIME_CHECK(tmt.isInitialized());

const auto & mvcc_query_info = *query_info.mvcc_query_info;
auto req_id = fmt::format("{} read_tso={}", query_info.req_id, mvcc_query_info.read_tso);
auto tracing_logger = Logger::get("StorageDeltaMerge", log->identifier(), req_id);
auto tracing_logger = Logger::get("StorageDeltaMerge", log->identifier(), query_info.req_id);

LOG_FMT_DEBUG(tracing_logger, "Read with tso: {}", mvcc_query_info.read_tso);

Expand Down Expand Up @@ -757,7 +754,7 @@ BlockInputStreams StorageDeltaMerge::read(
num_streams,
/*max_version=*/mvcc_query_info.read_tso,
rs_operator,
req_id,
query_info.req_id,
query_info.keep_order,
/* is_fast_scan */ query_info.is_fast_scan,
max_block_size,
Expand Down

0 comments on commit a457670

Please sign in to comment.