impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe McDonnell (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] Fix parquet table writer dictionary leak
Date Tue, 28 Feb 2017 23:34:05 GMT
Joe McDonnell has posted comments on this change.

Change subject: Fix parquet table writer dictionary leak
......................................................................


Patch Set 1:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/6181/1/be/src/exec/hdfs-table-sink.cc
File be/src/exec/hdfs-table-sink.cc:

Line 334:       OutputPartition* deletable_partition = current_clustered_partition_->first;
> Why not just delete it here and save the temp variable?
Done


Line 336:       delete(deletable_partition);
> delete deletable_partition; - delete is a keyword instead of a function
Done


Line 579:     OutputPartition* partition = new OutputPartition();
> Could we use a unique_ptr here and in PartitionPair to make the ownership e
The issue is that the OutputPartition is passed down to the table writers, which store it
and access it later (see HdfsTableWriter.output_). Other smart pointer options:

1. PartitionPair has shared_ptr to OutputPartition. HdfsTableWriter has a shared_ptr to OutputPartition.
When ready to free the OutputPartition, the writer needs to release its shared_ptr (or the
OutputPartition needs to reset its scoped_ptr to the writer), etc. But we have to explicitly
break the circle.
2. PartitionPair has a shared_ptr to OutputPartition. HdfsTableWriter has a weak_ptr to OutputPartition.
The weak_ptr must be upgraded to shared_ptr to access the OutputPartition. When ready to free
the OutputPartition, the HdfsTableWriter is in the weak_ptr state, so the free goes through
normally.

I'm new to smart pointers, so there might be something I'm missing.


Line 587:       delete(partition);
> delete partition;
Done


-- 
To view, visit http://gerrit.cloudera.org:8080/6181
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I06e354086ad24071d4fbf823f25f5df23933688f
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Joe McDonnell <joemcdonnell@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <joemcdonnell@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <tarmstrong@cloudera.com>
Gerrit-HasComments: Yes

Mime
View raw message