File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1+ - Added 'x-ydb-client-pid' header to any RPC calls
12- Added DisableServerBalancer option to ADO.NET session creation; default false.
23
34## v0.20.1
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ namespace Ydb.Sdk;
66
77public class DriverConfig
88{
9+ private readonly string _pid = Environment . ProcessId . ToString ( ) ;
10+
911 public string Endpoint { get ; }
1012 public string Database { get ; }
1113 public ICredentialsProvider ? Credentials { get ; }
@@ -61,7 +63,8 @@ public DriverConfig(
6163 internal Grpc . Core . Metadata GetCallMetadata => new ( )
6264 {
6365 { Metadata . RpcDatabaseHeader , Database } ,
64- { Metadata . RpcSdkInfoHeader , SdkVersion }
66+ { Metadata . RpcSdkInfoHeader , SdkVersion } ,
67+ { Metadata . RpcClientPid , _pid }
6568 } ;
6669
6770 private static string FormatEndpoint ( string endpoint )
Original file line number Diff line number Diff line change 22
33internal static class Metadata
44{
5+ // Outgoing headers
56 public const string RpcDatabaseHeader = "x-ydb-database" ;
67 public const string RpcAuthHeader = "x-ydb-auth-ticket" ;
78 public const string RpcRequestTypeHeader = "x-ydb-request-type" ;
89 public const string RpcTraceIdHeader = "x-ydb-trace-id" ;
910 public const string RpcSdkInfoHeader = "x-ydb-sdk-build-info" ;
11+ public const string RpcClientPid = "x-ydb-client-pid" ;
12+
13+ // Incoming headers
1014 public const string RpcServerHintsHeader = "x-ydb-server-hints" ;
1115 public const string RpcClientCapabilitiesHeader = "x-ydb-client-capabilities" ;
1216
17+ //Incoming hints
1318 public const string GracefulShutdownHint = "session-close" ;
1419}
Original file line number Diff line number Diff line change 1+ using Xunit ;
2+ using Ydb . Sdk . Tests . Ado . Specification ;
3+ using Ydb . Sdk . Tests . Fixture ;
4+
5+ namespace Ydb . Sdk . Tests . Sys ;
6+
7+ public class QuerySessionTests : YdbAdoNetFixture
8+ {
9+ public QuerySessionTests ( YdbFactoryFixture fixture ) : base ( fixture )
10+ {
11+ }
12+
13+ [ Fact ]
14+ public async Task QuerySessionPidTest ( )
15+ {
16+ await using var connection = await CreateOpenConnectionAsync ( ) ;
17+ var dbCommand = connection . CreateCommand ( ) ;
18+ dbCommand . CommandText = "SELECT ClientPID FROM `.sys/query_sessions` LIMIT 1;" ;
19+
20+ var expectedPid = Environment . ProcessId . ToString ( ) ;
21+
22+ await dbCommand . ExecuteNonQueryAsync ( ) ;
23+ await using var reader = await dbCommand . ExecuteReaderAsync ( ) ;
24+
25+ Assert . True ( reader . HasRows ) ;
26+ Assert . True ( await reader . ReadAsync ( ) ) ;
27+ Assert . Equal ( reader . GetString ( 0 ) , expectedPid ) ;
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments