This is an automated email from the ASF dual-hosted git repository.

justinchen pushed a commit to branch schema_scan
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/schema_scan by this push:
     new fea6f1f4856 fix
fea6f1f4856 is described below

commit fea6f1f485671a3f2ee75a2b7cd0dc7e0c5f9083
Author: Caideyipi <[email protected]>
AuthorDate: Tue Mar 31 18:19:28 2026 +0800

    fix
---
 .../mtree/impl/pbtree/schemafile/WrappedSegment.java         | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java
index 8d9d4032883..0e77214afa7 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/WrappedSegment.java
@@ -105,17 +105,16 @@ public class WrappedSegment implements 
ISegment<ByteBuffer, ICachedMNode> {
     }
   }
 
-  public WrappedSegment(ByteBuffer buffer) throws RecordDuplicatedException {
+  public WrappedSegment(ByteBuffer buffer) {
     this(buffer, true);
   }
 
   @TestOnly
-  public WrappedSegment(int size) throws RecordDuplicatedException {
+  public WrappedSegment(int size) {
     this(ByteBuffer.allocate(size));
   }
 
-  public static ISegment<ByteBuffer, ICachedMNode> initAsSegment(ByteBuffer 
buffer)
-      throws RecordDuplicatedException {
+  public static ISegment<ByteBuffer, ICachedMNode> initAsSegment(ByteBuffer 
buffer) {
     if (buffer == null) {
       return null;
     }
@@ -559,7 +558,6 @@ public class WrappedSegment implements ISegment<ByteBuffer, 
ICachedMNode> {
 
   @Override
   public int updateRecord(String key, ByteBuffer uBuffer) throws 
MetadataException {
-
     int idx = binarySearchOnKeys(key);
     if (idx < 0) {
       throw new MetadataException(String.format("Record[key:%s] Not Existed.", 
key));
@@ -614,8 +612,8 @@ public class WrappedSegment implements ISegment<ByteBuffer, 
ICachedMNode> {
     }
 
     // shift offsets forward
-    if (idx != recordNum) {
-      int shift = recordNum - idx;
+    if (idx != recordNum - 1) {
+      int shift = recordNum - idx - 1;
       this.buffer.position(SchemaFileConfig.SEG_HEADER_SIZE + idx * 2);
       ShortBuffer lb = this.buffer.asReadOnlyBuffer().asShortBuffer();
       lb.get();

Reply via email to