[ https://issues.apache.org/jira/browse/HIVE-23069?focusedWorklogId=457126&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-457126 ]
ASF GitHub Bot logged work on HIVE-23069: ----------------------------------------- Author: ASF GitHub Bot Created on: 10/Jul/20 12:29 Start Date: 10/Jul/20 12:29 Worklog Time Spent: 10m Work Description: pkumarsinha commented on a change in pull request #1225: URL: https://github.com/apache/hive/pull/1225#discussion_r452812001 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/FileList.java ########## @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.exec.repl.util; + +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.parse.SemanticException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.concurrent.LinkedBlockingQueue; + + +/** + * A file backed list of Strings which is in-memory till the threshold. + */ +public class FileList implements Closeable, Iterator<String> { + private static final Logger LOG = LoggerFactory.getLogger(FileList.class); + private static int fileListStreamerID = 0; + private static final String FILE_LIST_STREAMER_PREFIX = "file-list-streamer-"; + + private LinkedBlockingQueue<String> cache; + private volatile boolean thresholdHit = false; + private int thresholdPoint; + private float thresholdFactor = 0.9f; + private Path backingFile; + private FileListStreamer fileListStreamer; + private FileListOpMode fileListOpMode; + private String nextElement; + private boolean noMoreElement; + private HiveConf conf; + private BufferedReader backingFileReader; + private volatile boolean asyncMode; + + + /** + * To be used only for READ mode; + */ + public FileList(Path backingFile, HiveConf conf) { + this.backingFile = backingFile; + thresholdHit = true; + fileListOpMode = FileListOpMode.READ; + this.conf = conf; + } + + /** + * To be used only for WRITE mode; + */ + public FileList(Path backingFile, int cacheSize, HiveConf conf, boolean asyncMode) throws IOException { Review comment: If it is called other wise, it won't allow to use it anyway. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 457126) Time Spent: 1.5h (was: 1h 20m) > Memory efficient iterator should be used during replication. > ------------------------------------------------------------ > > Key: HIVE-23069 > URL: https://issues.apache.org/jira/browse/HIVE-23069 > Project: Hive > Issue Type: Improvement > Reporter: Pravin Sinha > Assignee: Pravin Sinha > Priority: Major > Labels: pull-request-available > Attachments: HIVE-23069.01.patch > > Time Spent: 1.5h > Remaining Estimate: 0h > > Currently the iterator used while copying table data is memory based. In case > of a database with very large number of table/partitions, such iterator may > cause HS2 process to go OOM. > Also introduces a config option to run data copy tasks during repl load > operation. -- This message was sent by Atlassian Jira (v8.3.4#803005)