Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 09897200D0C for ; Wed, 6 Sep 2017 00:01:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 07F94160D85; Tue, 5 Sep 2017 22:01:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4ECC7160BCB for ; Wed, 6 Sep 2017 00:01:42 +0200 (CEST) Received: (qmail 19266 invoked by uid 500); 5 Sep 2017 22:01:40 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 19255 invoked by uid 99); 5 Sep 2017 22:01:40 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2017 22:01:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id AD0E91A62F5 for ; Tue, 5 Sep 2017 22:01:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id QQOR6-HVO8-z for ; Tue, 5 Sep 2017 22:01:34 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 9917C5FC69 for ; Tue, 5 Sep 2017 22:01:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id v85M1Xwh032105; Tue, 5 Sep 2017 22:01:33 GMT Message-Id: <201709052201.v85M1Xwh032105@ip-10-146-233-104.ec2.internal> Date: Tue, 5 Sep 2017 22:01:33 +0000 From: "Dimitris Tsirogiannis (Code Review)" To: Bharath Vissapragada , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Alex Behm , Tim Armstrong , Mostafa Mokhtar Reply-To: dtsirogiannis@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_=5BPREVIEW=5D_Use_native_allocation_while_building_catalog_updates=0A?= X-Gerrit-Change-Id: I383684effa9524734ce3c6c0fb7ed37de0e15782 X-Gerrit-ChangeURL: X-Gerrit-Commit: 8a03a140c48f23e8c0b82ec9c98ef960f3674aea In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.7 archived-at: Tue, 05 Sep 2017 22:01:43 -0000 Dimitris Tsirogiannis has posted comments on this change. Change subject: [PREVIEW] Use native allocation while building catalog updates ...................................................................... Patch Set 1: (17 comments) http://gerrit.cloudera.org:8080/#/c/7955/1/be/src/catalog/catalog.cc File be/src/catalog/catalog.cc: PS1, Line 106: RETURN_IF_ERROR(DeserializeThriftMsg(jni_env, result_bytes, &nbuffer)); What happens if DeserializeThriftMsg returns a non-ok status? Who will release the allocated memory? PS1, Line 108: uint32_t len = static_cast(nbuffer.buffer_len); Isn't buffer_len i64? What will happen if the cast fails? PS1, Line 110: buf Interestingly, DeserializeThriftMsg() casts the const away of the first param (buf). The comment in this function still says that it is treated as a const even though the const is casted away but let's make sure we check the implementation to ensure nothing bad happens to buf after that call. PS1, Line 111: desrialize nit: deserialize (typo) PS1, Line 113: free(buf); > I used free after checking that the unsafe.freeMemory() also calls the same Yes, I think we need to place it safe here. If the implementation changes in some later Java version, we may run into issues. http://gerrit.cloudera.org:8080/#/c/7955/1/common/thrift/JniCatalog.thrift File common/thrift/JniCatalog.thrift: PS1, Line 596: native byte buffer In the context of reading this thrift file, I don't think it is clear what "native byte buffer" is. Maybe say at the beginning that it represents a buffer allocated by the JVM using native memory (unsafe). http://gerrit.cloudera.org:8080/#/c/7955/1/fe/src/main/java/org/apache/impala/service/JniCatalog.java File fe/src/main/java/org/apache/impala/service/JniCatalog.java: Line 137: * Gets all catalog objects Please expand the comment. We're adding some non-trivial behavior here. http://gerrit.cloudera.org:8080/#/c/7955/1/fe/src/main/java/org/apache/impala/thrift/NativeByteArrayOutputStream.java File fe/src/main/java/org/apache/impala/thrift/NativeByteArrayOutputStream.java: Line 1: package org.apache.impala.thrift; Apache header? PS1, Line 26: @SuppressWarnings("restriction") explain? PS1, Line 27: class nit: make it final (do you plan to extend it?) PS1, Line 33: private static final long BUFFER_DOUBLING_RESIZE_LIMIT = 1 * 1024 * 1024 * 1024; /* 1GB */ nit: long line PS1, Line 38: length length (in bytes) PS1, Line 39: protected why protected? PS1, Line 48: public NativeByteArrayOutputStream() { : this(BUFFER_INITIAL_SIZE_DEFAULT); : } single line? PS1, Line 57: // Unsafe#allocateMemory() can handle negative inputs. Why do I need to know about this here? Maybe remove. PS1, Line 94: if (bufferLen_ >= BUFFER_DOUBLING_RESIZE_LIMIT) { : newBufferSize = bufferLen_ + BUFFER_RESIZE_INCREMENTS; : } else { : newBufferSize = bufferLen_ << 1; : } How do you guarantee that newBufferSize > bytesWritten_ + len? E.g. bufferLen_ = 128MB, len = 1GB. Isn't bufferLen_ going to be 256MB although you need 1128MB? Am I missing something? http://gerrit.cloudera.org:8080/#/c/7955/1/fe/src/main/java/org/apache/impala/thrift/TNativeSerializer.java File fe/src/main/java/org/apache/impala/thrift/TNativeSerializer.java: PS1, Line 31: native by array nit: "native by array"? -- To view, visit http://gerrit.cloudera.org:8080/7955 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I383684effa9524734ce3c6c0fb7ed37de0e15782 Gerrit-PatchSet: 1 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Bharath Vissapragada Gerrit-Reviewer: Alex Behm Gerrit-Reviewer: Bharath Vissapragada Gerrit-Reviewer: Dimitris Tsirogiannis Gerrit-Reviewer: Mostafa Mokhtar Gerrit-Reviewer: Tim Armstrong Gerrit-HasComments: Yes