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

Merge TDSParserStateObject.StateSnapshot.PLPData #2126

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3100,18 +3100,6 @@ internal void CloneCleanupAltMetaDataSetArray()

sealed partial class StateSnapshot
{
private sealed class PLPData
{
public readonly ulong SnapshotLongLen;
public readonly ulong SnapshotLongLenLeft;

public PLPData(ulong snapshotLongLen, ulong snapshotLongLenLeft)
{
SnapshotLongLen = snapshotLongLen;
SnapshotLongLenLeft = snapshotLongLenLeft;
}
}

private sealed partial class PacketData
{
public byte[] Buffer;
Expand Down Expand Up @@ -3150,7 +3138,7 @@ partial void SetStackInternal(string value)
private PacketData _sparePacket;

internal byte[] _plpBuffer;
private PLPData _plpData;


private int _snapshotInBuffCount;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3267,9 +3267,6 @@ sealed partial class StateSnapshot
private bool _snapshotReceivedColumnMetadata = false;
private bool _snapshotAttentionReceived;

private ulong _snapshotLongLen;
private ulong _snapshotLongLenLeft;

public StateSnapshot(TdsParserStateObject state)
{
_snapshotInBuffs = new List<PacketData>();
Expand Down Expand Up @@ -3347,8 +3344,10 @@ internal void Snap()
_snapshotMessageStatus = _stateObj._messageStatus;
// _nullBitmapInfo must be cloned before it is updated
_snapshotNullBitmapInfo = _stateObj._nullBitmapInfo;
_snapshotLongLen = _stateObj._longlen;
_snapshotLongLenLeft = _stateObj._longlenleft;
if (_stateObj._longlen != 0 || _stateObj._longlenleft != 0)
{
_plpData = new PLPData(_stateObj._longlen, _stateObj._longlenleft);
}
_snapshotCleanupMetaData = _stateObj._cleanupMetaData;
// _cleanupAltMetaDataSetArray must be cloned bofore it is updated
_snapshotCleanupAltMetaDataSetArray = _stateObj._cleanupAltMetaDataSetArray;
Expand Down Expand Up @@ -3401,8 +3400,8 @@ internal void ResetSnapshotState()
_stateObj._partialHeaderBytesRead = 0;

// reset plp state
_stateObj._longlen = _snapshotLongLen;
_stateObj._longlenleft = _snapshotLongLenLeft;
_stateObj._longlen = _plpData?.SnapshotLongLen ?? 0;
_stateObj._longlenleft = _plpData?.SnapshotLongLenLeft ?? 0;

_stateObj._snapshotReplay = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,18 +1104,31 @@ private void DumpBuffer() {

sealed partial class StateSnapshot
{
private sealed class PLPData
{
public readonly ulong SnapshotLongLen;
public readonly ulong SnapshotLongLenLeft;

public PLPData(ulong snapshotLongLen, ulong snapshotLongLenLeft)
{
SnapshotLongLen = snapshotLongLen;
SnapshotLongLenLeft = snapshotLongLenLeft;
}
}

private int _snapshotInBuffCurrent;
private int _snapshotInBytesUsed;
private int _snapshotInBytesPacket;

private PLPData _plpData;

private byte _snapshotMessageStatus;

private NullBitmap _snapshotNullBitmapInfo;
private _SqlMetaDataSet _snapshotCleanupMetaData;
private _SqlMetaDataSetCollection _snapshotCleanupAltMetaDataSetArray;

private TdsParserStateObject _stateObj;

#if DEBUG
private int _rollingPend = 0;
private int _rollingPendCount = 0;
Expand Down