You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ka...@apache.org on 2017/09/04 13:44:28 UTC
[17/50] [abbrv] kylin git commit: minor, avoid buffer size overflow
minor, avoid buffer size overflow
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/fad75c93
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/fad75c93
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/fad75c93
Branch: refs/heads/2622-2764
Commit: fad75c93f42d252dd1ee2ec7b03df716c15fb2f4
Parents: 3200d6a
Author: Hongbin Ma <ma...@apache.org>
Authored: Mon Aug 28 12:18:23 2017 +0800
Committer: Hongbin Ma <ma...@kyligence.io>
Committed: Mon Aug 28 12:25:12 2017 +0800
----------------------------------------------------------------------
.../kylin/metadata/filter/TupleFilterSerializer.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/fad75c93/core-metadata/src/main/java/org/apache/kylin/metadata/filter/TupleFilterSerializer.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/TupleFilterSerializer.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/TupleFilterSerializer.java
index 63153ef..d434f0b 100755
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/TupleFilterSerializer.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/TupleFilterSerializer.java
@@ -69,8 +69,11 @@ public class TupleFilterSerializer {
internalSerialize(rootFilter, decorator, buffer, cs);
break;
} catch (BufferOverflowException e) {
- logger.info("Buffer size {} cannot hold the filter, resizing to 4 times", bufferSize);
- bufferSize *= 4;
+ if (bufferSize == (1 << 30))
+ throw e;
+
+ logger.info("Buffer size {} cannot hold the filter, resizing to 2 times", bufferSize);
+ bufferSize = bufferSize << 1;
}
}
byte[] result = new byte[buffer.position()];
@@ -78,7 +81,8 @@ public class TupleFilterSerializer {
return result;
}
- private static void internalSerialize(TupleFilter filter, Decorator decorator, ByteBuffer buffer, IFilterCodeSystem<?> cs) {
+ private static void internalSerialize(TupleFilter filter, Decorator decorator, ByteBuffer buffer,
+ IFilterCodeSystem<?> cs) {
if (decorator != null) { // give decorator a chance to manipulate the output filter
filter = decorator.onSerialize(filter);
}
@@ -203,7 +207,8 @@ public class TupleFilterSerializer {
if (extendedTupleFilters.containsKey(op)) {
try {
filter = (TupleFilter) extendedTupleFilters.get(op).getConstructor().newInstance();
- } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException
+ | NoSuchMethodException e) {
throw new RuntimeException(e);
}
} else {