Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve](binlog) Reserve ids for binlog type allocation #43769 #44104

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,13 @@ public long read(DataInputStream dis, long checksum) throws IOException {
continue;
}

// Step 2.2: check if there is in next db Binlogs region
long dbId = binlog.getDbId();
if (binlog.getType().getValue() >= TBinlogType.MIN_UNKNOWN.getValue()) {
LOG.warn("skip unknown binlog, type: {}, db: {}", binlog.getType().getValue(), dbId);
continue;
}

// Step 2.2: check if there is in next db Binlogs region
if (dbId != currentDbId) {
// if there is in next db Binlogs region, check and update metadata
Database db = Env.getCurrentInternalCatalog().getDbNullable(dbId);
Expand Down
116 changes: 116 additions & 0 deletions gensrc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,122 @@ enum TBinlogType {
RENAME_TABLE = 14,
RENAME_COLUMN = 15,
MODIFY_COMMENT = 16,

// Keep some IDs for allocation so that when new binlog types are added in the
// future, the changes can be picked back to the old versions without breaking
// compatibility.
//
// The code will check the IDs of binlog types, any binlog types whose IDs are
// greater than or equal to MIN_UNKNOWN will be ignored.
//
// For example, before you adding new binlog type MODIFY_XXX:
// MIN_UNKNOWN = 17,
// UNKNOWN_2 = 18,
// UNKNOWN_3 = 19,
// After adding binlog type MODIFY_XXX:
// MODIFY_XXX = 17,
// MIN_UNKNOWN = 18,
// UNKNOWN_3 = 19,
MIN_UNKNOWN = 17,
UNKNOWN_2 = 18,
UNKNOWN_3 = 19,
UNKNOWN_4 = 20,
UNKNOWN_5 = 21,
UNKNOWN_6 = 22,
UNKNOWN_7 = 23,
UNKNOWN_8 = 24,
UNKNOWN_9 = 25,
UNKNOWN_10 = 26,
UNKNOWN_11 = 27,
UNKNOWN_12 = 28,
UNKNOWN_13 = 29,
UNKNOWN_14 = 30,
UNKNOWN_15 = 31,
UNKNOWN_16 = 32,
UNKNOWN_17 = 33,
UNKNOWN_18 = 34,
UNKNOWN_19 = 35,
UNKNOWN_20 = 36,
UNKNOWN_21 = 37,
UNKNOWN_22 = 38,
UNKNOWN_23 = 39,
UNKNOWN_24 = 40,
UNKNOWN_25 = 41,
UNKNOWN_26 = 42,
UNKNOWN_27 = 43,
UNKNOWN_28 = 44,
UNKNOWN_29 = 45,
UNKNOWN_30 = 46,
UNKNOWN_31 = 47,
UNKNOWN_32 = 48,
UNKNOWN_33 = 49,
UNKNOWN_34 = 50,
UNKNOWN_35 = 51,
UNKNOWN_36 = 52,
UNKNOWN_37 = 53,
UNKNOWN_38 = 54,
UNKNOWN_39 = 55,
UNKNOWN_40 = 56,
UNKNOWN_41 = 57,
UNKNOWN_42 = 58,
UNKNOWN_43 = 59,
UNKNOWN_44 = 60,
UNKNOWN_45 = 61,
UNKNOWN_46 = 62,
UNKNOWN_47 = 63,
UNKNOWN_48 = 64,
UNKNOWN_49 = 65,
UNKNOWN_50 = 66,
UNKNOWN_51 = 67,
UNKNOWN_52 = 68,
UNKNOWN_53 = 69,
UNKNOWN_54 = 70,
UNKNOWN_55 = 71,
UNKNOWN_56 = 72,
UNKNOWN_57 = 73,
UNKNOWN_58 = 74,
UNKNOWN_59 = 75,
UNKNOWN_60 = 76,
UNKNOWN_61 = 77,
UNKNOWN_62 = 78,
UNKNOWN_63 = 79,
UNKNOWN_64 = 80,
UNKNOWN_65 = 81,
UNKNOWN_66 = 82,
UNKNOWN_67 = 83,
UNKNOWN_68 = 84,
UNKNOWN_69 = 85,
UNKNOWN_70 = 86,
UNKNOWN_71 = 87,
UNKNOWN_72 = 88,
UNKNOWN_73 = 89,
UNKNOWN_74 = 90,
UNKNOWN_75 = 91,
UNKNOWN_76 = 92,
UNKNOWN_77 = 93,
UNKNOWN_78 = 94,
UNKNOWN_79 = 95,
UNKNOWN_80 = 96,
UNKNOWN_81 = 97,
UNKNOWN_82 = 98,
UNKNOWN_83 = 99,
UNKNOWN_84 = 100,
UNKNOWN_85 = 101,
UNKNOWN_86 = 102,
UNKNOWN_87 = 103,
UNKNOWN_88 = 104,
UNKNOWN_89 = 105,
UNKNOWN_90 = 106,
UNKNOWN_91 = 107,
UNKNOWN_92 = 108,
UNKNOWN_93 = 109,
UNKNOWN_94 = 110,
UNKNOWN_95 = 111,
UNKNOWN_96 = 112,
UNKNOWN_97 = 113,
UNKNOWN_98 = 114,
UNKNOWN_99 = 115,
UNKNOWN_100 = 116,
}

struct TBinlog {
Expand Down
Loading