Skip to content

Commit

Permalink
*: Fix compile error under clang-17 (#8291)
Browse files Browse the repository at this point in the history
ref #6233
  • Loading branch information
JaySon-Huang authored Nov 3, 2023
1 parent f4b5154 commit d6acb6e
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 234 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TiFlash devcontainer

```
# Start a docker for devcontainer
devcontainer up --workspace-folder=..
# Then you can use the toolchain in the devcontainer to
# build the TiFlash binary
make dev
make test
# or
make release
```
139 changes: 22 additions & 117 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# Mac OS
.DS_Store

# emacs files
*~
*\#
.tramp_history

# Netbeans project files
nbproject/*

# JetBrains project files
.idea

# Microsoft Visual Studio Code
.vscode
# vscode clangd cache
.cache

# ignore sublime project files
*.sublime-*

# CCACHE
ccache.tar
.ccache/

# JSON Compilation Database Format Specification
# https://clang.llvm.org/docs/JSONCompilationDatabase.html
compile_commands.json
Expand All @@ -16,29 +34,9 @@ compile_commands.json
# vim cache files
*.swp

# auto generated files
*.logrt

/build
/build-debug
/build-release
/docs/en_single_page/
/docs/ru_single_page/
/docs/venv/

# callgrind files
callgrind.out.*

# ignore kdevelop files
*.kdev4
*.kdev_include_paths

# ignore sublime project files
*.sublime-*

# Qt Creator files
*.user

# ignore perf output
*/perf.data

Expand All @@ -51,71 +49,14 @@ CTestTestfile.cmake
*.a
*.o
cmake-build-*
/build
/build-debug
/build-release

# Python cache
*.pyc
__pycache__

# ignore generated files
*-metrika-yandex

test.cpp
dbms/src/Common/tests/arena_with_free_lists
dbms/src/Common/tests/auto_array
dbms/src/Common/tests/compact_array
dbms/src/Common/tests/hash_table
dbms/src/Common/tests/hashes_test
dbms/src/Common/tests/int_hashes_perf
dbms/src/Common/tests/lru_cache
dbms/src/Common/tests/parallel_aggregation
dbms/src/Common/tests/parallel_aggregation2
dbms/src/Common/tests/radix_sort
dbms/src/Common/tests/shell_command_test
dbms/src/Common/tests/simple_cache
dbms/src/Common/tests/sip_hash
dbms/src/Common/tests/sip_hash_perf
dbms/src/Common/tests/small_table
dbms/src/Core/tests/exception
dbms/src/Core/tests/field
dbms/src/Core/tests/rvo_test
dbms/src/Core/tests/string_pool
dbms/src/DataTypes/tests/data_type_string
dbms/src/DataTypes/tests/data_types_number_fixed
dbms/src/IO/tests/async_write
dbms/src/IO/tests/cached_compressed_read_buffer
dbms/src/IO/tests/compressed_buffer
dbms/src/IO/tests/hashing_read_buffer
dbms/src/IO/tests/hashing_write_buffer
dbms/src/IO/tests/io_and_exceptions
dbms/src/IO/tests/io_operators
dbms/src/IO/tests/mempbrk
dbms/src/IO/tests/o_direct_and_dirty_pages
dbms/src/IO/tests/parse_int_perf
dbms/src/IO/tests/parse_int_perf2
dbms/src/IO/tests/read_buffer
dbms/src/IO/tests/read_buffer_aio
dbms/src/IO/tests/read_buffer_perf
dbms/src/IO/tests/read_escaped_string
dbms/src/IO/tests/read_float_perf
dbms/src/IO/tests/read_write_int
dbms/src/IO/tests/valid_utf8
dbms/src/IO/tests/valid_utf8_perf
dbms/src/IO/tests/var_uint
dbms/src/IO/tests/write_buffer
dbms/src/IO/tests/write_buffer_aio
dbms/src/IO/tests/write_buffer_perf
dbms/src/Parsers/tests/create_parser
dbms/src/Parsers/tests/select_parser
dbms/src/Storages/tests/hit_log
dbms/src/Storages/tests/seek_speed_test

dbms/src/Server/data/*
dbms/src/Server/metadata/*
dbms/src/Server/status
config-9001.xml

*-preprocessed.xml

core
!core/
vgcore*
Expand All @@ -130,50 +71,18 @@ debian/*.debhelper.log
debian/*.debhelper
debian/*.substvars

*.bin
*.mrk

.dupload.conf

# Netbeans project files
nbproject/*

# JetBrains project files
.idea

# Microsoft Visual Studio Code
.vscode

config-preprocessed.xml

# Protobuf
*.pb.cc
*.pb.cpp
*.pb.h

# Mac OS
.DS_Store

# Ignore symlink to private repository
/private

# Gulp dependencies used to minify website
node_modules
public
website/docs
website/presentations

# TiCS built and test files
build_docker
docker/builder/tics
# TiFlash built and test files
release-centos7/tiflash
release-centos7/build-release
release-darwin/tiflash
release-darwin/build-release
libs/libtiflash-proxy

tmp/

tests/fullstack-test2/auto_gen
tests/docker/data
tests/docker/log
Expand All @@ -183,7 +92,3 @@ CoverageReport
# installation and sysroot path
release-centos7-llvm/tiflash
release-centos7-llvm/build-release

# CCACHE
ccache.tar
.ccache/
28 changes: 13 additions & 15 deletions check_grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,29 @@ def main():
return 1

infile = sys.argv[1]
dashboard = json.load(open(infile))
j = json.load(open(infile))
panels = j['panels']
existing_ids = {}

ok = True

time_range_define = dashboard['time']
if time_range_define["from"] != "now-1h" or time_range_define["to"] != "now":
logging.error("Found time range changed! {}".format(time_range_define))
if j["title"] != "Test-Cluster-TiFlash-Summary":
ok = False

title = dashboard["title"]
if title != 'Test-Cluster-TiFlash-Summary':
logging.error("Found title changed! {}".format(title))
logging.error("key={} actual={}".format("title", j["title"]))
if j["uid"] != "SVbh2xUWk":
ok = False

uid = dashboard["uid"]
if uid != 'SVbh2xUWk':
logging.error("Found uid changed! {}".format(uid))
logging.error("key={} actual={}".format("uid", j["uid"]))
if j["__inputs"][0]["name"] != "DS_TEST-CLUSTER" or j["__inputs"][0]["label"] != "Test-Cluster":
ok = False
logging.error("key={} actual={}".format("__inputs", j["__inputs"]))

panels = dashboard['panels']
existing_ids = {}
for panel in panels:
ok &= handle_panel(panel, dashboard["title"], existing_ids)
ok &= handle_panel(panel, j["title"], existing_ids)
if not ok:
logging.error("!!!Error detected!!!")
return 2
else:
logging.info("All checks passed")
return 0

def handle_panel(panel, parent_title, existing_ids):
Expand Down
2 changes: 2 additions & 0 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ if (USE_GM_SSL)
set (CMAKE_C_FLAGS "")
set (ENABLE_TESTS 0)
add_subdirectory (GmSSL)
target_no_warning(gmssl unused-value)
target_no_warning(gmssl implicit-function-declaration)
set (ENABLE_TESTS ${_save})
set (CMAKE_CXX_FLAGS ${save_CMAKE_CXX_FLAGS})
set (CMAKE_C_FLAGS ${save_CMAKE_C_FLAGS})
Expand Down
4 changes: 3 additions & 1 deletion dbms/src/Common/GRPCKickTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <Common/Logger.h>
#include <Common/grpcpp.h>

#include <magic_enum.hpp>

namespace DB
{

Expand Down Expand Up @@ -70,7 +72,7 @@ class GRPCKickTag : public grpc::internal::CompletionQueueTag
RUNTIME_ASSERT(
error == grpc_call_error::GRPC_CALL_OK,
"grpc_call_start_batch returns {} != GRPC_CALL_OK, memory of tag may leak",
error);
magic_enum::enum_name(error));
}

grpc_call * getCall() const { return call; }
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Common/RecycledAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RecycledAllocator : public boost::noncopyable

std::shared_ptr<char> createMemoryReference(char * addr, size_t size)
{
return std::shared_ptr<char>(addr, [=](char * a) { arena.free(a, size); });
return std::shared_ptr<char>(addr, [=, this](char * a) { arena.free(a, size); });
}

private:
Expand Down
4 changes: 3 additions & 1 deletion dbms/src/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,10 @@ class Server::TcpHttpServersHolder
LOG_INFO(log, "tcp_port_secure is closed because tls config is set");
}

// No TCP server is normal now because we only enable the TCP server
// under testing deployment
if (servers.empty())
LOG_WARNING(log, "No TCP and HTTP servers are created");
LOG_INFO(log, "No TCP server is created");
}
catch (const Poco::Net::NetException & e)
{
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/DeltaMerge/DeltaMergeDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ struct fmt::formatter<DB::DM::ColumnDefine>
auto format(const DB::DM::ColumnDefine & cd, FormatContext & ctx) const -> decltype(ctx.out())
{
// Use '/' as separators because column names often have '_'.
return format_to(ctx.out(), "{}/{}/{}", cd.id, cd.name, cd.type->getName());
return fmt::format_to(ctx.out(), "{}/{}/{}", cd.id, cd.name, cd.type->getName());
}
};
};
2 changes: 1 addition & 1 deletion dbms/src/Storages/DeltaMerge/Remote/DataStore/DataStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct fmt::formatter<DB::DM::Remote::RemoteGCThreshold>
template <typename FormatContext>
auto format(const DB::DM::Remote::RemoteGCThreshold & v, FormatContext & ctx) const -> decltype(ctx.out())
{
return format_to(
return fmt::format_to(
ctx.out(),
"RemoteGCThreshold{{min_age={} min_file_threshold={} valid_rate={:2.2f}%}}",
v.min_age_seconds,
Expand Down
8 changes: 6 additions & 2 deletions dbms/src/Storages/DeltaMerge/Remote/DisaggTaskId.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ struct fmt::formatter<DB::DM::DisaggTaskId>
auto format(const DB::DM::DisaggTaskId & task_id, FormatContext & ctx) const -> decltype(ctx.out())
{
if (task_id.mpp_task_id.isUnknown())
return format_to(ctx.out(), "DisTaskId<N/A>");
return format_to(ctx.out(), "DisTaskId<{},executor={}>", task_id.mpp_task_id.toString(), task_id.executor_id);
return fmt::format_to(ctx.out(), "DisTaskId<N/A>");
return fmt::format_to(
ctx.out(),
"DisTaskId<{},executor={}>",
task_id.mpp_task_id.toString(),
task_id.executor_id);
}
};

Expand Down
8 changes: 4 additions & 4 deletions dbms/src/Storages/DeltaMerge/Remote/ObjectId.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ struct fmt::formatter<DB::DM::Remote::DMFileOID>
{
if (value.keyspace_id == DB::NullspaceID)
{
return format_to(ctx.out(), "{}_{}_{}", value.store_id, value.table_id, value.file_id);
return fmt::format_to(ctx.out(), "{}_{}_{}", value.store_id, value.table_id, value.file_id);
}
else
{
return format_to(
return fmt::format_to(
ctx.out(),
"{}_{}_{}_{}",
value.store_id,
Expand All @@ -80,11 +80,11 @@ struct fmt::formatter<DB::DM::Remote::PageOID>
{
if (value.ks_table_id.first == DB::NullspaceID)
{
return format_to(ctx.out(), "{}_{}_{}", value.store_id, value.ks_table_id.second, value.page_id);
return fmt::format_to(ctx.out(), "{}_{}_{}", value.store_id, value.ks_table_id.second, value.page_id);
}
else
{
return format_to(
return fmt::format_to(
ctx.out(),
"{}_{}_{}_{}",
value.store_id,
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Storages/DeltaMerge/SegmentReadTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct fmt::formatter<DB::DM::SegmentReadTaskPtr>
template <typename FormatContext>
auto format(const DB::DM::SegmentReadTaskPtr & t, FormatContext & ctx) const
{
return format_to(
return fmt::format_to(
ctx.out(),
"s{}_ks{}_t{}_{}_{}_{}",
t->store_id,
Expand All @@ -149,7 +149,7 @@ struct fmt::formatter<DB::DM::GlobalSegmentID>
template <typename FormatContext>
auto format(const DB::DM::GlobalSegmentID & t, FormatContext & ctx) const
{
return format_to(
return fmt::format_to(
ctx.out(),
"s{}_ks{}_t{}_{}_{}",
t.store_id,
Expand Down Expand Up @@ -183,4 +183,4 @@ struct std::equal_to<DB::DM::GlobalSegmentID>
return a.store_id == b.store_id && a.keyspace_id == b.keyspace_id && a.physical_table_id == b.physical_table_id
&& a.segment_id == b.segment_id && a.segment_epoch == b.segment_epoch;
}
};
};
Loading

0 comments on commit d6acb6e

Please sign in to comment.