diff --git a/storage/tianmu/async_tests/main.cc b/storage/tianmu/async_tests/main.cc index 83822afa9b..a67016080f 100644 --- a/storage/tianmu/async_tests/main.cc +++ b/storage/tianmu/async_tests/main.cc @@ -163,7 +163,7 @@ void TestSubmitRandom(std::shared_ptr task_executor) { ready_future.wait(); } -int main(int argc, char **argv) { +int main([[maybe_unused]]int argc,[[maybe_unused]] char **argv) { auto started = Tianmu::base::steady_clock_type::now(); std::shared_ptr task_executor(new core::TaskExecutor); std::future ready_future = task_executor->Init(std::thread::hardware_concurrency()); diff --git a/storage/tianmu/async_tests/task_executor.h b/storage/tianmu/async_tests/task_executor.h index c30ede7ad2..1753286cc1 100644 --- a/storage/tianmu/async_tests/task_executor.h +++ b/storage/tianmu/async_tests/task_executor.h @@ -66,7 +66,7 @@ class TaskExecutor { auto task = std::make_unique>(std::move(func)); auto ret = task->get_future(); AddTask(std::move(task)); - return std::move(ret); + return ret; } void Exit(); diff --git a/storage/tianmu/base/core/iostream_impl.h b/storage/tianmu/base/core/iostream_impl.h index 03736013b3..8f8759ec15 100644 --- a/storage/tianmu/base/core/iostream_impl.h +++ b/storage/tianmu/base/core/iostream_impl.h @@ -35,7 +35,7 @@ inline future> data_source_impl::skip(uint64_t n) { return get().then([&](temporary_buffer buffer) -> std::experimental::optional> { if (buffer.size() >= n) { buffer.trim_front(n); - return std::move(buffer); + return buffer; } n -= buffer.size(); return {}; diff --git a/storage/tianmu/base/core/sleep.h b/storage/tianmu/base/core/sleep.h index 3695a12b10..18d5210d5a 100644 --- a/storage/tianmu/base/core/sleep.h +++ b/storage/tianmu/base/core/sleep.h @@ -56,7 +56,7 @@ future<> sleep(std::chrono::duration dur) { class sleep_aborted : public std::exception { public: /// Reports the exception reason. - virtual const char *what() const noexcept { return "Sleep is aborted"; } + virtual const char *what() const noexcept override { return "Sleep is aborted"; } }; /// Returns a future which completes after a specified time has elapsed diff --git a/storage/tianmu/base/net/posix_stack.cpp b/storage/tianmu/base/net/posix_stack.cpp index 769c14d4ed..9db70a6baa 100644 --- a/storage/tianmu/base/net/posix_stack.cpp +++ b/storage/tianmu/base/net/posix_stack.cpp @@ -443,7 +443,7 @@ class posix_udp_channel : public udp_channel_impl { future<> posix_udp_channel::send(ipv4_addr dst, const char *message) { auto len = strlen(message); - return _fd->sendto(make_ipv4_address(dst), message, len).then([len](size_t size TIANMU_UNUSED) { + return _fd->sendto(make_ipv4_address(dst), message, len).then([len]([[maybe_unused]] size_t size) { assert(size == len); }); } diff --git a/storage/tianmu/common/compile_opts.h b/storage/tianmu/common/compile_opts.h index 3b76dd4c34..957fe4043c 100644 --- a/storage/tianmu/common/compile_opts.h +++ b/storage/tianmu/common/compile_opts.h @@ -20,16 +20,16 @@ namespace Tianmu { -#ifdef __clang__ +#if defined(__clang__) // in clang -#elif __GNUC__ +#elif defined(__GNUC__) // //__GNUC__ // major //__GNUC_MINOR__ // minor //__GNUC_PATCHLEVEL__ // patch // C++0x features // -#if (__GNUC__ > 4 && __GUNC__ < 7) || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) +#if (__GNUC__ > 4 && __GNUC__ < 7) || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are // passed on the command line, which in turn defines // __GXX_EXPERIMENTAL_CXX0X__. diff --git a/storage/tianmu/common/exception.h b/storage/tianmu/common/exception.h index eb9b614ad9..2a694116fc 100644 --- a/storage/tianmu/common/exception.h +++ b/storage/tianmu/common/exception.h @@ -67,6 +67,7 @@ class TIANMUError { TIANMUError(ErrorCode tianmu_error_code = ErrorCode::SUCCESS) : ec(tianmu_error_code) {} TIANMUError(ErrorCode tianmu_error_code, std::string message) : ec(tianmu_error_code), message(message) {} TIANMUError(const TIANMUError &tianmu_e) : ec(tianmu_e.ec), message(tianmu_e.message) {} + TIANMUError &operator=(const TIANMUError&) = default; operator ErrorCode() { return ec; } ErrorCode GetErrorCode() { return ec; } bool operator==(ErrorCode tianmu_ec) { return tianmu_ec == ec; } diff --git a/storage/tianmu/compress/text_compressor.cpp b/storage/tianmu/compress/text_compressor.cpp index 3bcd248679..dec37ea43e 100644 --- a/storage/tianmu/compress/text_compressor.cpp +++ b/storage/tianmu/compress/text_compressor.cpp @@ -424,7 +424,7 @@ CprsErr TextCompressor::CompressZlib(char *dest, int &dlen, char **index, const uint64_t destlen = dlen - pos; int ret = compress2(reinterpret_cast(dest + pos), &destlen, srcdata.get(), srclen, Z_DEFAULT_COMPRESSION); if (ret != Z_OK) { - TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %d, srclen %d, packlen %u", ret, destlen, srclen, + TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %lu, srclen %lu, packlen %u", ret, destlen, srclen, packlen); return CprsErr::CPRS_ERR_OTH; } @@ -442,7 +442,7 @@ CprsErr TextCompressor::DecompressZlib(char *dest, int dlen, char *src, int slen const int ret = uncompress(reinterpret_cast(dest), &destlen, reinterpret_cast(src + spos), srclen); if (ret != Z_OK) { - TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %d destlen = %d", ret, srclen, dlen); + TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %lu destlen = %d", ret, srclen, dlen); return CprsErr::CPRS_ERR_OTH; } size_t sumlen = 0; diff --git a/storage/tianmu/core/column.h b/storage/tianmu/core/column.h index b7d6731142..52960e93ab 100644 --- a/storage/tianmu/core/column.h +++ b/storage/tianmu/core/column.h @@ -36,7 +36,7 @@ class Column { Column(const Column &c) { if (this != &c) *this = c; } - + constexpr Column& operator=(const Column&) = default; inline const ColumnType &Type() const { return ct; } inline common::CT TypeName() const { return ct.GetTypeName(); } inline void SetTypeName(common::CT type) { ct.SetTypeName(type); } diff --git a/storage/tianmu/core/compiled_query.cpp b/storage/tianmu/core/compiled_query.cpp index c82b45eadf..3419ea5ed4 100644 --- a/storage/tianmu/core/compiled_query.cpp +++ b/storage/tianmu/core/compiled_query.cpp @@ -397,7 +397,7 @@ void CompiledQuery::CQStep::Print(Query *query) { std::sprintf(buf, "RESULT(T:%d)", N(t1.n)); break; default: - std::sprintf(buf, "Unsupported type of CQStep: %d", type); + std::sprintf(buf, "Unsupported type of CQStep: %d", static_cast(type)); } TIANMU_LOG(LogCtl_Level::DEBUG, "%s", buf); } diff --git a/storage/tianmu/core/engine.cpp b/storage/tianmu/core/engine.cpp index df30d83b17..7bb0bd3413 100644 --- a/storage/tianmu/core/engine.cpp +++ b/storage/tianmu/core/engine.cpp @@ -103,7 +103,7 @@ fs::path Engine::GetNextDataDir() { auto si = fs::space(s); auto usage = 100 - ((si.available * 100) / si.capacity); if (usage > static_cast(tianmu_sysvar_disk_usage_threshold)) { - TIANMU_LOG(LogCtl_Level::WARN, "disk %s usage %d%%", s.native().c_str(), usage); + TIANMU_LOG(LogCtl_Level::WARN, "disk %s usage %lu%%", s.native().c_str(), usage); return true; } return false; @@ -259,8 +259,8 @@ int Engine::Init(uint engine_slot) { []() { TIANMU_LOG( LogCtl_Level::INFO, - "Memory: release [%llu %llu %llu %llu] %llu, total " - "%llu. (un)freeable %lu/%lu, total alloc/free " + "Memory: release [%llu %llu %llu %llu] %lu, total " + "%lu. (un)freeable %lu/%lu, total alloc/free " "%lu/%lu", mm::TraceableObject::Instance()->getReleaseCount1(), mm::TraceableObject::Instance()->getReleaseCount2(), mm::TraceableObject::Instance()->getReleaseCount3(), mm::TraceableObject::Instance()->getReleaseCount4(), @@ -318,7 +318,7 @@ void Engine::HandleDeferredJobs() { fs::remove(t.file, ec); // Ignore ENOENT since files might be deleted by 'drop table'. if (ec && ec != std::errc::no_such_file_or_directory) { - TIANMU_LOG(LogCtl_Level::ERROR, "Failed to remove file %s Error:%s", t.file.string().c_str(), ec.message()); + TIANMU_LOG(LogCtl_Level::ERROR, "Failed to remove file %s Error:%s", t.file.string().c_str(), ec.message().c_str()); } } else { gc_tasks.emplace_back(t); @@ -589,7 +589,7 @@ std::shared_ptr Engine::GetTableOption(const std::string &table, TA int power = has_pack(form->s->comment); if (power < 5 || power > 16) { - TIANMU_LOG(LogCtl_Level::ERROR, "create table comment: pack size shift(%d) should be >=5 and <= 16"); + TIANMU_LOG(LogCtl_Level::ERROR, "create table comment: pack size shift(%d) should be >=5 and <= 16",power); throw common::SyntaxException("Unexpected data pack size."); } @@ -967,7 +967,7 @@ int get_parameter(THD *thd, enum tianmu_var_name vn, double &value) { return 0; } -int get_parameter(THD *thd, enum tianmu_var_name vn, int64_t &value) { +int get_parameter(THD *thd, enum tianmu_var_name vn, [[maybe_unused]] int64_t &value) { std::string var_data = get_parameter_name(vn); // stonedb8 start bool null_val; diff --git a/storage/tianmu/core/engine_results.cpp b/storage/tianmu/core/engine_results.cpp index 864cf7b285..81d28d0a33 100644 --- a/storage/tianmu/core/engine_results.cpp +++ b/storage/tianmu/core/engine_results.cpp @@ -156,18 +156,15 @@ void scan_fields(mem_root_deque &fields, uint *&buf_lens, std::map mem_root_deque void restore_fields(mem_root_deque &fields, std::map &items_backup) { // nothing to restore if (items_backup.size() == 0) { return; } - Item *item; int count = 0; - for (auto it = fields.begin(); it != fields.end(); ++it) { // stonedb8 - item = *it; - if (items_backup.find(count) != items_backup.end()) fields[count] = items_backup[count]; // stonedb8 + for (auto it = fields.begin(); it != fields.end(); ++it) { + if (items_backup.find(count) != items_backup.end()) fields[count] = items_backup[count]; count++; } } @@ -381,7 +378,7 @@ void ResultSender::Finalize(TempTable *result_table) { << "\tClientPort:" << thd->peer_port << "\tUser:" << sctx.user().str << global_serverinfo_ << "\tAffectRows:" << affect_rows << "\tResultRows:" << rows_sent << "\tDBName:" << thd->db().str << "\tCosttime(ms):" << cost_time << "\tSQL:" << thd->query().str << system::unlock; - TIANMU_LOG(LogCtl_Level::DEBUG, "Result: %" PRId64 " Costtime(ms): %" PRId64, rows_sent, cost_time); + TIANMU_LOG(LogCtl_Level::DEBUG, "Result: %ld Costtime(ms): %llu", rows_sent, cost_time); } void ResultSender::CleanUp() { restore_fields(fields, items_backup); } diff --git a/storage/tianmu/core/groupby_wrapper.cpp b/storage/tianmu/core/groupby_wrapper.cpp index ad5cd879b7..eadd288380 100644 --- a/storage/tianmu/core/groupby_wrapper.cpp +++ b/storage/tianmu/core/groupby_wrapper.cpp @@ -242,7 +242,7 @@ void GroupByWrapper::AddAggregatedColumn(int orig_attr_no, TempTable::Attr &a, i TIANMU_LOG(LogCtl_Level::DEBUG, "attr_no %d, input_mode[attr_no] %d, a.alias %s, a.si.separator " "%s, direction %d, ag_type %d, ag_size %d", - attr_no, input_mode[attr_no], a.alias, a.si.separator.c_str(), a.si.order, ag_type, ag_size); + attr_no, static_cast(input_mode[attr_no]), a.alias, a.si.separator.c_str(), a.si.order,static_cast(ag_type), ag_size); gt.AddAggregatedColumn(virt_col[attr_no], ag_oper, ag_distinct, ag_type, ag_size, ag_prec, ag_collation, a.si); // note: size will be automatically calculated for all numericals diff --git a/storage/tianmu/core/index_table.cpp b/storage/tianmu/core/index_table.cpp index 901492777e..422700b0fa 100644 --- a/storage/tianmu/core/index_table.cpp +++ b/storage/tianmu/core/index_table.cpp @@ -49,7 +49,7 @@ IndexTable::IndexTable(int64_t _size, int64_t _orig_size, [[maybe_unused]] int m buf = (unsigned char *)alloc(buffer_size_in_bytes, mm::BLOCK_TYPE::BLOCK_TEMPORARY, true); if (!buf) { Unlock(); - TIANMU_LOG(LogCtl_Level::ERROR, "Could not allocate memory for IndexTable, size :%u", buffer_size_in_bytes); + TIANMU_LOG(LogCtl_Level::ERROR, "Could not allocate memory for IndexTable, size :%lu", buffer_size_in_bytes); throw common::OutOfMemoryException(); } std::memset(buf, 0, buffer_size_in_bytes); diff --git a/storage/tianmu/core/item_tianmu_field.h b/storage/tianmu/core/item_tianmu_field.h index 2dfcadb7d6..029327fc39 100644 --- a/storage/tianmu/core/item_tianmu_field.h +++ b/storage/tianmu/core/item_tianmu_field.h @@ -81,7 +81,7 @@ class Item_tianmufield : public Item_field { bool get_date(MYSQL_TIME *ltime, uint fuzzydate) override; bool get_date_result(MYSQL_TIME *ltime, uint fuzzydate) /*override*/ { return get_date(ltime, fuzzydate); } bool get_time(MYSQL_TIME *ltime) override; - bool get_timeval(struct my_timeval *tm, int *warnings) /*override*/; + bool get_timeval(struct my_timeval *tm, int *warnings) override; table_map used_tables() const override { return ifield->used_tables(); } enum Item_result result_type() const override { return was_aggregation ? aggregation_result : Item_field::result_type(); diff --git a/storage/tianmu/core/joiner.cpp b/storage/tianmu/core/joiner.cpp index 2863f77451..a7b542c997 100644 --- a/storage/tianmu/core/joiner.cpp +++ b/storage/tianmu/core/joiner.cpp @@ -40,7 +40,7 @@ TwoDimensionalJoiner::~TwoDimensionalJoiner() { } JoinAlgType TwoDimensionalJoiner::ChooseJoinAlgorithm([[maybe_unused]] MultiIndex &mind, Condition &cond) { - auto choose_map_or_hash = ([&tianmu_sysvar_force_hashjoin, &cond] { + auto choose_map_or_hash = ([&cond] { if ((!tianmu_sysvar_force_hashjoin) && (cond.Size() == 1)) return JoinAlgType::JTYPE_MAP; // available types checked inside diff --git a/storage/tianmu/core/joiner_hash.cpp b/storage/tianmu/core/joiner_hash.cpp index d04f74fc09..80adfde023 100644 --- a/storage/tianmu/core/joiner_hash.cpp +++ b/storage/tianmu/core/joiner_hash.cpp @@ -695,7 +695,7 @@ int64_t JoinerHash::NewMatchDim(MINewContents *new_mind1, MIUpdatingIterator *ta } } if (no_of_matching_rows > 65536 || no_of_matching_rows < 0) - TIANMU_LOG(LogCtl_Level::DEBUG, "no_of_matching_rows %d", no_of_matching_rows); + TIANMU_LOG(LogCtl_Level::DEBUG, "no_of_matching_rows %ld", no_of_matching_rows); joined_tuples += no_of_matching_rows; omit_this_packrow = true; } @@ -771,7 +771,7 @@ int64_t JoinerHash::NewMatchDim(MINewContents *new_mind1, MIUpdatingIterator *ta matching_row++; } if (outer_nulls_only) joined_tuples = 0; // outer tuples added later - TIANMU_LOG(LogCtl_Level::DEBUG, "JoinerHash::test %d,matching_row %d", joined_tuples, matching_row); + TIANMU_LOG(LogCtl_Level::DEBUG, "JoinerHash::test %ld,matching_row %ld", joined_tuples, matching_row); *join_tuple = joined_tuples; return joined_tuples; } diff --git a/storage/tianmu/core/joiner_mapped.cpp b/storage/tianmu/core/joiner_mapped.cpp index dcb134dc37..981bd4fb34 100644 --- a/storage/tianmu/core/joiner_mapped.cpp +++ b/storage/tianmu/core/joiner_mapped.cpp @@ -209,7 +209,7 @@ std::unique_ptr JoinerMapped::GenerateFunction(vcolumn::Virtu rc_control_.lock(m_conn->GetThreadID()) << "Join mapping (multimaps) created on " << mit.NumOfTuples() << " rows." << system::unlock; - return std::move(map_function); + return map_function; } int64_t JoinerParallelMapped::ExecuteMatchLoop(std::shared_ptr *indextable, diff --git a/storage/tianmu/core/mi_iterator.h b/storage/tianmu/core/mi_iterator.h index 2c45867eb6..369ecf8e5a 100644 --- a/storage/tianmu/core/mi_iterator.h +++ b/storage/tianmu/core/mi_iterator.h @@ -348,6 +348,7 @@ class MIInpackIterator : public MIIterator { public: MIInpackIterator(const MIIterator &sec) : MIIterator(sec) {} MIInpackIterator() : MIIterator() {} + MIInpackIterator(const MIInpackIterator&) = default ; void swap(MIInpackIterator &i); MIInpackIterator &operator=(const MIInpackIterator &m) { MIInpackIterator tmp(m); diff --git a/storage/tianmu/core/mysql_expression.cpp b/storage/tianmu/core/mysql_expression.cpp index 31cc748287..50da48a1d4 100644 --- a/storage/tianmu/core/mysql_expression.cpp +++ b/storage/tianmu/core/mysql_expression.cpp @@ -432,6 +432,9 @@ DataType MysqlExpression::EvalType(TypOfVars *tv) { case ROW_RESULT: DEBUG_ASSERT(0 && "unexpected type: ROW_RESULT"); break; + default: + DEBUG_ASSERT(0 && "unexpected type: INVALID_RESULT"); + break; } return type; } diff --git a/storage/tianmu/core/proxy_hash_joiner.cpp b/storage/tianmu/core/proxy_hash_joiner.cpp index e53de06400..e689097914 100644 --- a/storage/tianmu/core/proxy_hash_joiner.cpp +++ b/storage/tianmu/core/proxy_hash_joiner.cpp @@ -127,7 +127,7 @@ class MIIteratorPoller { no_more_ = true; } - return std::move(pack_iter); + return pack_iter; } private: diff --git a/storage/tianmu/core/rc_table.cpp b/storage/tianmu/core/rc_table.cpp index 9a3d877a63..bec55cb46e 100644 --- a/storage/tianmu/core/rc_table.cpp +++ b/storage/tianmu/core/rc_table.cpp @@ -711,7 +711,7 @@ int RCTable::Insert(TABLE *table) { } if (tab->InsertIndex(current_txn_, fields, NumOfObj()) == common::ErrorCode::DUPP_KEY) { - TIANMU_LOG(LogCtl_Level::INFO, "Insert duplicate key on row %d", NumOfObj() - 1); + TIANMU_LOG(LogCtl_Level::INFO, "Insert duplicate key on row %ld", NumOfObj() - 1); return HA_ERR_FOUND_DUPP_KEY; } } diff --git a/storage/tianmu/core/rcattr_exqp.cpp b/storage/tianmu/core/rcattr_exqp.cpp index d162daa8a8..9cfc532f3b 100644 --- a/storage/tianmu/core/rcattr_exqp.cpp +++ b/storage/tianmu/core/rcattr_exqp.cpp @@ -144,7 +144,7 @@ common::ErrorCode RCAttr::EvaluateOnIndex_BetweenInt(MIUpdatingIterator &mit, in ++iter; } else { - TIANMU_LOG(LogCtl_Level::ERROR, "GetCurKV valid! col:[%u]=%I64d, Path:%s", ColId(), pv1, + TIANMU_LOG(LogCtl_Level::ERROR, "GetCurKV valid! col:[%u]=%ld, Path:%s", ColId(), pv1, m_share->owner->Path().data()); break; } diff --git a/storage/tianmu/core/sorter3.cpp b/storage/tianmu/core/sorter3.cpp index a35d222f3d..fdc3b12c0a 100644 --- a/storage/tianmu/core/sorter3.cpp +++ b/storage/tianmu/core/sorter3.cpp @@ -475,13 +475,13 @@ bool SorterLimit::PutValue(Sorter3 *s) { // not called uint tmp_noobj = sl->GetObjNo(); unsigned char *buf1 = sl->Getbuf(); - TIANMU_LOG(LogCtl_Level::DEBUG, "PutValue: total bytes %d, tmp_noobj %ld ", total_bytes, tmp_noobj); + TIANMU_LOG(LogCtl_Level::DEBUG, "PutValue: total bytes %d, tmp_noobj %u ", total_bytes, tmp_noobj); if (tmp_noobj) { if (no_obj + tmp_noobj <= size) { std::memcpy(buf + no_obj * total_bytes, buf1, tmp_noobj * total_bytes); no_obj += tmp_noobj; - TIANMU_LOG(LogCtl_Level::DEBUG, "PutValue: no_obj %ld, tmp_noobj %ld, total_bytes %ld buf %s", no_obj, tmp_noobj, + TIANMU_LOG(LogCtl_Level::DEBUG, "PutValue: no_obj %u, tmp_noobj %u, total_bytes %u buf %s", no_obj, tmp_noobj, total_bytes, buf); } else { TIANMU_LOG(LogCtl_Level::ERROR, "error in Putvalue, out of boundary size %d no_obj+tmp_noobj %d", size, @@ -493,4 +493,4 @@ bool SorterLimit::PutValue(Sorter3 *s) { return true; } } // namespace core -} // namespace Tianmu \ No newline at end of file +} // namespace Tianmu diff --git a/storage/tianmu/core/sorter_wrapper.cpp b/storage/tianmu/core/sorter_wrapper.cpp index 142197abe4..c39131637f 100644 --- a/storage/tianmu/core/sorter_wrapper.cpp +++ b/storage/tianmu/core/sorter_wrapper.cpp @@ -232,7 +232,7 @@ bool SorterWrapper::InitPackrow(MIIterator &mit) // return true if the packrow } } - TIANMU_LOG(LogCtl_Level::DEBUG, "InitPackrow: no_values_encoded %d, begin to loadpacks scol size %d ", + TIANMU_LOG(LogCtl_Level::DEBUG, "InitPackrow: no_values_encoded %ld, begin to loadpacks scol size %lu ", no_values_encoded, scol.size()); // Not excluded: lock packs if (!ha_rcengine_->query_thread_pool.is_owner()) { @@ -264,7 +264,7 @@ bool SorterWrapper::PutValues(MIIterator &mit) { bool SorterWrapper::PutValues(SorterWrapper &sw) { if (s == NULL) return false; // trivial sorter (constant values) no_values_encoded += sw.GetEncodedValNum(); - TIANMU_LOG(LogCtl_Level::DEBUG, "PutValues: no_values_encoded %d \n", no_values_encoded); + TIANMU_LOG(LogCtl_Level::DEBUG, "PutValues: no_values_encoded %lu \n", no_values_encoded); return s->PutValue(sw.GetSorter()); } diff --git a/storage/tianmu/core/task_executor.h b/storage/tianmu/core/task_executor.h index c30ede7ad2..1753286cc1 100644 --- a/storage/tianmu/core/task_executor.h +++ b/storage/tianmu/core/task_executor.h @@ -66,7 +66,7 @@ class TaskExecutor { auto task = std::make_unique>(std::move(func)); auto ret = task->get_future(); AddTask(std::move(task)); - return std::move(ret); + return ret; } void Exit(); diff --git a/storage/tianmu/core/temp_table.h b/storage/tianmu/core/temp_table.h index f8cc445a47..2fd45800a5 100644 --- a/storage/tianmu/core/temp_table.h +++ b/storage/tianmu/core/temp_table.h @@ -112,11 +112,11 @@ class TempTable : public JustATable { uint64_t ExactDistinctVals([[maybe_unused]] Filter *f) override { return common::NULL_VALUE_64; } bool IsDistinct([[maybe_unused]] Filter *f) override { return false; } size_t MaxStringSize(Filter *f = NULL) override; // maximal byte string length in column - int64_t RoughMin(Filter *f = NULL, common::RSValue *rf = NULL) override { + int64_t RoughMin([[maybe_unused]] Filter *f = NULL, [[maybe_unused]] common::RSValue *rf = NULL) override { return common::MINUS_INF_64; } // for numerical: best rough approximation of min for a given filter (or // global min if filter is NULL) - int64_t RoughMax(Filter *f = NULL, common::RSValue *rf = NULL) override { + int64_t RoughMax( [[maybe_unused]] Filter *f = NULL,[[maybe_unused]] common::RSValue *rf = NULL) override { return common::PLUS_INF_64; } // for numerical: best rough approximation of max for a given filter (or // global max if filter is NULL) @@ -265,10 +265,10 @@ class TempTable : public JustATable { bool IsNull(int64_t obj, int attr) override; // return true if the value of attr. is null - int64_t RoughMin([[maybe_unused]] int n_a, Filter *f = NULL) { return common::MINUS_INF_64; } - int64_t RoughMax([[maybe_unused]] int n_a, Filter *f = NULL) { return common::PLUS_INF_64; } + int64_t RoughMin([[maybe_unused]] int n_a, [[maybe_unused]] Filter *f = NULL) { return common::MINUS_INF_64; } + int64_t RoughMax([[maybe_unused]] int n_a, [[maybe_unused]] Filter *f = NULL) { return common::PLUS_INF_64; } - uint MaxStringSize(int n_a, Filter *f = NULL) override { + uint MaxStringSize(int n_a, [[maybe_unused]] Filter *f = NULL) override { if (n_a < 0) return GetFieldSize(-n_a - 1); return GetFieldSize(n_a); } diff --git a/storage/tianmu/core/temp_table_low.cpp b/storage/tianmu/core/temp_table_low.cpp index 485d8367fa..19bbbde977 100644 --- a/storage/tianmu/core/temp_table_low.cpp +++ b/storage/tianmu/core/temp_table_low.cpp @@ -220,7 +220,7 @@ bool TempTable::OrderByAndMaterialize(std::vector &ord, int64_t } TIANMU_LOG(LogCtl_Level::DEBUG, - "SortTable preparation done. row num %d, offset %d, limit %d, " + "SortTable preparation done. row num %ld, offset %ld, limit %ld, " "task_num %d", local_row, offset, limit, task_num); @@ -552,7 +552,7 @@ size_t TempTable::TaskPutValueInST(MIIterator *it, Transaction *ci, SorterWrappe local_row += it->GetPackSizeLeft(); it->NextPackrow(); - TIANMU_LOG(LogCtl_Level::DEBUG, "skip this pack it %x", it); + TIANMU_LOG(LogCtl_Level::DEBUG, "skip this pack it: %p", it); continue; } } diff --git a/storage/tianmu/core/tools.h b/storage/tianmu/core/tools.h index 54a3e5a319..27385f82f9 100644 --- a/storage/tianmu/core/tools.h +++ b/storage/tianmu/core/tools.h @@ -166,6 +166,7 @@ class TOCoordinate { co.pack = _t.co.pack; co.rcattr = _t.co.rcattr; } + constexpr TOCoordinate& operator=(const TOCoordinate&) = default; bool operator==(TOCoordinate const &oid) const { if (oid.ID != ID) return false; @@ -304,4 +305,4 @@ extern LockProfiler lock_profiler; } // namespace core } // namespace Tianmu -#endif // TIANMU_CORE_TOOLS_H_ \ No newline at end of file +#endif // TIANMU_CORE_TOOLS_H_ diff --git a/storage/tianmu/exporter/export2file.cpp b/storage/tianmu/exporter/export2file.cpp index a73d8201a5..15d8457d3f 100644 --- a/storage/tianmu/exporter/export2file.cpp +++ b/storage/tianmu/exporter/export2file.cpp @@ -60,8 +60,8 @@ void select_tianmu_export::SetRowCount(ha_rows x) { row_count = x; } void select_tianmu_export::SendOk(THD *thd) { ::my_ok(thd, row_count); } sql_exchange *select_tianmu_export::SqlExchange() { return exchange; } -// stonedb8 -bool select_tianmu_export::send_data(THD *thd, mem_root_deque &items) { return se->send_data(thd, items); } + +bool select_tianmu_export::send_data(THD *thd, const mem_root_deque &items) { return se->send_data(thd, items); } } // namespace exporter } // namespace Tianmu diff --git a/storage/tianmu/exporter/export2file.h b/storage/tianmu/exporter/export2file.h index ca7bea4d9f..fa84db4824 100644 --- a/storage/tianmu/exporter/export2file.h +++ b/storage/tianmu/exporter/export2file.h @@ -34,7 +34,7 @@ class select_tianmu_export : public Query_result_export { void SendOk(THD *thd); sql_exchange *SqlExchange(); bool IsPrepared() const { return prepared; } - bool send_data(THD *thd, mem_root_deque &items) /*override*/; // stonedb8 + bool send_data(THD *thd, const mem_root_deque &items) override; private: Query_result_export *se; diff --git a/storage/tianmu/handler/ha_tianmu.cpp b/storage/tianmu/handler/ha_tianmu.cpp index 1ab2e41561..d7ae3ce497 100644 --- a/storage/tianmu/handler/ha_tianmu.cpp +++ b/storage/tianmu/handler/ha_tianmu.cpp @@ -429,7 +429,7 @@ int TianmuHandler::write_row([[maybe_unused]] uchar *buf) { TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in Engine::InsertRow: %s.", e.what()); my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), e.what(), MYF(0)); } catch (common::FormatException &e) { - TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in Engine::InsertRow: %s Row: %ld, field %u.", e.what(), + TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in Engine::InsertRow: %s Row: %llu, field %u.", e.what(), e.m_row_no, e.m_field_no); my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), e.what(), MYF(0)); } catch (common::FileException &e) { @@ -1088,7 +1088,7 @@ int TianmuHandler::rnd_pos(uchar *buf, uchar *pos) { the storage engine. The myisam engine implements the most hints. ha_innodb.cc has the most exhaustive list of these hints. */ -int TianmuHandler::extra(enum ha_extra_function operation) { +int TianmuHandler::extra([[maybe_unused]] enum ha_extra_function operation) { DBUG_ENTER(__PRETTY_FUNCTION__); /* This preemptive delete might cause problems here. * Other place where it can be put is TianmuHandler::external_lock(). @@ -1495,7 +1495,7 @@ bool TianmuHandler::commit_inplace_alter_table(TABLE *altered_table [[maybe_unus return false; } if ((ha_alter_info->handler_flags & ~TIANMU_SUPPORTED_ALTER_ADD_DROP_ORDER)) { - TIANMU_LOG(LogCtl_Level::INFO, "Altered table not support type %lu", ha_alter_info->handler_flags); + TIANMU_LOG(LogCtl_Level::INFO, "Altered table not support type %llu", ha_alter_info->handler_flags); return true; } fs::path tmp_dir(m_table_name + ".tmp"); diff --git a/storage/tianmu/index/rc_table_index.cpp b/storage/tianmu/index/rc_table_index.cpp index 2ac6e37acd..955e7852d9 100644 --- a/storage/tianmu/index/rc_table_index.cpp +++ b/storage/tianmu/index/rc_table_index.cpp @@ -334,7 +334,7 @@ void KeyIterator::ScanToKey(std::shared_ptr tab, std::vectorValid() || !rdbkey_->covers_key(iter_->key())) valid = false; break; default: - TIANMU_LOG(LogCtl_Level::ERROR, "key not support this op:%d", op); + TIANMU_LOG(LogCtl_Level::ERROR, "key not support this op:%d", static_cast(op)); valid = false; break; } diff --git a/storage/tianmu/mm/tcm/tccommon.cpp b/storage/tianmu/mm/tcm/tccommon.cpp index 2f77a010a1..834f6f9c6d 100755 --- a/storage/tianmu/mm/tcm/tccommon.cpp +++ b/storage/tianmu/mm/tcm/tccommon.cpp @@ -124,7 +124,7 @@ void SizeMap::Init() { // Initialize the mapping arrays int next_size = 0; for (size_t c = 1; c < kNumClasses; c++) { - const int max_size_in_class = (const int)class_to_size_[c]; + int max_size_in_class = static_cast(class_to_size_[c]); for (int s = next_size; s <= max_size_in_class; s += kAlignment) { class_array_[ClassIndex(s)] = c; } diff --git a/storage/tianmu/system/rc_system.cpp b/storage/tianmu/system/rc_system.cpp index 0c1edf6658..c6984d16c1 100644 --- a/storage/tianmu/system/rc_system.cpp +++ b/storage/tianmu/system/rc_system.cpp @@ -31,7 +31,7 @@ system::Channel rc_querylog_(true); // global host ip addr. char global_hostIP_[FN_REFLEN]; // global server info. -char global_serverinfo_[FN_REFLEN]; +char global_serverinfo_[FN_REFLEN + FN_REFLEN + 512]; // key-value engine handler. core::Engine *ha_rcengine_ = nullptr; // key-value store handler. diff --git a/storage/tianmu/system/rc_system.h b/storage/tianmu/system/rc_system.h index 51b19a02e6..bbf9a12868 100644 --- a/storage/tianmu/system/rc_system.h +++ b/storage/tianmu/system/rc_system.h @@ -43,7 +43,7 @@ extern system::Channel rc_querylog_; // host ip addr. extern char global_hostIP_[FN_REFLEN]; // host server info string. -extern char global_serverinfo_[FN_REFLEN]; +extern char global_serverinfo_[FN_REFLEN + FN_REFLEN + 512]; // row-column engine handler. extern core::Engine *ha_rcengine_; diff --git a/storage/tianmu/types/rc_data_types.h b/storage/tianmu/types/rc_data_types.h index 94fe82e251..0d30b54e8c 100644 --- a/storage/tianmu/types/rc_data_types.h +++ b/storage/tianmu/types/rc_data_types.h @@ -128,6 +128,7 @@ enum class ValueTypeEnum { NULL_TYPE, DATE_TIME_TYPE, NUMERIC_TYPE, STRING_TYPE class RCDataType { public: RCDataType() : null(true) {} + constexpr RCDataType(const RCDataType&) = default; virtual ~RCDataType(); public: @@ -168,6 +169,8 @@ class RCDataType { template class ValueBasic : public RCDataType { public: + constexpr ValueBasic(const ValueBasic&) = default; + ValueBasic() = default; ValueTypeEnum GetValueType() const override { return T::value_type; } std::unique_ptr Clone() const override { return std::unique_ptr(new T(const_cast(reinterpret_cast(*this)))); diff --git a/storage/tianmu/util/log_ctl.cpp b/storage/tianmu/util/log_ctl.cpp index 00a5f6499f..e4ec34d90a 100644 --- a/storage/tianmu/util/log_ctl.cpp +++ b/storage/tianmu/util/log_ctl.cpp @@ -91,25 +91,3 @@ void LogCtl::LogMsg(logger::LogCtl_Level level, std::stringstream &msg_ss) { } } // namespace utils } // namespace Tianmu - -void tianmu_log(enum loglevel mysql_level, const char *buffer, [[maybe_unused]] size_t length) { - using namespace Tianmu; - logger::LogCtl_Level level; - - // mapping mysql log level to tianmu log level - switch (mysql_level) { - case ERROR_LEVEL: - level = logger::LogCtl_Level::ERROR; - break; - case WARNING_LEVEL: - level = logger::LogCtl_Level::WARN; - break; - case INFORMATION_LEVEL: - level = logger::LogCtl_Level::WARN; - break; - default: - level = logger::LogCtl_Level::ERROR; - break; - } - utils::LogCtl::LogMsg(level, "MYSQL", 0, buffer); -} diff --git a/storage/tianmu/util/log_ctl.h b/storage/tianmu/util/log_ctl.h index 1c44a41e52..6e5c0bb3f9 100644 --- a/storage/tianmu/util/log_ctl.h +++ b/storage/tianmu/util/log_ctl.h @@ -35,8 +35,8 @@ class LogCtl { static bool LogEnabled(logger::LogCtl_Level level); - static void LogMsg(logger::LogCtl_Level level, const char *format, ...); - static void LogMsg(logger::LogCtl_Level level, const char *file, int line, const char *format, ...); + static void LogMsg(logger::LogCtl_Level level, const char *format, ...) __attribute__((format(printf, 2, 3))); + static void LogMsg(logger::LogCtl_Level level, const char *file, int line, const char *format, ...) __attribute__((format(printf, 4, 5))); static void LogMsg(logger::LogCtl_Level level, const std::string &msg); static void LogMsg(logger::LogCtl_Level level, const char *file, int line, const std::string &msg); static void LogMsg(logger::LogCtl_Level level, std::stringstream &msg_ss); @@ -47,7 +47,6 @@ constexpr size_t MAX_LOG_LEN = 4096; // Tianmu logger API #define TIANMU_LOG(_level, ...) Tianmu::utils::LogCtl::LogMsg(logger::_level, __FILE__, __LINE__, ##__VA_ARGS__) - #define TIANMU_LOGCHECK(_level) (Tianmu::utils::LogCtl::LogEnabled(logger::_level)) #define LOG_MSG(_level, msg) Tianmu::utils::LogCtl::LogMsg(logger::_level, __FILE__, __LINE__, msg); diff --git a/storage/tianmu/vc/subselect_column.cpp b/storage/tianmu/vc/subselect_column.cpp index efe1d25e3d..da09b7f25f 100644 --- a/storage/tianmu/vc/subselect_column.cpp +++ b/storage/tianmu/vc/subselect_column.cpp @@ -104,7 +104,6 @@ SubSelectColumn::SubSelectColumn(const SubSelectColumn &c) var_buf_for_exact(), no_cached_values(c.no_cached_values), out_of_date_rough(c.out_of_date_rough) { - var_types.empty(); if (c.cache.get()) { cache = std::make_shared(*c.cache.get()); // core::ValueSet* vs = new core::ValueSet(*c.cache.get());