Skip to content

Commit

Permalink
AWS Lambda compatibility (#9)
Browse files Browse the repository at this point in the history
* PR_SET_NAME workaround

AWS Lambdas (and other virtualized platforms) lack of support for PR_SET_NAME causing a blocking exception. Pending an upstream PR or fix in ClickHouse, this patch allows this function to fail unharmed. The resulting executable has been tested on various platforms without drawbacks and discussed in clickhouse issue [29378](ClickHouse/ClickHouse#29378)

$ sed -i '/Cannot set thread name/c\' /ClickHouse/src/Common/setThreadName.cpp

* Disable AVX2 support
  • Loading branch information
lmangani authored and auxten committed Jun 6, 2024
1 parent 0e2d4c2 commit e42b87b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chdb/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ elif [ "$(uname)" == "Linux" ]; then
GLIBC_COMPATIBILITY="-DGLIBC_COMPATIBILITY=1"
UNWIND="-DUSE_UNWIND=1"
PYINIT_ENTRY="-Wl,-ePyInit_${CHDB_PY_MOD}"
AVX_SUPPORT="-DENABLE_AVX=1 -DENABLE_AVX2=1"
AVX_SUPPORT="-DENABLE_AVX=1 -DENABLE_AVX2=0"
EMBEDDED_COMPILER="-DENABLE_EMBEDDED_COMPILER=1"
else
echo "OS not supported"
Expand Down
4 changes: 2 additions & 2 deletions src/Common/setThreadName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void setThreadName(const char * name, bool truncate)
#else
if (0 != prctl(PR_SET_NAME, name_capped, 0, 0, 0))
#endif
if (errno != ENOSYS && errno != EPERM) /// It's ok if the syscall is unsupported or not allowed in some environments.
throw DB::ErrnoException(DB::ErrorCodes::PTHREAD_ERROR, "Cannot set thread name with prctl(PR_SET_NAME, ...)");
// if (errno != ENOSYS && errno != EPERM) /// It's ok if the syscall is unsupported or not allowed in some environments.
// throw DB::ErrnoException(DB::ErrorCodes::PTHREAD_ERROR, "Cannot set thread name with prctl(PR_SET_NAME, ...)");

memcpy(thread_name, name_capped, name_capped_len);
}
Expand Down

0 comments on commit e42b87b

Please sign in to comment.