Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1629635 fix connection pool allocation #1024

Merged
merged 5 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Snowflake.Data/Client/SnowflakeDbConnectionPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using Snowflake.Data.Core;
using Snowflake.Data.Core.Session;
using Snowflake.Data.Core.Tools;
using Snowflake.Data.Log;

namespace Snowflake.Data.Client
Expand Down Expand Up @@ -129,6 +130,9 @@ internal static void SetConnectionPoolVersion(ConnectionPoolType requestedPoolTy
{
lock (s_connectionManagerInstanceLock)
{
if (s_connectionManager != null)
sfc-gh-knozderko marked this conversation as resolved.
Show resolved Hide resolved
return;
Diagnostics.LogDiagnostics();
s_connectionManager?.ClearAllPools();
if (requestedPoolType == ConnectionPoolType.MultipleConnectionPool)
{
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/Session/SFSessionProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
typeof(SFSessionProperty), keys[i].ToUpper());
properties.Add(p, values[i]);
}
catch (ArgumentException e)

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

The variable 'e' is declared but never used

Check warning on line 216 in Snowflake.Data/Core/Session/SFSessionProperty.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

The variable 'e' is declared but never used
sfc-gh-pbulawa marked this conversation as resolved.
Show resolved Hide resolved
{
logger.Warn($"Property {keys[i]} not found ignored.", e);
logger.Debug($"Property {keys[i]} not found ignored.");
}
}

Expand Down
62 changes: 62 additions & 0 deletions Snowflake.Data/Core/Tools/Diagnostics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Text;
using Snowflake.Data.Log;

namespace Snowflake.Data.Core.Tools
{
internal class Diagnostics
{
private const int PadRight = -25;
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<Diagnostics>();

public static void LogDiagnostics() => s_logger.Info(GetDiagnosticInfo());

private static string GetDiagnosticInfo()
{
StringBuilder info = new StringBuilder("System Diagnostics:\n");
info.AppendLine($"{"OS", PadRight}: {OsName()}");
info.AppendLine($"{"OS Description", PadRight}: {RuntimeInformation.OSDescription}");
info.AppendLine($"{"OS Architecture", PadRight}: {RuntimeInformation.OSArchitecture}");
info.AppendLine($"{"OS Version", PadRight}: {Environment.OSVersion}");
info.AppendLine($"{"OS x64", PadRight}: {Environment.Is64BitOperatingSystem}");
info.AppendLine($"{"Processor Architecture", PadRight}: {RuntimeInformation.ProcessArchitecture}");
info.AppendLine($"{"Processor Count", PadRight}: {Environment.ProcessorCount}");
info.AppendLine($"{".NET Framework", PadRight}: {RuntimeInformation.FrameworkDescription}");
info.AppendLine($"{"CLR Runtime Version", PadRight}: {Environment.Version}");
info.AppendLine($"{"App x64", PadRight}: {Environment.Is64BitProcess}");
info.AppendLine($"{"GC Server Mode", PadRight}: {GCSettings.IsServerGC}");
info.AppendLine($"{"GC LOH Compaction Mode", PadRight}: {GCSettings.LargeObjectHeapCompactionMode}");
info.AppendLine($"{"GC Latency Mode", PadRight}: {GCSettings.LatencyMode}");
info.AppendLine($"{"GC Total Memory", PadRight}: {GC.GetTotalMemory(false)}");
AppendAssemblyInfo(info, Assembly.GetEntryAssembly(), "App");
AppendAssemblyInfo(info, Assembly.GetExecutingAssembly(), "Driver");
return info.ToString();
}

private static void AppendAssemblyInfo(StringBuilder info, Assembly assembly, string assemblyTag)
{
if (assembly != null)
{
var assemblyVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
info.AppendLine($"{assemblyTag + " Name", PadRight}: {assemblyVersion.InternalName}");
info.AppendLine($"{assemblyTag + " File", PadRight}: {assemblyVersion.FileName}");
info.AppendLine($"{assemblyTag + " Version", PadRight}: {assemblyVersion.FileVersion}");
}
}

private static string OsName()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return "UNIX";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return "WINDOWS";
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return "OSX";
return "Unknown";
}
}
}
Loading