MCPcopy Create free account
hub / github.com/MariaDB/server / net_send_progress_packet

Function net_send_progress_packet

sql/protocol.cc:711–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709const uchar progress_header[2]= {(uchar) 255, (uchar) 255 };
710
711void net_send_progress_packet(THD *thd)
712{
713 uchar buff[200], *pos;
714 const char *proc_info= thd->proc_info ? thd->proc_info : "";
715 size_t length= strlen(proc_info);
716 ulonglong progress;
717 DBUG_ENTER("net_send_progress_packet");
718
719 if (unlikely(!thd->net.vio))
720 DBUG_VOID_RETURN; // Socket is closed
721
722 pos= buff;
723 /*
724 Store number of strings first. This allows us to later expand the
725 progress indicator if needed.
726 */
727 *pos++= (uchar) 1; // Number of strings
728 *pos++= (uchar) thd->progress.stage + 1;
729 /*
730 We have the MY_MAX() here to avoid problems if max_stage is not set,
731 which may happen during automatic repair of table
732 */
733 *pos++= (uchar) MY_MAX(thd->progress.max_stage, thd->progress.stage + 1);
734 progress= 0;
735 if (thd->progress.max_counter)
736 progress= 100000ULL * thd->progress.counter / thd->progress.max_counter;
737 int3store(pos, progress); // Between 0 & 100000
738 pos+= 3;
739 pos= net_store_data(pos, (const uchar*) proc_info,
740 MY_MIN(length, sizeof(buff)-7));
741 net_write_command(&thd->net, (uchar) 255, progress_header,
742 sizeof(progress_header), (uchar*) buff,
743 (uint) (pos - buff));
744 DBUG_VOID_RETURN;
745}
746
747
748/****************************************************************************

Callers 1

thd_send_progressFunction · 0.85

Calls 3

int3storeFunction · 0.85
net_store_dataFunction · 0.85
net_write_commandFunction · 0.85

Tested by

no test coverage detected