You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Xiang Yang (Code Review)" <ge...@cloudera.org> on 2023/07/01 07:42:47 UTC

[Impala-ASF-CR] IMPALA-6876: Fix possible memory leak in CatalogTableMetrics after reset metadata.

Hello Quanlong Huang, Wenzhe Zhou, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20096

to look at the new patch set (#8).

Change subject: IMPALA-6876: Fix possible memory leak in CatalogTableMetrics after reset metadata.
......................................................................

IMPALA-6876: Fix possible memory leak in CatalogTableMetrics after reset metadata.

The CatalogTableMetrics maintains a cache of 'org.apache.impala.catalog.
Table' which may obtain references to CatalogServiceCatalog 'dbCache_'
field's old value after 'invalidate metadata' triggered, in which case
the old db cache can't be recycled by GC, and causing a possible memory
leak in catalogd.

The solution is simpling the cache element's type to a new class
'TableMetric' which only contains necessary value fields and doesn't
contains complex reference such as 'org.apache.impala.catalog.Db'.

Testing:
 - Manually test:
   1. trigger CatalogTableMetrics's cache by executing general query on
      some tables and other SQL such as 'create table like' SQL.
   2. execute 'invalidate metadata' to trigger catalog version upgrade.
   3. dump catalogd's JVM memory image by command 'jmap -dump:live,
      format=b,file=<path> <catalog_pid>'.
   4. count the 'org.apache.impala.catalog.Db' class's object number
      by analyze the dump file using Eclipse Memory Analyzer, and check
      whether the Db's object number match the actual.
 - Add FE test 'CatalogTableMetricsTest'.

Change-Id: Ib91635cc40878cbb76b71ee7d81418ea753892c3
---
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/monitor/CatalogTableMetrics.java
A fe/src/main/java/org/apache/impala/catalog/monitor/TableLoadingTimeHistogram.java
M fe/src/main/java/org/apache/impala/common/Pair.java
M fe/src/main/java/org/apache/impala/util/TopNCache.java
A fe/src/test/java/org/apache/impala/catalog/monitor/CatalogTableMetricsTest.java
6 files changed, 238 insertions(+), 66 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/96/20096/8
-- 
To view, visit http://gerrit.cloudera.org:8080/20096
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib91635cc40878cbb76b71ee7d81418ea753892c3
Gerrit-Change-Number: 20096
Gerrit-PatchSet: 8
Gerrit-Owner: Xiang Yang <yx...@126.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Xiang Yang <yx...@126.com>