mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
Make xray object table credis-managed and hence flushable. (#2338)
* monitor.py: issue flushes to data shard * ResultTableAdd & ObjectTableAdd: add credis-managed versions * Fix return codes * Credis-manage xray object table & associated ray.table_append cmd * Fix incorrect return code from TableAppend_DoWrite() * Revert "ResultTableAdd & ObjectTableAdd: add credis-managed versions" This reverts commit 628c2ea190df4c861dda0c284fab7ca6faa1ea24. * Address comments * Lint: fix indent * Address comment
This commit is contained in:
committed by
Philipp Moritz
parent
f21d783e6d
commit
ba28dddf6f
@@ -10,7 +10,7 @@ AsyncGcsClient::AsyncGcsClient(const ClientID &client_id, CommandType command_ty
|
||||
context_ = std::make_shared<RedisContext>();
|
||||
primary_context_ = std::make_shared<RedisContext>();
|
||||
client_table_.reset(new ClientTable(primary_context_, this, client_id));
|
||||
object_table_.reset(new ObjectTable(context_, this));
|
||||
object_table_.reset(new ObjectTable(context_, this, command_type));
|
||||
actor_table_.reset(new ActorTable(context_, this));
|
||||
task_table_.reset(new TaskTable(context_, this, command_type));
|
||||
raylet_task_table_.reset(new raylet::TaskTable(context_, this, command_type));
|
||||
|
||||
+36
-13
@@ -3,6 +3,34 @@
|
||||
#include "common_protocol.h"
|
||||
#include "ray/gcs/client.h"
|
||||
|
||||
namespace {
|
||||
|
||||
static const std::string kTableAppendCommand = "RAY.TABLE_APPEND";
|
||||
static const std::string kChainTableAppendCommand = "RAY.CHAIN.TABLE_APPEND";
|
||||
|
||||
static const std::string kTableAddCommand = "RAY.TABLE_ADD";
|
||||
static const std::string kChainTableAddCommand = "RAY.CHAIN.TABLE_ADD";
|
||||
|
||||
std::string GetLogAppendCommand(const ray::gcs::CommandType command_type) {
|
||||
if (command_type == ray::gcs::CommandType::kRegular) {
|
||||
return kTableAppendCommand;
|
||||
} else {
|
||||
RAY_CHECK(command_type == ray::gcs::CommandType::kChain);
|
||||
return kChainTableAppendCommand;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetTableAddCommand(const ray::gcs::CommandType command_type) {
|
||||
if (command_type == ray::gcs::CommandType::kRegular) {
|
||||
return kTableAddCommand;
|
||||
} else {
|
||||
RAY_CHECK(command_type == ray::gcs::CommandType::kChain);
|
||||
return kChainTableAddCommand;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ray {
|
||||
|
||||
namespace gcs {
|
||||
@@ -19,8 +47,9 @@ Status Log<ID, Data>::Append(const JobID &job_id, const ID &id,
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
fbb.ForceDefaults(true);
|
||||
fbb.Finish(Data::Pack(fbb, dataT.get()));
|
||||
return context_->RunAsync("RAY.TABLE_APPEND", id, fbb.GetBufferPointer(), fbb.GetSize(),
|
||||
prefix_, pubsub_channel_, std::move(callback));
|
||||
return context_->RunAsync(GetLogAppendCommand(command_type_), id,
|
||||
fbb.GetBufferPointer(), fbb.GetSize(), prefix_,
|
||||
pubsub_channel_, std::move(callback));
|
||||
}
|
||||
|
||||
template <typename ID, typename Data>
|
||||
@@ -42,8 +71,9 @@ Status Log<ID, Data>::AppendAt(const JobID &job_id, const ID &id,
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
fbb.ForceDefaults(true);
|
||||
fbb.Finish(Data::Pack(fbb, dataT.get()));
|
||||
return context_->RunAsync("RAY.TABLE_APPEND", id, fbb.GetBufferPointer(), fbb.GetSize(),
|
||||
prefix_, pubsub_channel_, std::move(callback), log_length);
|
||||
return context_->RunAsync(GetLogAppendCommand(command_type_), id,
|
||||
fbb.GetBufferPointer(), fbb.GetSize(), prefix_,
|
||||
pubsub_channel_, std::move(callback), log_length);
|
||||
}
|
||||
|
||||
template <typename ID, typename Data>
|
||||
@@ -140,15 +170,8 @@ Status Table<ID, Data>::Add(const JobID &job_id, const ID &id,
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
fbb.ForceDefaults(true);
|
||||
fbb.Finish(Data::Pack(fbb, dataT.get()));
|
||||
if (command_type_ == CommandType::kRegular) {
|
||||
return context_->RunAsync("RAY.TABLE_ADD", id, fbb.GetBufferPointer(), fbb.GetSize(),
|
||||
prefix_, pubsub_channel_, std::move(callback));
|
||||
} else {
|
||||
RAY_CHECK(command_type_ == CommandType::kChain);
|
||||
return context_->RunAsync("RAY.CHAIN.TABLE_ADD", id, fbb.GetBufferPointer(),
|
||||
fbb.GetSize(), prefix_, pubsub_channel_,
|
||||
std::move(callback));
|
||||
}
|
||||
return context_->RunAsync(GetTableAddCommand(command_type_), id, fbb.GetBufferPointer(),
|
||||
fbb.GetSize(), prefix_, pubsub_channel_, std::move(callback));
|
||||
}
|
||||
|
||||
template <typename ID, typename Data>
|
||||
|
||||
@@ -276,6 +276,13 @@ class ObjectTable : public Log<ObjectID, ObjectTableData> {
|
||||
pubsub_channel_ = TablePubsub::OBJECT;
|
||||
prefix_ = TablePrefix::OBJECT;
|
||||
};
|
||||
|
||||
ObjectTable(const std::shared_ptr<RedisContext> &context, AsyncGcsClient *client,
|
||||
gcs::CommandType command_type)
|
||||
: ObjectTable(context, client) {
|
||||
command_type_ = command_type;
|
||||
};
|
||||
|
||||
virtual ~ObjectTable(){};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user