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

ztao1987 pushed a commit to branch ztao
in repository https://gitbox.apache.org/repos/asf/hawq.git


The following commit(s) were added to refs/heads/ztao by this push:
     new cfb3a72  HAWQ-1831. fix core issue when metadatacache disabled
cfb3a72 is described below

commit cfb3a7217fcc708561dc76d20784c078cf46b1e4
Author: ztao1987 <zhenglin.ta...@gmail.com>
AuthorDate: Wed Feb 23 09:26:19 2022 +0800

    HAWQ-1831. fix core issue when metadatacache disabled
---
 src/backend/cdb/cdbdatalocality.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/backend/cdb/cdbdatalocality.c 
b/src/backend/cdb/cdbdatalocality.c
index 7fd6209..5a6615d 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -1442,8 +1442,8 @@ fetch_hdfs_data_block_location(char *filepath, int64 len, 
int *block_num,
                *hit_ratio = 0.0;
                return NULL;
        }
-       BlockLocation *locations;
-       HdfsFileInfo *file_info;
+       BlockLocation *locations = NULL;
+       HdfsFileInfo *file_info = NULL;
        //double hit_ratio;
        uint64_t beginTime;
        beginTime = gettime_microsec();
@@ -1461,7 +1461,12 @@ fetch_hdfs_data_block_location(char *filepath, int64 
len, int *block_num,
                }
                DestroyHdfsFileInfo(file_info);
        } else {
-               locations = HdfsGetFileBlockLocations(filepath, len, block_num);
+         BlockLocation *hdfs_locations = HdfsGetFileBlockLocations(filepath, 
len, block_num);
+         locations = CreateHdfsFileBlockLocations(hdfs_locations, *block_num);
+         if (hdfs_locations)
+         {
+           HdfsFreeFileBlockLocations(hdfs_locations, *block_num);
+         }
        }
        if (debug_print_split_alloc_result) {
                uint64 endTime = gettime_microsec();

Reply via email to