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

Fix clang-cl build #9494

Merged
merged 2 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 4 additions & 0 deletions src/ray/gcs/asio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

#include "ray/util/logging.h"

extern "C" {
#include "hiredis/async.h"
}

RedisAsioClient::RedisAsioClient(boost::asio::io_service &io_service,
ray::gcs::RedisAsyncContext &redis_async_context)
: redis_async_context_(redis_async_context),
Expand Down
2 changes: 0 additions & 2 deletions src/ray/gcs/asio.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>

#include "hiredis/async.h"
#include "hiredis/hiredis.h"
#include "ray/gcs/redis_async_context.h"

class RedisAsioClient {
Expand Down
4 changes: 4 additions & 0 deletions src/ray/gcs/gcs_client/service_based_gcs_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include "ray/common/ray_config.h"
#include "ray/gcs/gcs_client/service_based_accessor.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace ray {
namespace gcs {

Expand Down
4 changes: 4 additions & 0 deletions src/ray/gcs/gcs_server/gcs_redis_failure_detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "gcs_redis_failure_detector.h"
#include "ray/common/ray_config.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace ray {
namespace gcs {

Expand Down
5 changes: 3 additions & 2 deletions src/ray/gcs/redis_async_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include "ray/common/status.h"

extern "C" {
#include "hiredis/async.h"
#include "hiredis/hiredis.h"
struct redisAsyncContext;
struct redisReply;
typedef void redisCallbackFn(struct redisAsyncContext *, void *, void *);
mehrdadn marked this conversation as resolved.
Show resolved Hide resolved
}

namespace ray {
Expand Down
4 changes: 4 additions & 0 deletions src/ray/gcs/redis_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include "ray/common/ray_config.h"
#include "ray/gcs/redis_context.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace ray {

namespace gcs {
Expand Down
4 changes: 4 additions & 0 deletions src/ray/gcs/redis_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ Status RedisContext::PublishAsync(const std::string &channel, const std::string
return RunArgvAsync(args, redisCallback);
}

void RedisContext::FreeRedisReply(void *reply) { return freeReplyObject(reply); }

int RedisContext::GetRedisError(redisContext *context) { return context->err; }

} // namespace gcs

} // namespace ray
13 changes: 6 additions & 7 deletions src/ray/gcs/redis_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
#include "ray/gcs/redis_async_context.h"
#include "ray/protobuf/gcs.pb.h"

extern "C" {
#include "hiredis/async.h"
#include "hiredis/hiredis.h"
}

struct redisContext;
struct redisAsyncContext;

Expand Down Expand Up @@ -289,6 +284,10 @@ class RedisContext {
boost::asio::io_service &io_service() { return io_service_; }

private:
// These functions avoid problems with dependence on hiredis headers with clang-cl.
static int GetRedisError(redisContext *context);
static void FreeRedisReply(void *reply);

boost::asio::io_service &io_service_;
redisContext *context_;
std::unique_ptr<RedisAsyncContext> redis_async_context_;
Expand Down Expand Up @@ -352,12 +351,12 @@ std::shared_ptr<CallbackReply> RedisContext::RunSync(
id.Data(), id.Size());
}
if (redis_reply == nullptr) {
RAY_LOG(INFO) << "Run redis command failed , err is " << context_->err;
RAY_LOG(INFO) << "Run redis command failed , err is " << GetRedisError(context_);
return nullptr;
} else {
std::shared_ptr<CallbackReply> callback_reply =
std::make_shared<CallbackReply>(reinterpret_cast<redisReply *>(redis_reply));
freeReplyObject(redis_reply);
FreeRedisReply(redis_reply);
return callback_reply;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/ray/gcs/tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "ray/common/ray_config.h"
#include "ray/gcs/redis_gcs_client.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace {

static const std::string kTableAppendCommand = "RAY.TABLE_APPEND";
Expand Down
9 changes: 4 additions & 5 deletions src/ray/gcs/test/redis_gcs_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@

#include "gtest/gtest.h"

// TODO(pcm): get rid of this and replace with the type safe plasma event loop
extern "C" {
#include "hiredis/hiredis.h"
}

#include "ray/common/ray_config.h"
#include "ray/common/test_util.h"
#include "ray/gcs/pb_util.h"
#include "ray/gcs/redis_gcs_client.h"
#include "ray/gcs/tables.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace ray {

namespace gcs {
Expand Down
4 changes: 4 additions & 0 deletions src/ray/object_manager/test/object_manager_stress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "ray/object_manager/object_manager.h"
#include "ray/util/filesystem.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace ray {

using rpc::GcsNodeInfo;
Expand Down
4 changes: 4 additions & 0 deletions src/ray/object_manager/test/object_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include "ray/common/test_util.h"
#include "ray/util/filesystem.h"

extern "C" {
#include "hiredis/hiredis.h"
}

namespace {
int64_t wait_timeout_ms;
} // namespace
Expand Down