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 6eeb91b7666 Fix the problem that fault a Exception named
"java.nio.BufferUnderflowException" when AlterTimeSeriesDataTypeProcedure
deserialize (#17062)
6eeb91b7666 is described below
commit 6eeb91b766644d929cf39c1d763e28425f5bb724
Author: libo <[email protected]>
AuthorDate: Thu Jan 22 18:45:52 2026 +0800
Fix the problem that fault a Exception named
"java.nio.BufferUnderflowException" when AlterTimeSeriesDataTypeProcedure
deserialize (#17062)
* Fix the problem that fault a Exception named
"java.nio.BufferUnderflowException" when AlterTimeSeriesDataTypeProcedure
deserialize .
* Simplify the way of obtaining a measurementPath object.
---
.../schema/AlterTimeSeriesDataTypeProcedure.java | 5 +-
.../AlterTimeSeriesDataTypeProcedureTest.java | 66 ++++++++++++++++++++++
2 files changed, 69 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java
index ad1d04ca6ee..05daf8c900d 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java
@@ -25,6 +25,7 @@ import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.path.MeasurementPath;
+import org.apache.iotdb.commons.path.PathDeserializeUtil;
import org.apache.iotdb.commons.path.PathPatternTree;
import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType;
import
org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager;
@@ -375,9 +376,9 @@ public class AlterTimeSeriesDataTypeProcedure
public void deserialize(final ByteBuffer byteBuffer) {
super.deserialize(byteBuffer);
queryId = ReadWriteIOUtils.readString(byteBuffer);
- setMeasurementPath(MeasurementPath.deserialize(byteBuffer));
+ setMeasurementPath((MeasurementPath)
PathDeserializeUtil.deserialize(byteBuffer));
if (getCurrentState() == AlterTimeSeriesDataTypeState.CLEAR_CACHE) {
- LOGGER.info("Successfully restored, will set mods to the data regions
anyway");
+ LOGGER.info("Successfully operate, will clear cache to the data regions
anyway");
}
if (byteBuffer.hasRemaining()) {
operationType = ReadWriteIOUtils.readByte(byteBuffer);
diff --git
a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedureTest.java
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedureTest.java
new file mode 100644
index 00000000000..6211b2021af
--- /dev/null
+++
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedureTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.confignode.procedure.impl.schema;
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.MeasurementPath;
+import org.apache.iotdb.commons.schema.tree.AlterTimeSeriesOperationType;
+import org.apache.iotdb.confignode.procedure.store.ProcedureType;
+
+import org.apache.tsfile.enums.TSDataType;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class AlterTimeSeriesDataTypeProcedureTest {
+
+ @Test
+ public void serializeDeserializeTest() throws IllegalPathException,
IOException {
+ String queryId = "1";
+ MeasurementPath measurementPath = new MeasurementPath("root.sg1.d1.s1");
+ AlterTimeSeriesDataTypeProcedure alterTimeSeriesDataTypeProcedure =
+ new AlterTimeSeriesDataTypeProcedure(
+ queryId,
+ measurementPath,
+ AlterTimeSeriesOperationType.ALTER_DATA_TYPE.getTypeValue(),
+ TSDataType.FLOAT,
+ false);
+
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ DataOutputStream dataOutputStream = new
DataOutputStream(byteArrayOutputStream);
+ alterTimeSeriesDataTypeProcedure.serialize(dataOutputStream);
+
+ ByteBuffer byteBuffer =
ByteBuffer.wrap(byteArrayOutputStream.toByteArray());
+
+ Assert.assertEquals(
+ ProcedureType.ALTER_TIMESERIES_DATATYPE_PROCEDURE.getTypeCode(),
byteBuffer.getShort());
+
+ AlterTimeSeriesDataTypeProcedure deserializedProcedure =
+ new AlterTimeSeriesDataTypeProcedure(false);
+ deserializedProcedure.deserialize(byteBuffer);
+
+ Assert.assertEquals(queryId, deserializedProcedure.getQueryId());
+ Assert.assertEquals("root.sg1.d1.s1",
deserializedProcedure.getmeasurementPath().getFullPath());
+ }
+}