Skip to content

Commit

Permalink
[profile](bugfix) should not cache profile content because the profil…
Browse files Browse the repository at this point in the history
…e may not be a full profile (#27635)

---------

Co-authored-by: yiguolei <yiguolei@gmail.com>
  • Loading branch information
yiguolei and Doris-Extras authored Nov 28, 2023
1 parent 71758ec commit 2a33535
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public ProfileElement(RuntimeProfile profile) {
}

private final RuntimeProfile profile;
// cache the result of getProfileContent method
private volatile String profileContent;
public Map<String, String> infoStrings = Maps.newHashMap();
public MultiProfileTreeBuilder builder = null;
public String errMsg = "";
Expand All @@ -81,12 +79,8 @@ public ProfileElement(RuntimeProfile profile) {

// lazy load profileContent because sometimes profileContent is very large
public String getProfileContent() {
if (profileContent != null) {
return profileContent;
}
// no need to lock because the possibility of concurrent read is very low
profileContent = profile.toString();
return profileContent;
return profile.toString();
}

public String getProfileBrief() {
Expand All @@ -103,7 +97,8 @@ public void setStatsErrorEstimator(StatsErrorEstimator statsErrorEstimator) {
}
}

// only protect queryIdDeque; queryIdToProfileMap is concurrent, no need to protect
// only protect queryIdDeque; queryIdToProfileMap is concurrent, no need to
// protect
private ReentrantReadWriteLock lock;
private ReadLock readLock;
private WriteLock writeLock;
Expand Down Expand Up @@ -165,7 +160,8 @@ public void pushProfile(RuntimeProfile profile) {
ProfileElement element = createElement(profile);
// 'insert into' does have job_id, put all profiles key with query_id
String key = element.infoStrings.get(SummaryProfile.PROFILE_ID);
// check when push in, which can ensure every element in the list has QUERY_ID column,
// check when push in, which can ensure every element in the list has QUERY_ID
// column,
// so there is no need to check when remove element from list.
if (Strings.isNullOrEmpty(key)) {
LOG.warn("the key or value of Map is null, "
Expand Down

0 comments on commit 2a33535

Please sign in to comment.