Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Timeouted wait until pipe created before restoring from it (#84)
During a resize-restore or a single-data-file restore, the gprestore helper creates pipes to restore the current table and the next one. During restore, two errors may occur on the coordinator. For example, the table or its schema does not exist, and the next table or its schema does not exist. In this case, the main gprestore process does not run COPY commands, which means that no one is reading from the corresponding pipes. If the on-error-continue option is also used, then the main gprestore process creates skip-files on the segments and begins to restore the third table. At the same time, the gprestore helper may hang waiting until someone starts reading from the pipe, or until a skip-file appears, or hang while deleting a pipe, or some other lengthy operation. And then the main gprestore process can try unsuccessfully to restore as many tables as desired until the corresponding pipe is created. So there is a race between the entire read loop (which can create skip files) and the write loop (which can do its own work without having to process skip files) before moving on to a new loop. It appears that this situation was introduced with the addition of the on-error-continue option. Without it, any error was fatal, the process stopped. And when using this option and without any synchronization between the reader and the writer, we can easily not have a channel for reading. This patch adds timeouted wait until pipe created before restoring from it. (cherry picked from commit f590f1f)
- Loading branch information