This is an automated email from the ASF dual-hosted git repository.
wyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 09b573271d [NO ISSUE][STO] Include more info. on erroneous write
09b573271d is described below
commit 09b573271defe0b4c6a99712b3f6a749f6109422
Author: Wail Alkowaileet <[email protected]>
AuthorDate: Tue May 14 09:21:44 2024 -0700
[NO ISSUE][STO] Include more info. on erroneous write
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Include more information on erroneous write of columnar
temp buffers
Change-Id: I8f56c67c394d8486412573f9975d71172b26bb0b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18287
Reviewed-by: Wail Alkowaileet <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
---
.../out/MultiTemporaryBufferBytesOutputStream.java | 22 +++++++++++++++++++---
.../values/writer/AbstractColumnValuesWriter.java | 6 +++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/bytes/stream/out/MultiTemporaryBufferBytesOutputStream.java
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/bytes/stream/out/MultiTemporaryBufferBytesOutputStream.java
index 38f73215d8..8988026ab9 100644
---
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/bytes/stream/out/MultiTemporaryBufferBytesOutputStream.java
+++
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/bytes/stream/out/MultiTemporaryBufferBytesOutputStream.java
@@ -55,14 +55,30 @@ public final class MultiTemporaryBufferBytesOutputStream
extends AbstractMultiBu
@Override
public void writeTo(OutputStream outputStream) throws IOException {
int writtenSize = 0;
- for (int i = 0; i < currentBufferIndex + 1; i++) {
+ int numberOfUsedBuffers = currentBufferIndex + 1;
+ for (int i = 0; i < numberOfUsedBuffers; i++) {
ByteBuffer buffer = buffers.get(i);
outputStream.write(buffer.array(), 0, buffer.position());
writtenSize += buffer.position();
}
+
if (writtenSize != position) {
- //Sanity check
- throw new IllegalStateException("Size is different");
+ // Sanity check
+ StringBuilder builder = new StringBuilder();
+ builder.append('[');
+ for (int i = 0; i < numberOfUsedBuffers; i++) {
+ ByteBuffer buffer = buffers.get(i);
+ builder.append("{Buffer index: ").append(i);
+ builder.append(" Position: ").append(buffer.position());
+ builder.append(" Limit: ").append(buffer.limit());
+ builder.append(" Capacity: ").append(buffer.capacity());
+ builder.append("}, ");
+ }
+ builder.setLength(builder.length() - 2);
+ builder.append(']');
+ throw new IllegalStateException("Size is different (written: " +
writtenSize + ", position: " + position
+ + ", allocatedBytes: " + allocatedBytes + ",
currentBufferIndex: " + currentBufferIndex
+ + ", buffers: " + builder + ")");
}
}
}
diff --git
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/AbstractColumnValuesWriter.java
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/AbstractColumnValuesWriter.java
index 5e5d6e4ced..accf4a0c03 100644
---
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/AbstractColumnValuesWriter.java
+++
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/AbstractColumnValuesWriter.java
@@ -34,10 +34,13 @@ import
org.apache.asterix.column.values.writer.filters.NoOpColumnFilterWriter;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IValueReference;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.parquet.bytes.BytesInput;
import org.apache.parquet.bytes.BytesUtils;
public abstract class AbstractColumnValuesWriter implements
IColumnValuesWriter {
+ private static final Logger LOGGER = LogManager.getLogger();
// For 3 integers (count, defSize, and valueSize)
private static final int COUNT_DEF_SIZE_VALUE_SIZE = Integer.BYTES * 3;
protected final AbstractColumnFilterWriter filterWriter;
@@ -188,7 +191,8 @@ public abstract class AbstractColumnValuesWriter implements
IColumnValuesWriter
*/
BytesUtils.writeZigZagVarInt(0, out);
}
- } catch (IOException e) {
+ } catch (Exception e) {
+ LOGGER.error("Error while flushing columnIndex {}", columnIndex);
throw HyracksDataException.create(e);
}
reset();