This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new dab572d24c6 The key cause by load snapshot failure is that nonclude
bytes involved preAlterColumn in these old snapshot data. Due to all data
involved tableNode are stored consecutively in the snapshot file. The content
of each element during serialization is of variable length, making it
impossible to identify the information of preAlteredColumn. So increment a
identify to find the position that can read preAlterColumn. (#17004)
dab572d24c6 is described below
commit dab572d24c65d0b04c13336e275f7f81b1c25d5c
Author: libo <[email protected]>
AuthorDate: Mon Jan 12 09:18:59 2026 +0800
The key cause by load snapshot failure is that nonclude bytes involved
preAlterColumn in these old snapshot data. Due to all data involved tableNode
are stored consecutively in the snapshot file. The content of each element
during serialization is of variable length, making it impossible to identify
the information of preAlteredColumn. So increment a identify to find the
position that can read preAlterColumn. (#17004)
---
.../confignode/persistence/schema/ConfigMTree.java | 37 +++++++++++++++-------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java
index 0f1007a65c4..2725053b843 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java
@@ -107,6 +107,8 @@ public class ConfigMTree {
private static final String TABLE_ERROR_MSG =
"Failed to recover configNode, because there exists data from an older
incompatible version, will shutdown soon. Please delete all data, and then
restart again.";
+ private static final int MARKER_HAVE_PREALTERED_COLUMNS = Integer.MIN_VALUE;
+
private final Logger logger = LoggerFactory.getLogger(ConfigMTree.class);
private IConfigMNode root;
// this store is only used for traverser invoking
@@ -1136,15 +1138,22 @@ public class ConfigMTree {
tableNode.getTable().serialize(outputStream);
tableNode.getStatus().serialize(outputStream);
final Set<String> preDeletedColumns = tableNode.getPreDeletedColumns();
- ReadWriteIOUtils.write(preDeletedColumns.size(), outputStream);
+
+ int preAlteredColumnSize = tableNode.getPreAlteredColumns().size();
+ int preDeletedColumnSize = preDeletedColumns.size();
+ if (preAlteredColumnSize > 0) {
+ ReadWriteIOUtils.write(MARKER_HAVE_PREALTERED_COLUMNS, outputStream);
+ ReadWriteForEncodingUtils.writeVarInt(preAlteredColumnSize,
outputStream);
+ for (Entry<String, TSDataType> entry :
tableNode.getPreAlteredColumns().entrySet()) {
+ ReadWriteIOUtils.writeVar(entry.getKey(), outputStream);
+ ReadWriteIOUtils.write(entry.getValue(), outputStream);
+ }
+ }
+
+ ReadWriteIOUtils.write(preDeletedColumnSize, outputStream);
for (final String column : preDeletedColumns) {
ReadWriteIOUtils.write(column, outputStream);
}
-
ReadWriteForEncodingUtils.writeVarInt(tableNode.getPreAlteredColumns().size(),
outputStream);
- for (Entry<String, TSDataType> entry :
tableNode.getPreAlteredColumns().entrySet()) {
- ReadWriteIOUtils.writeVar(entry.getKey(), outputStream);
- ReadWriteIOUtils.write(entry.getValue(), outputStream);
- }
}
public void deserialize(final InputStream inputStream) throws IOException {
@@ -1238,16 +1247,20 @@ public class ConfigMTree {
tableNode.setTable(TsTable.deserialize(inputStream));
tableNode.setStatus(TableNodeStatus.deserialize(inputStream));
int size = ReadWriteIOUtils.readInt(inputStream);
+ if (size == MARKER_HAVE_PREALTERED_COLUMNS) {
+ size = ReadWriteForEncodingUtils.readVarInt(inputStream);
+ for (int i = 0; i < size; i++) {
+ tableNode.addPreAlteredColumn(
+ ReadWriteIOUtils.readVarIntString(inputStream),
+ ReadWriteIOUtils.readDataType(inputStream));
+ }
+ size = ReadWriteIOUtils.readInt(inputStream);
+ }
+
for (int i = 0; i < size; ++i) {
tableNode.addPreDeletedColumn(ReadWriteIOUtils.readString(inputStream));
}
- size = ReadWriteForEncodingUtils.readVarInt(inputStream);
- for (int i = 0; i < size; i++) {
- tableNode.addPreAlteredColumn(
- ReadWriteIOUtils.readVarIntString(inputStream),
- ReadWriteIOUtils.readDataType(inputStream));
- }
return tableNode;
}