MXS-2313: Use 64-bit integers to store rank

Although the default value is the maximum value of a signed 32-bit
integer, the value is stored as a 64-bit integer. The integer type
conversion functions return 64-bit values so storing it as one makes
sense.

Currently values higher than the default are allowed but the accepted
range of input should be restricted in the future.
This commit is contained in:
Markus Mäkelä
2019-03-10 11:17:58 +02:00
parent aeca0f8a31
commit 9b6b5270f1
7 changed files with 22 additions and 21 deletions

View File

@ -62,7 +62,7 @@ public:
m_settings.persistmaxtime = persistmaxtime;
}
void set_rank(int rank)
void set_rank(int64_t rank)
{
m_settings.rank = rank;
}
@ -122,7 +122,7 @@ public:
return m_settings.authenticator;
}
int rank() const override
int64_t rank() const override
{
return m_settings.rank;
}
@ -341,7 +341,7 @@ private:
long persistpoolmax = 0; /**< Maximum size of persistent connections pool */
long persistmaxtime = 0; /**< Maximum number of seconds connection can live */
int rank; /*< The ranking of this server, used to prioritize certain servers over others */
int64_t rank; /*< The ranking of this server, used to prioritize certain servers over others */
/** Disk space thresholds. Can be queried from modules at any time so access must be protected
* by mutex. */