MySQL 26.7.0
Source Code Documentation
my_clone.h
Go to the documentation of this file.
1/* Copyright (c) 2026 Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#pragma once
25
26#include <optional>
27#include <string>
28
29/**
30 @file include/my_clone.h Functions to compare server version strings and
31 version metadata to determine if Clone should be allowed from Donor to
32 Recipient
33*/
34
35/**
36 Compares versions and determine if clone is allowed. Clone is allowed if both
37 the donor and recipient have exactly same version string. In version series
38 8.1 and above, cloning is allowed if Major and Minor versions match. In 8.0
39 series, clone is allowed if patch version is above clone backport version. In
40 this comparison, suffixes are ignored: i.e. 8.0.25 should be the same as
41 8.0.25-debug, but 8.0.25 isn't the same as 8.0.251. Beyond version 9.7,
42 Cloning is also allowed from a Donor in one LTS to a recipient in the next
43 LTS. For example, Cloning from 9.7.x to 28.4.y is allowed but not from
44 28.4.y to 9.7.x. Conversly, a LTS Recipient is allowed to clone from a LTS
45 Donor if the recipient starts its LTS lineage after Donor.
46
47 Note: The Recipient performs these checks and determines if cloning is allowed
48
49 @param[in] recipient Recipient's version string
50 @param[in] donor Donor's version string
51 @param[in] is_recipient_lts true if recipient is LTS
52 @param[in] is_donor_lts true if donor is LTS
53 @param[in] recipient_prev_lts Previous LTS version of the Recipient
54 @return true if recipient must allow clone from donor, false otherwise
55*/
56[[nodiscard]] extern bool are_versions_clone_compatible(
57 const std::string &recipient, const std::string &donor,
58 const bool is_recipient_lts = false, const bool is_donor_lts = false,
59 const std::optional<std::string> &recipient_prev_lts = std::nullopt);
bool are_versions_clone_compatible(const std::string &recipient, const std::string &donor, const bool is_recipient_lts=false, const bool is_donor_lts=false, const std::optional< std::string > &recipient_prev_lts=std::nullopt)
Compares versions and determine if clone is allowed.
Definition: my_clone.cc:50