You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/11/19 03:53:52 UTC
[incubator-iotdb] branch rel/0.9 updated: fix compression = SNAPPY
when compression type=SNAPPY (#568)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/0.9
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/rel/0.9 by this push:
new 28a97f2 fix compression = SNAPPY when compression type=SNAPPY (#568)
28a97f2 is described below
commit 28a97f23790228b1a95a8fd3d7db5410a2d6cc65
Author: gwmh <16...@qq.com>
AuthorDate: Tue Nov 19 11:53:46 2019 +0800
fix compression = SNAPPY when compression type=SNAPPY (#568)
* fix compression = SNAPPY when compression type=SNAPPY
---
.../org/apache/iotdb/tsfile/compress/IUnCompressor.java | 8 ++------
.../iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java | 14 ++++++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
index 108db47..e7abf0a 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
@@ -152,9 +152,7 @@ public interface IUnCompressor {
return Snappy.uncompress(bytes);
} catch (IOException e) {
logger.error(
- "tsfile-compression SnappyUnCompressor: errors occurs when uncompress input byte, "
- + "bytes is {}",
- bytes, e);
+ "tsfile-compression SnappyUnCompressor: errors occurs when uncompress input byte", e);
}
return new byte[0];
}
@@ -176,9 +174,7 @@ public interface IUnCompressor {
return Snappy.uncompress(compressed, uncompressed);
} catch (IOException e) {
logger.error(
- "tsfile-compression SnappyUnCompressor: errors occurs when uncompress input byte, "
- + "bytes is {}",
- compressed.array(), e);
+ "tsfile-compression SnappyUnCompressor: errors occurs when uncompress input byte", e);
}
return 0;
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java
index 57a1019..21fe6cf 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java
@@ -452,6 +452,18 @@ public class TsfileUpgradeToolV0_8_0 implements AutoCloseable {
if (encodingType.equals(TSEncoding.PLAIN)) {
pageList.set(j, rewrite(pageList.get(j), tsDataType, compressionType));
}
+ switch (compressionType) {
+ case UNCOMPRESSED:
+ break;
+ case SNAPPY:
+ SnappyUnCompressor snappyUnCompressor = new SnappyUnCompressor();
+ pageHeaderList.get(j).setUncompressedSize(
+ snappyUnCompressor.uncompress(pageList.get(j).array()).length);
+ pageHeaderList.get(j).setCompressedSize(pageList.get(j).array().length);
+ break;
+ default:
+ throw new CompressionTypeNotSupportedException(compressionType.toString());
+ }
chunkBuffer
.writePageHeaderAndDataIntoBuff(pageList.get(j), pageHeaderList.get(j));
}
@@ -560,6 +572,8 @@ public class TsfileUpgradeToolV0_8_0 implements AutoCloseable {
logger.error("failed to compress page as snappy", e);
}
break;
+ default:
+ throw new CompressionTypeNotSupportedException(compressionType.toString());
}
return modifiedPage;
}