[improvement](fe-meta) check the image's meta version (#23847)

Sometimes, user may use a low version FE to read high version image, which may cause some undefined behavior
and hard to debug.
This PR throw an explicit error to notify the user
This commit is contained in:
Mingyu Chen
2023-09-05 19:08:29 +08:00
committed by GitHub
parent 53265cc4f5
commit 771221a3f3

View File

@ -1773,6 +1773,12 @@ public class Env {
public long loadHeaderCOR1(DataInputStream dis, long checksum) throws IOException {
int journalVersion = dis.readInt();
if (journalVersion > FeMetaVersion.VERSION_CURRENT) {
throw new IOException("The meta version of image is " + journalVersion
+ ", which is higher than FE current version " + FeMetaVersion.VERSION_CURRENT
+ ". Please upgrade your cluster to the latest version first.");
}
long newChecksum = checksum ^ journalVersion;
MetaContext.get().setMetaVersion(journalVersion);