From 2260a558158210e112bf5244d47ca09837e5baaf Mon Sep 17 00:00:00 2001 From: Shige Takeda Date: Mon, 22 Apr 2019 09:33:41 -0700 Subject: [PATCH] SNOW-74563: Added a chunkdownloader switch to back to old algorithm --- .../Configuration/SFConfiguration.cs | 6 ++++++ Snowflake.Data/Core/ChunkDownloaderFactory.cs | 21 +++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Snowflake.Data/Configuration/SFConfiguration.cs b/Snowflake.Data/Configuration/SFConfiguration.cs index 6945c3b4b..1ff42be8f 100755 --- a/Snowflake.Data/Configuration/SFConfiguration.cs +++ b/Snowflake.Data/Configuration/SFConfiguration.cs @@ -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(); diff --git a/Snowflake.Data/Core/ChunkDownloaderFactory.cs b/Snowflake.Data/Core/ChunkDownloaderFactory.cs index f84020292..fd803ad72 100755 --- a/Snowflake.Data/Core/ChunkDownloaderFactory.cs +++ b/Snowflake.Data/Core/ChunkDownloaderFactory.cs @@ -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,