@@ -626,21 +626,31 @@ MonitoringSnapshot::MonitoringSnapshot(thread_db* tdbb, MemoryPool& pool)
626
626
{
627
627
if (dbb->getEncodedOdsVersion () >= ODS_13_1)
628
628
{
629
+ // The code below requires that rel_mon_compiled_statements put
630
+ // into dump before rel_mon_statements, see also dumpAttachment()
631
+
629
632
FB_UINT64 stmtId;
630
633
StmtBlobs stmtBlobs;
631
634
dsc desc;
632
635
633
636
if ((rid == rel_mon_compiled_statements) && EVL_field (nullptr , record, f_mon_cmp_stmt_id, &desc))
634
637
{
638
+ fb_assert (desc.dsc_dtype == dtype_int64);
635
639
stmtId = *(FB_UINT64*) desc.dsc_address ;
636
640
637
641
if (EVL_field (nullptr , record, f_mon_cmp_stmt_sql_text, &desc))
642
+ {
643
+ fb_assert (desc.isBlob ());
638
644
stmtBlobs.text = *reinterpret_cast <bid*>(desc.dsc_address );
645
+ }
639
646
else
640
647
stmtBlobs.text .clear ();
641
648
642
649
if (EVL_field (nullptr , record, f_mon_cmp_stmt_expl_plan, &desc))
650
+ {
651
+ fb_assert (desc.isBlob ());
643
652
stmtBlobs.plan = *reinterpret_cast <bid*>(desc.dsc_address );
653
+ }
644
654
else
645
655
stmtBlobs.plan .clear ();
646
656
@@ -649,6 +659,7 @@ MonitoringSnapshot::MonitoringSnapshot(thread_db* tdbb, MemoryPool& pool)
649
659
}
650
660
else if ((rid == rel_mon_statements) && EVL_field (nullptr , record, f_mon_stmt_cmp_stmt_id, &desc))
651
661
{
662
+ fb_assert (desc.dsc_dtype == dtype_int64);
652
663
stmtId = *(FB_UINT64*) desc.dsc_address ;
653
664
654
665
if (blobsMap.get (stmtId, stmtBlobs))
@@ -657,14 +668,19 @@ MonitoringSnapshot::MonitoringSnapshot(thread_db* tdbb, MemoryPool& pool)
657
668
{
658
669
record->clearNull (f_mon_stmt_sql_text);
659
670
if (EVL_field (nullptr , record, f_mon_stmt_sql_text, &desc))
671
+ {
672
+ fb_assert (desc.isBlob ());
660
673
*reinterpret_cast <bid*>(desc.dsc_address ) = stmtBlobs.text ;
674
+ }
661
675
}
662
-
663
676
if (!stmtBlobs.plan .isEmpty ())
664
677
{
665
678
record->clearNull (f_mon_stmt_expl_plan);
666
679
if (EVL_field (nullptr , record, f_mon_stmt_expl_plan, &desc))
680
+ {
681
+ fb_assert (desc.isBlob ());
667
682
*reinterpret_cast <bid*>(desc.dsc_address ) = stmtBlobs.plan ;
683
+ }
668
684
}
669
685
}
670
686
}
@@ -1564,7 +1580,7 @@ void Monitoring::dumpAttachment(thread_db* tdbb, Attachment* attachment, ULONG g
1564
1580
1565
1581
if (dbb->getEncodedOdsVersion () >= ODS_13_1)
1566
1582
{
1567
- // Statement information
1583
+ // Statement information, must be put into dump before requests
1568
1584
1569
1585
for (const auto statement : attachment->att_statements )
1570
1586
{
0 commit comments