You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/30 08:13:00 UTC

[jira] [Work logged] (HIVE-24327) AtlasServer entity may not be present during first Atlas metadata dump

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

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

                Author: ASF GitHub Bot
            Created on: 30/Oct/20 08:12
            Start Date: 30/Oct/20 08:12
    Worklog Time Spent: 10m 
      Work Description: aasha commented on a change in pull request #1623:
URL: https://github.com/apache/hive/pull/1623#discussion_r514930424



##########
File path: ql/src/test/org/apache/hadoop/hive/ql/exec/repl/TestAtlasDumpTask.java
##########
@@ -175,4 +174,58 @@ public void testRetryingClientTimeBasedExhausted() throws AtlasServiceException
     }
     Assert.assertTrue(inputStream == null);
   }
+
+  @Test
+  public void testAtlasServerEntity() throws AtlasServiceException, SemanticException {
+    AtlasClientV2 atlasClientV2 = mock(AtlasClientV2.class);
+    AtlasServer atlasServer = mock(AtlasServer.class);
+    when(atlasClientV2.getServer(anyString())).thenReturn(atlasServer);
+    AtlasRestClient atlasClient = new AtlasRestClientImpl(atlasClientV2, conf);
+    AtlasServer atlasServerRet = atlasClient.getServer("src", conf);
+    Assert.assertTrue(atlasServer == atlasServerRet);
+  }
+
+  @Test
+  public void testAtlasServerEntityNotFound() throws AtlasServiceException, SemanticException {
+    setupConfForRetry();
+    AtlasServiceException atlasServiceException = mock(AtlasServiceException.class);
+    ClientResponse.Status status = mock(ClientResponse.Status.class);
+    when(atlasServiceException.getStatus()).thenReturn(status);
+    when(status.getStatusCode()).thenReturn(404);
+    AtlasClientV2 atlasClientV2 = mock(AtlasClientV2.class);
+    when(atlasClientV2.getServer(anyString())).thenThrow(atlasServiceException);
+    AtlasRestClient atlasClient = new AtlasRestClientImpl(atlasClientV2, conf);
+    AtlasServer atlasServerRet = atlasClient.getServer("src", conf);
+    Assert.assertNull(atlasServerRet);
+    ArgumentCaptor<String> getServerReqCaptor = ArgumentCaptor.forClass(String.class);
+    Mockito.verify(atlasClientV2, Mockito.times(1)).getServer(getServerReqCaptor.capture());
+  }
+
+  @Test
+  public void testAtlasServerEntityRetryExhausted() throws AtlasServiceException {
+    setupConfForRetry();
+    AtlasServiceException atlasServiceException = mock(AtlasServiceException.class);
+    ClientResponse.Status status = mock(ClientResponse.Status.class);
+    when(atlasServiceException.getStatus()).thenReturn(status);
+    when(status.getStatusCode()).thenReturn(400);
+    AtlasClientV2 atlasClientV2 = mock(AtlasClientV2.class);
+    when(atlasClientV2.getServer(anyString())).thenThrow(atlasServiceException);
+    AtlasRestClient atlasClient = new AtlasRestClientImpl(atlasClientV2, conf);
+    try {
+      atlasClient.getServer("src", conf);
+      Assert.fail("Should have thrown SemanticException.");
+    } catch (SemanticException ex) {
+      Assert.assertTrue(ex.getMessage().contains("Retry exhausted for retryable error code"));

Review comment:
       the stack trace should be atlas exception. please add a comparison for that.




----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 506571)
    Time Spent: 20m  (was: 10m)

> AtlasServer entity may not be present during first Atlas metadata dump
> ----------------------------------------------------------------------
>
>                 Key: HIVE-24327
>                 URL: https://issues.apache.org/jira/browse/HIVE-24327
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Pravin Sinha
>            Assignee: Pravin Sinha
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-24327.01.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)