[enhancement](backup) Add build version in backup snapshot info (#25513)

The snapshot info uploaded to S3 obj system by backup job is a json file, which is useful for us to get information about this snapshot.

If we add version info to the JSON file, we can know what version of the cluster used to manufacture this snapshot was, in order to prevent restoring the newer version of the snapshot to the older version of the cluster.

The following info has been added:

```
  "major_version": 1,
  "minor_version": 2,
  "patch_version": 6
```
This commit is contained in:
xy720
2023-10-20 14:36:43 +08:00
committed by GitHub
parent 925233a271
commit 9f31914018

View File

@ -33,6 +33,7 @@ import org.apache.doris.catalog.TableIf.TableType;
import org.apache.doris.catalog.Tablet;
import org.apache.doris.catalog.View;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.Version;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.persist.gson.GsonUtils;
@ -92,6 +93,12 @@ public class BackupJobInfo implements Writable {
@SerializedName("meta_version")
public int metaVersion;
@SerializedName("major_version")
public int majorVersion;
@SerializedName("minor_version")
public int minorVersion;
@SerializedName("patch_version")
public int patchVersion;
@SerializedName("tablet_be_map")
public Map<Long, Long> tabletBeMap = Maps.newHashMap();
@ -588,6 +595,9 @@ public class BackupJobInfo implements Writable {
jobInfo.metaVersion = FeConstants.meta_version;
jobInfo.content = content;
jobInfo.tableCommitSeqMap = tableCommitSeqMap;
jobInfo.majorVersion = Version.DORIS_BUILD_VERSION_MAJOR;
jobInfo.minorVersion = Version.DORIS_BUILD_VERSION_MINOR;
jobInfo.patchVersion = Version.DORIS_BUILD_VERSION_PATCH;
Collection<Table> tbls = backupMeta.getTables().values();
// tbls