Skip to content

Commit

Permalink
complement log
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Nov 25, 2024
1 parent 1a0970c commit 860fcc0
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 26 deletions.
7 changes: 4 additions & 3 deletions cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ void OtPIRImpl::onReceiveMessage(ppc::front::PPCMessageFace::Ptr _msg)
}
}

void OtPIRImpl::onReceivedErrorNotification(const std::string& _taskID)
void OtPIRImpl::onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message)
{
PIR_LOG(WARNING) << LOG_DESC("onReceivedErrorNotification") << printPPCMsg(_message);
// finish the task while the peer is failed
auto taskState = findPendingTask(_taskID);
auto taskState = findPendingTask(_message->taskID());
if (taskState)
{
taskState->onPeerNotifyFinish();
Expand Down Expand Up @@ -242,7 +243,7 @@ void OtPIRImpl::handleReceivedMessage(const ppc::front::PPCMessageFace::Ptr& _me
{
case int(CommonMessageType::ErrorNotification):
{
pir->onReceivedErrorNotification(_message->taskID());
pir->onReceivedErrorNotification(_message);
break;
}
case int(CommonMessageType::PingPeer):
Expand Down
2 changes: 1 addition & 1 deletion cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class OtPIRImpl : public std::enable_shared_from_this<OtPIRImpl>,
// register to the front to get the message related to ot-pir
void onReceiveMessage(ppc::front::PPCMessageFace::Ptr _message) override;

void onReceivedErrorNotification(const std::string& _taskID) override;
void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message) override;
void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer) override;

Expand Down
8 changes: 4 additions & 4 deletions cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ void CM2020PSIImpl::stop()
CM2020_PSI_LOG(INFO) << LOG_DESC("CM2020-PSI stopped");
}

void CM2020PSIImpl::onReceivedErrorNotification(const std::string& _taskID)
void CM2020PSIImpl::onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message)
{
CM2020_PSI_LOG(INFO) << LOG_DESC("onReceivedErrorNotification") << LOG_KV("taskID", _taskID);
CM2020_PSI_LOG(INFO) << LOG_DESC("onReceivedErrorNotification") << printPPCMsg(_message);
// finish the task while the peer is failed
auto taskState = findPendingTask(_taskID);
auto taskState = findPendingTask(_message->taskID());
if (taskState)
{
taskState->onPeerNotifyFinish();
Expand Down Expand Up @@ -410,7 +410,7 @@ void CM2020PSIImpl::handleReceivedMessage(const ppc::front::PPCMessageFace::Ptr&
{
case int(CommonMessageType::ErrorNotification):
{
psi->onReceivedErrorNotification(_message->taskID());
psi->onReceivedErrorNotification(_message);
break;
}
case int(CommonMessageType::PingPeer):
Expand Down
2 changes: 1 addition & 1 deletion cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CM2020PSIImpl : public bcos::Worker,

void start() override;
void stop() override;
void onReceivedErrorNotification(const std::string& _taskID) override;
void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message) override;
void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void EcdhConnPSIImpl::stop()
}
}

void EcdhConnPSIImpl::onReceivedErrorNotification(const std::string& _taskID) {}
void EcdhConnPSIImpl::onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const&) {}

void EcdhConnPSIImpl::onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class EcdhConnPSIImpl : public std::enable_shared_from_this<EcdhConnPSIImpl>,
void start() override;
void stop() override;

void onReceivedErrorNotification(const std::string& _taskID) override;
void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message) override;
void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer) override;
void executeWorker() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ void EcdhMultiPSIImpl::checkFinishedTask()
}
}

void EcdhMultiPSIImpl::onReceivedErrorNotification(const std::string& _taskID)
void EcdhMultiPSIImpl::onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message)
{
ECDH_MULTI_LOG(INFO) << LOG_DESC("onReceivedErrorNotification") << LOG_KV("taskID", _taskID);
ECDH_MULTI_LOG(INFO) << LOG_DESC("onReceivedErrorNotification") << printPPCMsg(_message);
// finish the task while the peer is failed
auto taskState = findPendingTask(_taskID);
auto taskState = findPendingTask(_message->taskID());
if (taskState)
{
taskState->onPeerNotifyFinish();
Expand Down Expand Up @@ -308,7 +308,7 @@ void EcdhMultiPSIImpl::executeWorker()
auto pop_msg = _msg.second;
if (pop_msg->messageType() == uint8_t(CommonMessageType::ErrorNotification))
{
onReceivedErrorNotification(pop_msg->taskID());
onReceivedErrorNotification(pop_msg);
return;
}
else if (pop_msg->messageType() == uint8_t(CommonMessageType::PingPeer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EcdhMultiPSIImpl : public std::enable_shared_from_this<EcdhMultiPSIImpl>,
void stop() override;

void checkFinishedTask();
void onReceivedErrorNotification(const std::string& _taskID) override;
void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message) override;
void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer) override;
void executeWorker() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void EcdhMultiPSICalculator::blindData(std::string _taskID, bcos::bytes _randA)
uint64_t dataOffset = 0;
do
{
if (m_taskState->loadFinished())
if (m_taskState->loadFinished() || m_taskState->taskDone())
{
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void EcdhMultiPSIMaster::blindData()
auto reader = m_taskState->reader();
do
{
if (m_taskState->loadFinished())
if (m_taskState->loadFinished() || m_taskState->taskDone())
{
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void EcdhMultiPSIPartner::onReceiveRandomA(bcos::bytesPointer _randA)
uint64_t dataOffset = 0;
do
{
if (m_taskState->loadFinished())
if (m_taskState->loadFinished() || m_taskState->taskDone())
{
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ void LabeledPSIImpl::stop()
LABELED_PSI_LOG(INFO) << LOG_DESC("LabeledPSI stopped");
}

void LabeledPSIImpl::onReceivedErrorNotification(const std::string& _taskID)
void LabeledPSIImpl::onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message)
{
LABELED_PSI_LOG(WARNING) << LOG_DESC("onReceivedErrorNotification") << printPPCMsg(_message);
// finish the task while the peer is failed
auto taskState = findPendingTask(_taskID);
auto taskState = findPendingTask(_message->taskID());
if (taskState)
{
taskState->onPeerNotifyFinish();
Expand Down Expand Up @@ -690,7 +691,7 @@ void LabeledPSIImpl::handleReceivedMessage(const ppc::front::PPCMessageFace::Ptr
{
case int(CommonMessageType::ErrorNotification):
{
psi->onReceivedErrorNotification(_message->taskID());
psi->onReceivedErrorNotification(_message);
break;
}
case int(CommonMessageType::PingPeer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LabeledPSIImpl : public bcos::Worker,
void start() override;
void stop() override;

void onReceivedErrorNotification(const std::string& _taskID) override;
void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const& _message) override;
void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer) override;

Expand Down
2 changes: 2 additions & 0 deletions cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskGuarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ void TaskGuarder::checkPeerActivity()
std::make_shared<bcos::Error>(
(int)PSIRetCode::PeerNodeDown, "peer node is down, id: " + peerID),
false);
PSI_LOG(INFO) << LOG_DESC("checkPeerActivity: peer node-down")
<< LOG_KV("peer", peerID) << LOG_KV("task", task->id());
},
nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TaskGuarder
}
virtual ~TaskGuarder() = default;

virtual void onReceivedErrorNotification(const std::string& _taskID){};
virtual void onReceivedErrorNotification(ppc::front::PPCMessageFace::Ptr const&){};
virtual void onSelfError(
const std::string& _taskID, bcos::Error::Ptr _error, bool _noticePeer){};

Expand Down
3 changes: 1 addition & 2 deletions cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ void TaskState::removeGeneratedOutputFile()
{
return;
}
PSI_LOG(INFO) << LOG_DESC("removeGeneratedFilesForFailed")
<< LOG_KV("task", printTaskInfo(m_task));
PSI_LOG(INFO) << LOG_DESC("removeGeneratedOutputFile") << LOG_KV("task", printTaskInfo(m_task));
m_config->dataResourceLoader()->deleteResource(outputDataResource->desc());
}

Expand Down

0 comments on commit 860fcc0

Please sign in to comment.