@@ -107,8 +107,7 @@ static void* wsrep_sst_donor_monitor_thread(void *arg __attribute__((unused)))
107107
108108 WSREP_INFO (" Donor monitor thread started to monitor" );
109109
110- wsp::thd thd (FALSE ); // we turn off wsrep_on for this THD so that it can
111- // operate with wsrep_ready == OFF
110+ wsp::thd thd;
112111
113112 while (!sst_donor_completed)
114113 {
@@ -144,8 +143,7 @@ static void* wsrep_sst_joiner_monitor_thread(void *arg __attribute__((unused)))
144143
145144 WSREP_INFO (" Joiner monitor thread started to monitor" );
146145
147- wsp::thd thd (FALSE ); // we turn off wsrep_on for this THD so that it can
148- // operate with wsrep_ready == OFF
146+ wsp::thd thd;
149147
150148 while (!sst_joiner_completed)
151149 {
@@ -642,9 +640,9 @@ static void* sst_joiner_thread (void* a)
642640
643641 wsp::process proc (arg->cmd , " r" , arg->env );
644642
645- if (proc.pipe () && !proc.error ())
643+ if (proc.from () && !proc.error ())
646644 {
647- const char * tmp= my_fgets (out, out_len, proc.pipe ());
645+ const char * tmp= my_fgets (out, out_len, proc.from ());
648646
649647 if (!tmp || strlen (tmp) < (magic_len + 2 ) ||
650648 strncasecmp (tmp, magic, magic_len))
@@ -698,7 +696,7 @@ static void* sst_joiner_thread (void* a)
698696 err= EINVAL;
699697
700698 wait_signal:
701- tmp= my_fgets (out, out_len, proc.pipe ());
699+ tmp= my_fgets (out, out_len, proc.from ());
702700
703701 if (tmp)
704702 {
@@ -1534,7 +1532,7 @@ static int sst_run_shell (const char* cmd_str, char** env, int max_tries)
15341532 {
15351533 wsp::process proc (cmd_str, " r" , env);
15361534
1537- if (NULL != proc.pipe ())
1535+ if (NULL != proc.from ())
15381536 {
15391537 proc.wait ();
15401538 }
@@ -1847,26 +1845,32 @@ static void* sst_donor_thread (void* a)
18471845 // We turn off wsrep_on for this THD so that it can
18481846 // operate with wsrep_ready == OFF
18491847 // We also set this SST thread THD as system thread
1850- wsp::thd thd (FALSE , true );
1848+ wsp::thd thd (true , true );
18511849 wsp::process proc (arg->cmd , " r" , arg->env );
18521850
18531851 err= -proc.error ();
18541852
1853+ if (proc.to () && !err)
1854+ {
1855+ // Close the pipe, so that the SST process gets an EOF
1856+ proc.close_to ();
1857+ }
1858+
18551859/* Inform server about SST script startup and release TO isolation */
18561860 mysql_mutex_lock (&arg->lock );
18571861 arg->err = -err;
18581862 mysql_cond_signal (&arg->cond );
18591863 mysql_mutex_unlock (&arg->lock ); // ! @note arg is unusable after that.
18601864
1861- if (proc.pipe () && !err)
1865+ if (proc.from () && !err)
18621866 {
18631867 long long total= 0 ;
18641868 long long complete= 0 ;
18651869 // total form previous stages
18661870 long long total_prev= 0 ;
18671871
18681872wait_signal:
1869- out= my_fgets (out_buf, out_len, proc.pipe ());
1873+ out= my_fgets (out_buf, out_len, proc.from ());
18701874
18711875 if (out)
18721876 {
0 commit comments