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 04:38:04 UTC
[incubator-iotdb] branch rel/0.9 updated: fix compression when
snappy (#569)
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 49af9a4 fix compression when snappy (#569)
49af9a4 is described below
commit 49af9a4058bdc71bf46dfbd2aa9d551048b10450
Author: gwmh <16...@qq.com>
AuthorDate: Tue Nov 19 12:37:58 2019 +0800
fix compression when snappy (#569)
* fix page header length is not correct when upgrading
---
.../apache/iotdb/tsfile/tool/upgrade/TsfileUpgradeToolV0_8_0.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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 21fe6cf..a9de43a 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
@@ -450,7 +450,8 @@ public class TsfileUpgradeToolV0_8_0 implements AutoCloseable {
schema.getMeasurementSchema(chunkHeader.getMeasurementID()));
for (int j = 0; j < pageHeaderList.size(); j++) {
if (encodingType.equals(TSEncoding.PLAIN)) {
- pageList.set(j, rewrite(pageList.get(j), tsDataType, compressionType));
+ pageList.set(j, rewrite(pageList.get(j), tsDataType, compressionType,
+ pageHeaderList.get(j)));
}
switch (compressionType) {
case UNCOMPRESSED:
@@ -502,7 +503,7 @@ public class TsfileUpgradeToolV0_8_0 implements AutoCloseable {
}
static ByteBuffer rewrite(ByteBuffer page, TSDataType tsDataType,
- CompressionType compressionType) {
+ CompressionType compressionType, PageHeader pageHeader) {
switch (compressionType) {
case UNCOMPRESSED:
break;
@@ -565,9 +566,11 @@ public class TsfileUpgradeToolV0_8_0 implements AutoCloseable {
modifiedPage.flip();
break;
case SNAPPY:
+ pageHeader.setUncompressedSize(modifiedPage.array().length);
SnappyCompressor snappyCompressor = new SnappyCompressor();
try {
modifiedPage = ByteBuffer.wrap(snappyCompressor.compress(modifiedPage.array()));
+ pageHeader.setCompressedSize(modifiedPage.array().length);
} catch (IOException e) {
logger.error("failed to compress page as snappy", e);
}