From dd317cc4c749ab39043dbbba6d403baa11b22a83 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Thu, 21 Sep 2023 08:38:47 -0300 Subject: [PATCH] Fix problem with statements and plan segments larger than 64K in the profiler plugin. --- src/plugins/profiler/Profiler.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/profiler/Profiler.cpp b/src/plugins/profiler/Profiler.cpp index 361f6ef3e6..5845b53899 100644 --- a/src/plugins/profiler/Profiler.cpp +++ b/src/plugins/profiler/Profiler.cpp @@ -44,6 +44,12 @@ namespace class ProfilerPlugin; + +static constexpr UCHAR STREAM_BLOB_BPB[] = { + isc_bpb_version1, + isc_bpb_type, 1, isc_bpb_type_stream, +}; + static const CInt128 ONE_SECOND_IN_NS{1'000'000'000}; static CInt128 ticksFrequency{0}; @@ -713,7 +719,7 @@ void ProfilerPlugin::flush(ThrowStatusExceptionWrapper* status) if (profileStatement.sqlText.hasData()) { auto blob = makeNoIncRef(userAttachment->createBlob( - status, transaction, &statementMessage->sqlText, 0, nullptr)); + status, transaction, &statementMessage->sqlText, sizeof(STREAM_BLOB_BPB), STREAM_BLOB_BPB)); blob->putSegment(status, profileStatement.sqlText.length(), profileStatement.sqlText.c_str()); blob->close(status); blob.clear(); @@ -779,8 +785,8 @@ void ProfilerPlugin::flush(ThrowStatusExceptionWrapper* status) recSrcMessage->accessPathNull = FB_FALSE; { // scope - auto blob = makeNoIncRef( - userAttachment->createBlob(status, transaction, &recSrcMessage->accessPath, 0, nullptr)); + auto blob = makeNoIncRef(userAttachment->createBlob(status, transaction, &recSrcMessage->accessPath, + sizeof(STREAM_BLOB_BPB), STREAM_BLOB_BPB)); blob->putSegment(status, recSrc.accessPath.length(), recSrc.accessPath.c_str()); blob->close(status); blob.clear();