* Returns true if the cluster version is >= given major.minor.patch version */
| 101 | * Returns true if the cluster version is >= given major.minor.patch version |
| 102 | */ |
| 103 | bool |
| 104 | IsClusterVersionAtleast(MajorVersion majorVersion, int minor, int patch) |
| 105 | { |
| 106 | Assert(majorVersion <= MaxVersionAllowed); |
| 107 | Assert(majorVersion > DocDB_V0 || (majorVersion == DocDB_V0 && minor > 108)); |
| 108 | ExtensionVersion version = RefreshCurrentVersion(); |
| 109 | |
| 110 | int major = majorVersion + FirstMajorVersionOffset; |
| 111 | if (version.Major < major) |
| 112 | { |
| 113 | return false; |
| 114 | } |
| 115 | else if (version.Minor < minor) |
| 116 | { |
| 117 | return false; |
| 118 | } |
| 119 | else if (version.Major != major || version.Minor != minor) |
| 120 | { |
| 121 | /* if CurrentVersion.Major or CurrentVersion.Minor are greater than the expected version */ |
| 122 | /* parts we are on a later version, no need to compare the patch. */ |
| 123 | return true; |
| 124 | } |
| 125 | |
| 126 | /* Major and Minor are the expected ones, we should compare the patch version. */ |
| 127 | return version.Patch >= patch; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | /* |
no test coverage detected