@@ -634,6 +634,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
634
634
}
635
635
636
636
#ifndef DBUG_OFF
637
+
638
+ static char dbug_row_print_buf[4096 ];
639
+
637
640
/*
638
641
Print table's current row into a buffer and return a pointer to it.
639
642
@@ -649,11 +652,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
649
652
const char * dbug_print_row (TABLE *table, const uchar *rec, bool print_names)
650
653
{
651
654
Field **pfield;
652
- const size_t alloc_size= 512 ;
653
- char *row_buff= (char *) alloc_root (&table->mem_root , alloc_size);
654
- char *row_buff_tmp= (char *) alloc_root (&table->mem_root , alloc_size);
655
- String tmp (row_buff_tmp, alloc_size, &my_charset_bin);
656
- String output (row_buff, alloc_size, &my_charset_bin);
655
+ char row_buff_tmp[512 ];
656
+ String tmp (row_buff_tmp, sizeof (row_buff_tmp), &my_charset_bin);
657
+ String output (dbug_row_print_buf, sizeof (dbug_row_print_buf), &my_charset_bin);
657
658
658
659
auto move_back_lambda= [table, rec]() mutable {
659
660
table->move_fields (table->field , table->record [0 ], rec);
@@ -717,8 +718,10 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
717
718
}
718
719
}
719
720
output.append (" )" );
720
-
721
- return output.c_ptr_safe ();
721
+ if (output.c_ptr () == dbug_row_print_buf)
722
+ return dbug_row_print_buf;
723
+ else
724
+ return " Couldn't fit into buffer" ;
722
725
}
723
726
724
727
0 commit comments