Skip to content

Add versioning - #15

Open
varsameer wants to merge 1 commit into
yahoo:candidate_release_1_3_1from
varsameer:versioning-fix
Open

Add versioning#15
varsameer wants to merge 1 commit into
yahoo:candidate_release_1_3_1from
varsameer:versioning-fix

Conversation

@varsameer

Copy link
Copy Markdown
Contributor

This change adds versioning changes to the state

Description

After quick consecutive reloads, the workQueue gets filled up with multiple work orders for the same hostname( spawned by states belonging to previous reloads) . This change adds a version to each state and increments it on each reload. With this change, after every check is done, the version of the check is compared with the current state version to see if the check belongs to a previous state and is discarded if so.

Comment thread src/internal/HMState.cpp

void HMState::setStateVersion(uint32_t version)
{
m_stateVersion = version;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also include a check for uintmax_t

HMTimeStamp checkTime = it->second.nextCheckTime(ip, version);
HM_WORK_STATE query_state = it->second.getQueryState(ip);
uint32_t query_version = it->second.getQueryVersion(ip);
if ( query_version != version ) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for formatting can we have the brackets ({) in new line

AF_INET),
HMDataHostCheck(it->first.second.getType()),
it->first.second));
dnslookup->setReschedule(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why reschedule is set to false

currentState->m_checkList.queueCheck(m_hostname, *iit, check, m_stateManager->m_workQueue, getStateVersion());
}
else{
// We will hit this path after a reload for hosts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brackets in newline

\return true if the check is expired and needs to be run now.
*/
bool queryNeeded() const;
bool queryNeeded(uint32_t version=0) const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a constant HM_DEFAULT_STATE_VERSION = 0 in HMConstants.h and use it


HM_SCHEDULE_STATE
HMDataCheckList::checkNeeded(string& hostname, HMIPAddress& ip, HMDataHostCheck& hostCheck)
HMDataCheckList::checkNeeded(string& hostname, HMIPAddress& ip, HMDataHostCheck& hostCheck, uint32_t version)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the default parameter like in header uint32_t version = HM_DEFAULT_STATE_VERSION / 0

currentState->m_dnsCache.queueDNSQuery(data->m_hostname,
data->m_dnsHostCheck,
state->m_workQueue);
state->m_workQueue,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addDNSTimeout, addHealthCheckTimeout functions are not overloaded

data->m_dnsHostCheck,
state->m_workQueue);
state->m_workQueue,
state->getStateVersion());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state doesnn't have function getStateVersion() , did you mean currentState->getStateVersion()

data->m_address, data->m_hostCheck,
state->m_workQueue);
state->m_workQueue,
state->getStateVersion());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@uthiramohan uthiramohan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tag ll be released once the reviews are addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants