From a607e9e7ff92c0be47e1717f63dd74108d5d3a30 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Fri, 21 Aug 2020 17:37:49 -0700 Subject: [PATCH] introduce interning of internal files names in SmooshedFileMapper (#10295) --- .../java/util/common/io/smoosh/SmooshedFileMapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java b/core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java index 5921ee098e7..dbc01ebf274 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java +++ b/core/src/main/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapper.java @@ -19,6 +19,8 @@ package org.apache.druid.java.util.common.io.smoosh; +import com.google.common.collect.Interner; +import com.google.common.collect.Interners; import com.google.common.collect.Lists; import com.google.common.io.Closeables; import com.google.common.io.Files; @@ -46,6 +48,8 @@ import java.util.TreeMap; */ public class SmooshedFileMapper implements Closeable { + private static final Interner STRING_INTERNER = Interners.newWeakInterner(); + public static SmooshedFileMapper load(File baseDir) throws IOException { File metaFile = FileSmoosher.metaFile(baseDir); @@ -81,7 +85,7 @@ public class SmooshedFileMapper implements Closeable throw new ISE("Wrong number of splits[%d] in line[%s]", splits.length, line); } internalFiles.put( - splits[0], + STRING_INTERNER.intern(splits[0]), new Metadata(Integer.parseInt(splits[1]), Integer.parseInt(splits[2]), Integer.parseInt(splits[3])) ); }