Skip to content

Conversation

@estolfo
Copy link
Contributor

@estolfo estolfo commented Nov 22, 2016

No description provided.

@estolfo
Copy link
Contributor Author

estolfo commented Nov 22, 2016

@jyemin and @rozza, it'd be great if you could review this. Thanks!

unless @max_staleness > 0 &&
@max_staleness >= [ SMALLEST_MAX_STALENESS_SECONDS,
(heartbeat_frequency + Cluster::IDLE_WRITE_PERIOD_SECONDS) ].max
raise Error::InvalidServerPreference.new(Error::InvalidServerPreference::INVALID_MAX_STALENESS)
Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

raise Error::InvalidServerPreference.new(Error::InvalidServerPreference::INVALID_MAX_STALENESS)
if @max_staleness
heartbeat_frequency = cluster.options[:heartbeat_frequency] || Server::Monitor::HEARTBEAT_FREQUENCY
unless @max_staleness > 0 &&
Copy link

Choose a reason for hiding this comment

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

The @max_staleness > 0 check is redundant, since the next check is checking that it's at least >= 90

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if @max_staleness < heartbeat_frequency * 2
raise Error::InvalidServerPreference.new(Error::InvalidServerPreference::INVALID_MAX_STALENESS)
if @max_staleness
heartbeat_frequency = cluster.options[:heartbeat_frequency] || Server::Monitor::HEARTBEAT_FREQUENCY
Copy link

Choose a reason for hiding this comment

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

Rename to heartbeat_frequency_seconds to clarify that it's the right time unit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

validate_max_staleness_value!(cluster)
select(cluster.servers)
servers = cluster.servers
validate_max_staleness_value!(cluster) unless servers.empty?
Copy link

Choose a reason for hiding this comment

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

Does cluster.servers include only the connected servers? If so, I'm not clear how ReplicaSetNoPrimary/NoKnownServers.yml is passing.

Copy link
Contributor Author

@estolfo estolfo Nov 23, 2016

Choose a reason for hiding this comment

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

ReplicaSetNoPrimary/NoKnownServers.yml was added after my day ended yesterday so was not in this PR.
I've just updated them to the latest, was failing ReplicaSetNoPrimary/NoKnownServers.yml but then changed the code to do the check unless Topology type is Unknown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@estolfo
Copy link
Contributor Author

estolfo commented Nov 23, 2016

@jyemin, I've addressed all comments. If you could review one more time, that'd be great.

@jyemin
Copy link

jyemin commented Nov 23, 2016

LGTM

@estolfo
Copy link
Contributor Author

estolfo commented Nov 23, 2016

@jarthod Do you want to take a look at this as well to verify unit conversions?

@jarthod
Copy link
Contributor

jarthod commented Nov 23, 2016

Looks good to me too ;)

@estolfo
Copy link
Contributor Author

estolfo commented Nov 24, 2016

thanks @jarthod = )

@estolfo estolfo merged commit 65ed5d9 into mongodb:master Nov 24, 2016
@estolfo estolfo deleted the RUBY-1174-update-max-staleness branch May 29, 2017 12:49
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