-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sequencer class with lambda response message #2
base: master
Are you sure you want to change the base?
Conversation
Change-Id: Ic684138907605a2d79db9c85b84c425a5c5b0c59
Change-Id: I647dc326aac995785ebc1b2d882f85fd2b3d484d
…e second thread pop from the ring buffer and executes the function
Change-Id: I001bdc0f32d81eb847157a2f7ec8bc0faa5de1a8
Change-Id: Ie53906422adfc2027710ef9835dafe141448b84f
Change-Id: I90427922c574e9a5edaa722727878febe6c4d792
Change-Id: I9b7e9de507fb3926aa2c663548e43c97d0b99daa
Change-Id: I380534a136ced86bb0e3e3f06f31be8cc389ec74
Change-Id: I861379abf3db49fbe3488a874f092fbeb136491d
…ing/sonic-sairedis into syncd_multithread
Change-Id: Ia215d224868aef2a5767d7b03082398ffa38e562
…ing/sonic-sairedis into syncd_multithread
Change-Id: I24f0acbea04a99109371705b9529a0461779bfa6
…ing/sonic-sairedis into syncd_multithread
Change-Id: I90ef1f366c6b5f13c856d82f4aa9579c6fa9ff5b
Change-Id: I0e663cd3b7ce155298efd4f74fde86130ccf3b01
Change-Id: Id77121b6a52a535ffda7b31c699e0b6dc9a75ae1
Change-Id: I31bc11dd855c80ae551c1cdd6b750f9c06a24947
Fixed Problems/New Changes: Should be Tested:
Should be Tested:
@@ -56,7 +56,8 @@ libSyncd_a_SOURCES = \ | |||
WatchdogScope.cpp \ | |||
Workaround.cpp \ | |||
ZeroMQNotificationProducer.cpp \ | |||
syncd_main.cpp | |||
syncd_main.cpp \ | |||
Sequencer.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is ring buffer not here ?
@@ -0,0 +1,175 @@ | |||
#include "Sequencer.h" | |||
#include "swss/logger.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add under ifdef
syncd/Sequencer.cpp
Outdated
#include "Sequencer.h" | ||
#include "swss/logger.h" | ||
|
||
using namespace syncd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed ?
syncd/Sequencer.cpp
Outdated
std::string logMsg; | ||
SequenceStatus status = FAILURE; | ||
|
||
logMsg = "multithreaded: Checking for ready responses in queue... \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add under debug flag or under if def
syncd/Sequencer.cpp
Outdated
// Check if the next sequence number is in the map | ||
auto seq_data = responses.find(next_seq_to_send); | ||
if (seq_data == responses.end()) { | ||
logMsg += "multithreaded: No next sequence found in queue \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add under debug flag or under if def
if (!ringBuffer || ringBuffer->Started) | ||
{ | ||
LogToModuleFile(getNameByRingBuffer(ringBuffer), "popRingBuffer return"); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add counter stats ?
syncd/Sequencer.cpp
Outdated
|
||
logMsg = "multithreaded: Checking for ready responses in queue... \n"; | ||
|
||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condeider adding while not exit thread like in ring buffer
syncd/Syncd.cpp
Outdated
@@ -298,39 +383,74 @@ bool Syncd::isInitViewMode() const | |||
return m_asicInitViewMode && m_commandLineOptions->m_enableTempView; | |||
} | |||
|
|||
void point(_In_ const swss::KeyOpFieldsValuesTuple &kco){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?still here
syncd/Syncd.cpp
Outdated
getApiRingBuffer(kco, ringBuffer); | ||
|
||
int sequenceNumber; | ||
if(int seq_status = m_sequencer->allocateSequenceNumber(&sequenceNumber) != Sequencer::SUCCESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for if just log return status
syncd/Syncd.cpp
Outdated
int sequenceNumber; | ||
if(int seq_status = m_sequencer->allocateSequenceNumber(&sequenceNumber) != Sequencer::SUCCESS) | ||
{ | ||
std::string logMsg = "Failed to allocate sequence number: " + std::to_string(seq_status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add sww log with warning
|
||
// Helper function to execute all ready responses in order | ||
// check how many consecutive responses were executed in sucession and log it | ||
Sequencer::SequenceStatus Sequencer::executeReadyResponses() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not run under lock since block new ecxcute ... ?
but need to think if we lock each iteration - two treads can run in parallel ...
Fixed Problems/New Changes: Should be Tested:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to reduce changes in compare
replace one line with one line ... so compare is better
also all debug crate string shpul dbe done in macro .....
@@ -446,13 +567,14 @@ sai_status_t Syncd::processAttrCapabilityQuery( | |||
capability.create_implemented, capability.set_implemented, capability.get_implemented); | |||
} | |||
|
|||
m_selectableChannel->set(sai_serialize_status(status), entry, REDIS_ASIC_STATE_COMMAND_ATTR_CAPABILITY_RESPONSE); | |||
sendStausResponseSequence(status, REDIS_ASIC_STATE_COMMAND_ATTR_CAPABILITY_RESPONSE, entry, sequenceNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff order than m_selectableChannel->need to verify
|
||
attr_list = vidlist.get_attr_list(); | ||
attr_count = vidlist.get_attr_count(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed - in original code this was defined before ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also vidlist was initialized in previous function and not moved as parameter
now reinitilized why ?
@@ -5025,6 +5407,108 @@ static void timerWatchdogCallback( | |||
SWSS_LOG_ERROR("main loop execution exceeded %ld ms", span/1000); | |||
} | |||
|
|||
void Syncd::getObjectTypeByOperation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very complicated :-(
syncd/Syncd.cpp
Outdated
@@ -5076,19 +5563,22 @@ void Syncd::run() | |||
SWSS_LOG_NOTICE("starting main loop, ONLY restart query"); | |||
|
|||
if (m_commandLineOptions->m_disableExitSleep) | |||
runMainLoop = false; | |||
runMainLoop = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false became true ?
@@ -5182,11 +5672,59 @@ void Syncd::run() | |||
} | |||
else if (sel == m_flexCounter.get()) | |||
{ | |||
processFlexCounterEvent(*(swss::ConsumerTable*)sel); | |||
int sequenceNumber; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really need to have a s ervice or macro - too much code
@@ -5296,3 +5836,73 @@ syncd_restart_type_t Syncd::handleRestartQuery( | |||
|
|||
return RequestShutdownCommandLineOptions::stringToRestartType(op); | |||
} | |||
|
|||
void Syncd::sendStatusAndEntryResponse( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see priviouse note, in should be status mybe alreadt serialized entry and than command type
…ewMode Fixed Problems/New Changes: Should be Tested:
Fixed Problems/New Changes: Should be Tested:
Fixed Problems/New Changes: Should be Tested:
Change namespace Add is_exit param Fix logs Move statistics to public Add new statistics parmas Change-Id: I36f9d45babc7d4ee024aa8afde44edf1615da582
Change-Id: Ib5453d04e8d1f32a6114a32df9149df11c3bb75f
Change-Id: I7aad3550f334ae674eb93dfd66608fefb7aa0add
New Sequencer Class
Sequence number allocated according to the order that the events are received in Syncd
Passed sequence index in Syncd to function logic
The response is turned into a lambda and executed with the correct sequence order
Only added the sequence index to create/remove/set/get/bulk operations
Change-Id: Ic684138907605a2d79db9c85b84c425a5c5b0c59