Skip to content

Commit

Permalink
SNOW-576187: Don't append retryCount to the scoped URL for chunk down…
Browse files Browse the repository at this point in the history
…loading (#907)

When fetching result chunk, don't append retryCount to the scoped URL
  • Loading branch information
sfc-gh-wshangguan authored Apr 15, 2022
1 parent e7bfcb6 commit 262486c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ else if (context.getQrmk() != null) {
0, // no socketime injection
null, // no canceling
false, // no cookie
false, // no retry
false, // no retry parameters in url
false, // no request_guid
true // retry on HTTP403 for AWS S3
);
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/snowflake/client/jdbc/RestRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ public static CloseableHttpResponse execute(
* overhead of looking up in metadata database.
*/
URIBuilder builder = new URIBuilder(httpRequest.getURI());
if (retryCount > 0) {
if (includeRetryParameters && retryCount > 0) {
builder.setParameter("retryCount", String.valueOf(retryCount));
if (includeRetryParameters) {
builder.setParameter("clientStartTime", String.valueOf(startTime));
}
builder.setParameter("clientStartTime", String.valueOf(startTime));
}

// When the auth timeout is set, set the socket timeout as the authTimeout
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/net/snowflake/client/jdbc/RestRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;

import java.io.IOException;
Expand Down Expand Up @@ -130,9 +131,7 @@ public CloseableHttpResponse answer(InvocationOnMock invocation) throws Throwabl
HttpUriRequest arg = (HttpUriRequest) invocation.getArguments()[0];
String params = arg.getURI().getQuery();

if (callCount > 0) {
assertTrue(params.contains("retryCount=" + callCount));
}
assertFalse(params.contains("retryCount="));
assertFalse(params.contains("clientStartTime="));
assertTrue(params.contains("request_guid="));

Expand Down

0 comments on commit 262486c

Please sign in to comment.