Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
487 changes: 487 additions & 0 deletions docs/SessionPool_Exception_Handling.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Apache.IoTDB.Data/IoTDBDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ internal IoTDBDataReader(IoTDBCommand IoTDBCommand, SessionDataSet dataSet, bool
_command = IoTDBCommand;
_closeConnection = closeConnection;
_fieldCount = dataSet.ColumnNames.Count;
_hasRows = dataSet.RowCount > 0;
_recordsAffected = dataSet.RowCount;
_hasRows = dataSet.CurrentBatchRowCount() > 0;
_recordsAffected = -1; // Total row count is unknown; use -1 per ADO.NET convention
_closed = _closeConnection;
_metas = dataSet.ColumnNames;
_dataSet = dataSet;
Expand Down
68 changes: 38 additions & 30 deletions src/Apache.IoTDB/ConcurrentClientQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Apache.IoTDB
public class ConcurrentClientQueue
{
public ConcurrentQueue<Client> ClientQueue { get; }
internal IPoolDiagnosticReporter DiagnosticReporter { get; set; }

public ConcurrentClientQueue(List<Client> clients)
{
Expand All @@ -42,55 +43,62 @@ public ConcurrentClientQueue()
public void Return(Client client)
{
Monitor.Enter(ClientQueue);
ClientQueue.Enqueue(client);
Monitor.PulseAll(ClientQueue); // wake up all threads waiting on the queue, refresh the waiting time
Monitor.Exit(ClientQueue);
Thread.Sleep(0);
}
int _ref = 0;
public void AddRef()
{
lock (this)
try
{
_ref++;
ClientQueue.Enqueue(client);
Monitor.PulseAll(ClientQueue); // wake up all threads waiting on the queue, refresh the waiting time
}
}
public int GetRef()
{
return _ref;
}
public void RemoveRef()
{
lock (this)
finally
{
_ref--;
Monitor.Exit(ClientQueue);
}
Thread.Sleep(0);
}
private int _ref = 0;
public void AddRef() => Interlocked.Increment(ref _ref);
public int GetRef() => Volatile.Read(ref _ref);
public void RemoveRef() => Interlocked.Decrement(ref _ref);
public int Timeout { get; set; } = 10;
public Client Take()
{
Client client = null;
Monitor.Enter(ClientQueue);
while (true)
try
{
bool timeout = false;
if (ClientQueue.IsEmpty)
while (true)
{
timeout = !Monitor.Wait(ClientQueue, TimeSpan.FromSeconds(Timeout));
}
ClientQueue.TryDequeue(out client);
bool timeout = false;
if (ClientQueue.IsEmpty)
{
timeout = !Monitor.Wait(ClientQueue, TimeSpan.FromSeconds(Timeout));
}
ClientQueue.TryDequeue(out client);

if (client != null || timeout)
{
break;
if (client != null || timeout)
{
break;
}
}
}
Monitor.Exit(ClientQueue);
finally
{
Monitor.Exit(ClientQueue);
}
if (client == null)
{
throw new TimeoutException($"Connection pool is empty and wait time out({Timeout}s)!");
var reasonPhrase = $"Connection pool is empty and wait time out({Timeout}s)";
if (DiagnosticReporter != null)
{
throw DiagnosticReporter.BuildDepletionException(reasonPhrase);
}
throw new TimeoutException(reasonPhrase);
}
return client;
}
}

internal interface IPoolDiagnosticReporter
{
SessionPoolDepletedException BuildDepletionException(string reasonPhrase);
}
}
68 changes: 44 additions & 24 deletions src/Apache.IoTDB/DataStructure/ByteBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

using System;
using System.Linq;
using System.Text;

namespace Apache.IoTDB.DataStructure
Expand Down Expand Up @@ -70,9 +69,12 @@ public bool GetBool()
public int GetInt()
{
var intBuff = _buffer[_readPos..(_readPos + 4)];
if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(intBuff);
}
#if NET461_OR_GREATER || NETSTANDARD2_0
var intValue = BitConverter.ToInt32(intBuff,0);
var intValue = BitConverter.ToInt32(intBuff, 0);
#else
var intValue = BitConverter.ToInt32(intBuff);
#endif
Expand All @@ -84,10 +86,12 @@ public int GetInt()
public long GetLong()
{
var longBuff = _buffer[_readPos..(_readPos + 8)];

if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(longBuff);
}
#if NET461_OR_GREATER || NETSTANDARD2_0
var longValue = BitConverter.ToInt64(longBuff,0);
var longValue = BitConverter.ToInt64(longBuff, 0);
#else
var longValue = BitConverter.ToInt64(longBuff);
#endif
Expand All @@ -99,10 +103,12 @@ public long GetLong()
public float GetFloat()
{
var floatBuff = _buffer[_readPos..(_readPos + 4)];

if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(floatBuff);
}
#if NET461_OR_GREATER || NETSTANDARD2_0
var floatValue = BitConverter.ToSingle(floatBuff,0);
var floatValue = BitConverter.ToSingle(floatBuff, 0);
#else
var floatValue = BitConverter.ToSingle(floatBuff);
#endif
Expand All @@ -113,10 +119,12 @@ public float GetFloat()
public double GetDouble()
{
var doubleBuff = _buffer[_readPos..(_readPos + 8)];

if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(doubleBuff);
}
#if NET461_OR_GREATER || NETSTANDARD2_0
var doubleValue = BitConverter.ToDouble(doubleBuff,0);
var doubleValue = BitConverter.ToDouble(doubleBuff, 0);
#else
var doubleValue = BitConverter.ToDouble(doubleBuff);
#endif
Expand Down Expand Up @@ -162,8 +170,10 @@ private void ExtendBuffer(int spaceNeed)
public void AddBool(bool value)
{
var boolBuffer = BitConverter.GetBytes(value);

if (_isLittleEndian) boolBuffer = boolBuffer.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(boolBuffer);
}

ExtendBuffer(boolBuffer.Length);
boolBuffer.CopyTo(_buffer, _writePos);
Expand All @@ -173,8 +183,10 @@ public void AddBool(bool value)
public void AddInt(int value)
{
var intBuff = BitConverter.GetBytes(value);

if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(intBuff);
}

ExtendBuffer(intBuff.Length);
intBuff.CopyTo(_buffer, _writePos);
Expand All @@ -184,8 +196,10 @@ public void AddInt(int value)
public void AddLong(long value)
{
var longBuff = BitConverter.GetBytes(value);

if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(longBuff);
}

ExtendBuffer(longBuff.Length);
longBuff.CopyTo(_buffer, _writePos);
Expand All @@ -195,8 +209,10 @@ public void AddLong(long value)
public void AddFloat(float value)
{
var floatBuff = BitConverter.GetBytes(value);

if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(floatBuff);
}

ExtendBuffer(floatBuff.Length);
floatBuff.CopyTo(_buffer, _writePos);
Expand All @@ -206,8 +222,10 @@ public void AddFloat(float value)
public void AddDouble(double value)
{
var doubleBuff = BitConverter.GetBytes(value);

if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(doubleBuff);
}

ExtendBuffer(doubleBuff.Length);
doubleBuff.CopyTo(_buffer, _writePos);
Expand Down Expand Up @@ -237,8 +255,10 @@ public void AddBinary(byte[] value)
public void AddChar(char value)
{
var charBuf = BitConverter.GetBytes(value);

if (_isLittleEndian) charBuf = charBuf.Reverse().ToArray();
if (_isLittleEndian)
{
Array.Reverse(charBuf);
}

ExtendBuffer(charBuf.Length);
charBuf.CopyTo(_buffer, _writePos);
Expand Down
18 changes: 17 additions & 1 deletion src/Apache.IoTDB/DataStructure/SessionDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,22 @@
private int Flag => 0x80;
private int DefaultTimeout => 10000;
public int FetchSize { get; set; }

/// <summary>
/// Gets the number of rows in the current fetched batch.
/// Note: This is NOT the total row count of the query result. Use HasNext() to check for more data.
/// </summary>
/// <returns>The number of rows in the current batch.</returns>
public int CurrentBatchRowCount() => _currentBatchRowCount;

/// <summary>
/// Gets the number of rows in the current fetched batch.
/// </summary>
/// <returns>The number of rows in the current batch.</returns>
[Obsolete("Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.")]
public int RowCount { get; set; }

private int _currentBatchRowCount;
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field '_currentBatchRowCount' can be 'readonly'.

Suggested change
private int _currentBatchRowCount;
private readonly int _currentBatchRowCount;

Copilot uses AI. Check for mistakes.
public SessionDataSet(string sql, TSExecuteStatementResp resp, Client client, ConcurrentClientQueue clientQueue, long statementId)
{
_clientQueue = clientQueue;
Expand All @@ -74,7 +89,8 @@
// some internal variable
_hasCatchedResult = false;
_rowIndex = 0;
RowCount = _queryDataset.Time.Length / sizeof(long);
_currentBatchRowCount = _queryDataset.Time.Length / sizeof(long);
RowCount = _currentBatchRowCount;

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

Check warning on line 93 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'SessionDataSet.RowCount' is obsolete: 'Use CurrentBatchRowCount() instead. This property returns batch size, not total row count.'

_columnNames = resp.Columns;
_columnTypeLst = resp.DataTypeList;
Expand Down Expand Up @@ -262,7 +278,7 @@

long timestamp = _timeBuffer.GetLong();
_rowIndex += 1;
_cachedRowRecord = new RowRecord(timestamp, fieldLst, _columnNames);

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'

Check warning on line 281 in src/Apache.IoTDB/DataStructure/SessionDataSet.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'RowRecord.RowRecord(long, List<object>, List<string>)' is obsolete: 'Use the constructor with List<TSDataType> instead'
}

private bool IsNull(int loc, int row_index)
Expand Down
52 changes: 52 additions & 0 deletions src/Apache.IoTDB/PoolHealthMetrics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Threading;

namespace Apache.IoTDB
{
/// <summary>
/// Encapsulates real-time health statistics for connection pool monitoring.
/// Thread-safe implementation for concurrent access patterns.
/// </summary>
internal class PoolHealthMetrics
{
private int _reconnectionFailureTally;
private readonly int _configuredMaxSize;

public PoolHealthMetrics(int configuredMaxSize)
{
_configuredMaxSize = configuredMaxSize;
}

public void IncrementReconnectionFailures()
{
Interlocked.Increment(ref _reconnectionFailureTally);
}

public void ResetAllCounters()
{
Interlocked.Exchange(ref _reconnectionFailureTally, 0);
}

public int GetReconnectionFailureTally() => Volatile.Read(ref _reconnectionFailureTally);

public int GetConfiguredMaxSize() => _configuredMaxSize;
}
}
41 changes: 41 additions & 0 deletions src/Apache.IoTDB/ReconnectionFailedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System;
using Thrift;

namespace Apache.IoTDB
{
/// <summary>
/// Exception thrown when all reconnection attempts to the server have failed.
/// This exception is used internally to distinguish reconnection failures from other errors.
/// </summary>
internal class ReconnectionFailedException : TException
{
internal ReconnectionFailedException(string message)
: base(message, null)
{
}

internal ReconnectionFailedException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}
Loading
Loading