public async Task InsertAlignedRecordsAsync()

in src/Apache.IoTDB/SessionPool.cs [1005:1052]


        public async Task<int> InsertAlignedRecordsAsync(List<string> deviceId, List<RowRecord> rowRecords)
        {
            var client = _clients.Take();

            var request = GenInsertRecordsReq(deviceId, rowRecords, client.SessionId);
            request.IsAligned = true;
            // ASSERT that the insert plan is aligned
            System.Diagnostics.Debug.Assert(request.IsAligned == true);

            try
            {
                var status = await client.ServiceClient.insertRecordsAsync(request);

                if (_debugMode)
                {
                    _logger.LogInformation("insert multiple records to devices {0}, server message: {1}", deviceId, status.Message);
                }

                return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);

            }
            catch (TException e)
            {
                await Open(_enableRpcCompression);
                client = _clients.Take();
                request.SessionId = client.SessionId;
                try
                {
                    var status = await client.ServiceClient.insertRecordsAsync(request);

                    if (_debugMode)
                    {
                        _logger.LogInformation("insert multiple records to devices {0}, server message: {1}", deviceId, status.Message);
                    }

                    return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);

                }
                catch (TException ex)
                {
                    throw new TException("Error occurs when inserting records", ex);
                }
            }
            finally
            {
                _clients.Add(client);
            }
        }