You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by db...@apache.org on 2023/08/23 12:49:04 UTC

[impala] branch master updated (05bc48585 -> 4b6281299)

This is an automated email from the ASF dual-hosted git repository.

dbecker pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


    from 05bc48585 IMPALA-10860: Allow setting mem_limit for coordinators
     new 748c3b894 IMPALA-12274: Fix memory leak from unreleased local reference
     new 4b6281299 [tools] Add Dev Container support for Impala development.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .devcontainer/Dockerfile        | 10 ++++++++++
 .devcontainer/devcontainer.json | 22 ++++++++++++++++++++++
 be/src/catalog/catalog.cc       | 10 +++++++---
 be/src/catalog/catalog.h        |  3 ---
 bin/rat_exclude_files.txt       |  1 +
 5 files changed, 40 insertions(+), 6 deletions(-)
 create mode 100644 .devcontainer/Dockerfile
 create mode 100644 .devcontainer/devcontainer.json


[impala] 02/02: [tools] Add Dev Container support for Impala development.

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dbecker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 4b62812995ce380f2dca038bac017432c6c5d14f
Author: Fredy Wijaya <fr...@apache.org>
AuthorDate: Fri Aug 18 14:26:38 2023 -0500

    [tools] Add Dev Container support for Impala development.
    
    Currently only VS Code is supported since IntelliJ/CLion support for
    Dev Container is still beta at the time of this writing.
    
    To use it, simply open Impala source code.
    
    $ git clone https://github.com/apache/impala.git
    $ cd impala
    $ code .
    
    The bootstrap_development.sh will be automatically executed post Docker
    container creation and all necessary extensions for IDE-like experience
    will be automatically installed. For C++, it will use clangd that uses
    compilation database instead of the Microsoft C++ extension since it
    works better with Clang related tools.
    
    Change-Id: I50508a09710641ec2a299b001fef3e7fefb0b7d5
    Reviewed-on: http://gerrit.cloudera.org:8080/20380
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Quanlong Huang <hu...@gmail.com>
---
 .devcontainer/Dockerfile        | 10 ++++++++++
 .devcontainer/devcontainer.json | 22 ++++++++++++++++++++++
 bin/rat_exclude_files.txt       |  1 +
 3 files changed, 33 insertions(+)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 000000000..8cb17a547
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,10 @@
+FROM ubuntu:20.04
+
+ARG USER_UID=1000
+ARG USER_GID=$USER_UID
+
+RUN apt-get update \
+    && apt-get install -y sudo git \
+    && addgroup --gid "${USER_GID}" impdev \
+    && adduser --uid "${USER_UID}" --gid "${USER_GID}" --disabled-password --gecos '' impdev \
+    && echo 'impdev ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 000000000..39ce649a2
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,22 @@
+{
+  "name": "Impala Dev",
+  "dockerFile": "Dockerfile",
+  "runArgs": [
+    "--privileged"
+  ],
+  "remoteUser": "impdev",
+  "containerUser": "impdev",
+  "postCreateCommand": "echo 'yes' | bin/bootstrap_development.sh",
+  "customizations": {
+    "vscode": {
+      "extensions": [
+        "ms-vscode.cmake-tools",
+        "llvm-vs-code-extensions.vscode-clangd",
+        "vadimcn.vscode-lldb",
+        "webfreak.debug",
+        "vscjava.vscode-java-pack",
+        "ms-python.python"
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/bin/rat_exclude_files.txt b/bin/rat_exclude_files.txt
index 69bc099cb..b12b8eff5 100644
--- a/bin/rat_exclude_files.txt
+++ b/bin/rat_exclude_files.txt
@@ -5,6 +5,7 @@
 # in either its literal elements or its structure is not protected by copyright law;
 # therefore, such a file does not require a license header."
 .clang-format
+.devcontainer/*
 .gitattributes
 .gitignore
 */.gitignore


[impala] 01/02: IMPALA-12274: Fix memory leak from unreleased local reference

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dbecker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 748c3b894f943d0bba5bb25e066365f762e7ee43
Author: qqzhang <zh...@sensorsdata.cn>
AuthorDate: Mon Jul 10 10:46:18 2023 +0800

    IMPALA-12274: Fix memory leak from unreleased local reference
    
    In the constructor of the catalog class, after converting the catalog
    object created by NewObject to a global reference, the local reference
    was forgotten to be released, resulting in a minor memory leak.
    
    The solution is to use JniLocalFrame to automatically manage the local
    reference, ensuring proper memory management.
    
    Testing: manually test
    
    Change-Id: Ic93ea3270dcba3ad4903aa053cc283d4f700e948
    Reviewed-on: http://gerrit.cloudera.org:8080/20175
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/catalog/catalog.cc | 10 +++++++---
 be/src/catalog/catalog.h  |  3 ---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/be/src/catalog/catalog.cc b/be/src/catalog/catalog.cc
index dec23e053..3efc4b464 100644
--- a/be/src/catalog/catalog.cc
+++ b/be/src/catalog/catalog.cc
@@ -73,19 +73,23 @@ Catalog::Catalog() {
   };
 
   JNIEnv* jni_env = JniUtil::GetJNIEnv();
+  // Used to release local references promptly
+  JniLocalFrame jni_frame;
+  ABORT_IF_ERROR(jni_frame.push(jni_env));
+
   // Create an instance of the java class JniCatalog
-  catalog_class_ = jni_env->FindClass("org/apache/impala/service/JniCatalog");
+  jclass catalog_class = jni_env->FindClass("org/apache/impala/service/JniCatalog");
   ABORT_IF_EXC(jni_env);
 
   uint32_t num_methods = sizeof(methods) / sizeof(methods[0]);
   for (int i = 0; i < num_methods; ++i) {
-    ABORT_IF_ERROR(JniUtil::LoadJniMethod(jni_env, catalog_class_, &(methods[i])));
+    ABORT_IF_ERROR(JniUtil::LoadJniMethod(jni_env, catalog_class, &(methods[i])));
   }
 
   jbyteArray cfg_bytes;
   ABORT_IF_ERROR(GetThriftBackendGFlagsForJNI(jni_env, &cfg_bytes));
 
-  jobject catalog = jni_env->NewObject(catalog_class_, catalog_ctor_, cfg_bytes);
+  jobject catalog = jni_env->NewObject(catalog_class, catalog_ctor_, cfg_bytes);
   CLEAN_EXIT_IF_EXC(jni_env);
   ABORT_IF_ERROR(JniUtil::LocalToGlobalRef(jni_env, catalog, &catalog_));
 }
diff --git a/be/src/catalog/catalog.h b/be/src/catalog/catalog.h
index 315f72463..242383e1c 100644
--- a/be/src/catalog/catalog.h
+++ b/be/src/catalog/catalog.h
@@ -142,9 +142,6 @@ class Catalog {
   void RegenerateServiceId();
 
  private:
-  /// Descriptor of Java Catalog class itself, used to create a new instance.
-  jclass catalog_class_;
-
   jobject catalog_;  // instance of org.apache.impala.service.JniCatalog
   jmethodID update_metastore_id_;  // JniCatalog.updateMetaastore()
   jmethodID exec_ddl_id_;  // JniCatalog.execDdl()