MCPcopy Create free account
hub / github.com/documentdb/documentdb / IsClusterVersionAtleast

Function IsClusterVersionAtleast

pg_documentdb/src/utils/version_utils.c:103–128  ·  view source on GitHub ↗

* Returns true if the cluster version is >= given major.minor.patch version */

Source from the content-addressed store, hash-verified

101 * Returns true if the cluster version is >= given major.minor.patch version
102 */
103bool
104IsClusterVersionAtleast(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/*

Callers 15

TraverseQualsAndExtractFunction · 0.85
InsertOrReplaceDocumentFunction · 0.85
CreatePostgresDataTableFunction · 0.85
CreateRetryTableFunction · 0.85
ParseCreateSpecFunction · 0.85
AppendUniqueColumnExprFunction · 0.85
GenerateIndexExprStrFunction · 0.85
command_coll_modFunction · 0.85

Calls 1

RefreshCurrentVersionFunction · 0.85

Tested by

no test coverage detected