Closed ysbqiaqia closed 4 months ago
@ysbqiaqia Thanks for the detailed steps. You are right, there are indeed multiple GetBuffer calls.
The current design is to simplify the API configuration. When dealing with multiple vineyard nodes on k8s, we first need to check the metadata to determine which vineyard node the object is stored on. Then, we can create a corresponding IPC/RPC client to obtain the object, as it may exist locally or remotely.
The GetMetaData function consists of two steps: GetData (to get metadata from etcd) and GetBuffer (to get the payload from vineyard). As you mentioned, both get_meta
and get_object
will invoke the GetMetaData function. One potential solution to address the issue of repeatedly calling GetBuffer and GetData is to split the GetMetaData function.
We will fix it quickly and thanks again!
GetMetaData
yes, I think get_meta function just get meta from etcd, and GetBuffer can be called in some where of get_object function.
Hi vineyard developers,
Recently, we reaserch vineyard flow, I found that when I do one single get operation in python script, client executed multiple GetBuffer requests. I added a print log at command_t::GET_BUFFERS_REQUEST state in the processMessage state mechine (at line 259 in the socket_server.cc). The printed log show that at least three invocations of the GetBuffer request. Here is the log: from vineyardd:
Test Demo:
Tracing the flow of the code as below:
def _fetch_object(self, object_id: ObjectID) -> Object: meta = self.get_meta(object_id) # get_meta-->GetMetaData-->GetBuffers
"get_meta", [](Client* self, ObjectIDWrapper const& object_id, bool const sync_remote) -> ObjectMeta { ObjectMeta meta; throw_on_error(self->GetMetaData(object_id, meta, sync_remote)); // Call the GetBuffers internally return meta; }, "object_id"_a, py::arg("sync_remote") = false, doc::IPCClient_get_meta)
Status Client::GetObject(const ObjectID id, std::shared_ptr
Status Client::GetMetaData(const ObjectID id, ObjectMeta& meta, const bool sync_remote) { ENSURE_CONNECTED(this); json tree; RETURN_ON_ERROR(GetData(id, tree, sync_remote)); meta.Reset(); meta.SetMetaData(this, tree);
std::map<ObjectID, std::shared_ptr> buffers;
RETURN_ON_ERROR(GetBuffers(meta.GetBufferSet()->AllBufferIds(), buffers)); // Here call the GetBuffers
for (auto const& id : meta.GetBufferSet()->AllBufferIds()) { const auto& buffer = buffers.find(id); if (buffer != buffers.end()) { meta.SetBuffer(id, buffer->second); } } return Status::OK(); }