[ 
https://issues.apache.org/jira/browse/HIVE-23069?focusedWorklogId=459152&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-459152
 ]

ASF GitHub Bot logged work on HIVE-23069:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Jul/20 09:11
            Start Date: 15/Jul/20 09:11
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #1225:
URL: https://github.com/apache/hive/pull/1225#discussion_r454907711



##########
File path: 
ql/src/test/org/apache/hadoop/hive/ql/exec/repl/util/TestFileList.java
##########
@@ -0,0 +1,145 @@
+/*
+ * 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.FSDataOutputStream;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.parse.SemanticException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedWriter;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LoggerFactory.class})
+public class TestFileList {
+
+  @Mock
+  private HiveConf hiveConf;
+
+  @Mock
+  BufferedWriter bufferedWriter;
+
+  @Test
+  public void testNoStreaming() throws Exception {
+    
Mockito.when(hiveConf.getBoolVar(HiveConf.ConfVars.REPL_DATA_COPY_LAZY)).thenReturn(false);
+    Path backingFile  = new Path("/tmp/backingFile");
+    FileList fileList = new FileList(backingFile, 100, hiveConf);
+    fileList.add("Entry1");
+    fileList.add("Entry2");
+    assertFalse(fileList.isStreamingToFile());
+  }
+
+  @Test
+  public void testAlwaysStreaming() throws Exception {
+    
Mockito.when(hiveConf.getBoolVar(HiveConf.ConfVars.REPL_DATA_COPY_LAZY)).thenReturn(true);
+    FileListStreamer.setBackingFileWriterInTest(bufferedWriter);
+    Path backingFile  = new Path("/tmp/backingFile");
+    FileList fileList = new FileList(backingFile, 100, hiveConf);
+    assertFalse(fileList.isStreamingInitialized());
+    fileList.add("Entry1");
+    waitForStreamingInitialization(fileList);
+    assertTrue(fileList.isStreamingToFile());
+    fileList.close();
+    waitForStreamingClosure(fileList);
+  }
+
+  @Test
+  public void testStreaminOnCacheHit() throws Exception {
+    
Mockito.when(hiveConf.getBoolVar(HiveConf.ConfVars.REPL_DATA_COPY_LAZY)).thenReturn(false);
+    FileListStreamer.setBackingFileWriterInTest(bufferedWriter);
+    Path backingFile  = new Path("/tmp/backingFile");
+    FileList fileList = new FileList(backingFile, 5, hiveConf);
+    fileList.add("Entry1");
+    fileList.add("Entry2");
+    fileList.add("Entry3");
+    Thread.sleep(5000L);
+    assertFalse(fileList.isStreamingInitialized());
+    fileList.add("Entry4");
+    fileList.add("Entry5");
+    waitForStreamingInitialization(fileList);
+    fileList.close();
+    waitForStreamingClosure(fileList);

Review comment:
       We already have ArgumentCaptor so it should be written. And there are 
other tests backing the file write being successful.




----------------------------------------------------------------
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: 459152)
    Time Spent: 3.5h  (was: 3h 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, HIVE-23069.02.patch
>
>          Time Spent: 3.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)

Reply via email to