Skip to content

Commit

Permalink
SNOW-74563: Added a chunkdownloader switch to back to old algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
smtakeda authored and ankit-bhatnagar167 committed Apr 22, 2019
1 parent eca2b4d commit 2260a55
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Snowflake.Data/Configuration/SFConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ public class SFConfiguration
{
public Boolean UseV2JsonParser;

// Leave this configuration for backward compatibility.
// We would discard it after we announce this change.
// Right now, when this is true, it would disable the ChunkDownloaderVersion
public Boolean UseV2ChunkDownloader;

public int ChunkDownloaderVersion;

private SFConfiguration()
{
UseV2JsonParser = true;
UseV2ChunkDownloader = false;
ChunkDownloaderVersion = 3;
}

private readonly static SFConfiguration Config = new SFConfiguration();
Expand Down
21 changes: 15 additions & 6 deletions Snowflake.Data/Core/ChunkDownloaderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,25 @@ public static IChunkDownloader GetDownloader(QueryExecResponseData responseData,
CancellationToken cancellationToken)
{
if (SFConfiguration.Instance().UseV2ChunkDownloader)
SFConfiguration.Instance().ChunkDownloaderVersion = 2;

switch (SFConfiguration.Instance().ChunkDownloaderVersion)
{
return new SFChunkDownloaderV2(responseData.rowType.Count,
case 1:
return new SFBlockingChunkDownloader(responseData.rowType.Count,
responseData.chunks,
responseData.qrmk,
responseData.chunkHeaders,
cancellationToken);
}
else
{
return new SFBlockingChunkDownloaderV3(responseData.rowType.Count,
cancellationToken,
resultSet);
case 2:
return new SFChunkDownloaderV2(responseData.rowType.Count,
responseData.chunks,
responseData.qrmk,
responseData.chunkHeaders,
cancellationToken);
default:
return new SFBlockingChunkDownloaderV3(responseData.rowType.Count,
responseData.chunks,
responseData.qrmk,
responseData.chunkHeaders,
Expand Down

0 comments on commit 2260a55

Please sign in to comment.