in src/Apache.IoTDB/SessionPool.cs [695:741]
public async Task<int> InsertAlignedRecordAsync(string deviceId, RowRecord record)
{
var client = _clients.Take();
var req = new TSInsertRecordReq(client.SessionId, deviceId, record.Measurements, record.ToBytes(),
record.Timestamps);
req.IsAligned = true;
// ASSERT that the insert plan is aligned
System.Diagnostics.Debug.Assert(req.IsAligned == true);
try
{
var status = await client.ServiceClient.insertRecordAsync(req);
if (_debugMode)
{
_logger.LogInformation("insert one record to device {0}, server message: {1}", deviceId, status.Message);
}
return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
}
catch (TException e)
{
await Open(_enableRpcCompression);
client = _clients.Take();
req.SessionId = client.SessionId;
try
{
var status = await client.ServiceClient.insertRecordAsync(req);
if (_debugMode)
{
_logger.LogInformation("insert one record to device {0}, server message: {1}", deviceId, status.Message);
}
return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
}
catch (TException ex)
{
throw new TException("Error occurs when inserting record", ex);
}
}
finally
{
_clients.Add(client);
}
}