@@ -243,6 +243,12 @@ static char *
243
243
utoa (unsigned int value , char * buffer )
244
244
{
245
245
sprintf (buffer , "%u" , value );
246
+ /* XXX: originally, we would just return buffer here without
247
+ * the pgut_strdup(). But repack_cleanup_callback() seems to
248
+ * depend on getting back a freshly strdup'd copy of buffer,
249
+ * not sure why. So now we are leaking a tiny bit of memory
250
+ * with each utoa() call.
251
+ */
246
252
return pgut_strdup (buffer );
247
253
}
248
254
@@ -900,6 +906,13 @@ rebuild_indexes(const repack_table *table)
900
906
901
907
ret = select (max_fd + 1 , & input_mask , NULL , NULL , & timeout );
902
908
#endif
909
+ /* XXX: the errno != EINTR check means we won't bail
910
+ * out on SIGINT. We should probably just remove this
911
+ * check, though it seems we also need to fix up
912
+ * the on_interrupt handling for workers' index
913
+ * builds (those PGconns don't seem to have c->cancel
914
+ * set, so we don't cancel the in-progress builds).
915
+ */
903
916
if (ret < 0 && errno != EINTR )
904
917
elog (ERROR , "poll() failed: %d, %d" , ret , errno );
905
918
@@ -1703,8 +1716,12 @@ repack_cleanup_callback(bool fatal, void *userdata)
1703
1716
if (fatal )
1704
1717
{
1705
1718
params [0 ] = utoa (target_table , buffer );
1706
- params [1 ] = utoa (temp_obj_num , buffer );
1719
+ params [1 ] = utoa (temp_obj_num , buffer );
1707
1720
1721
+ /* testing PQstatus() of connection and conn2, as we do
1722
+ * in repack_cleanup(), doesn't seem to work here,
1723
+ * so just use an unconditional reconnect().
1724
+ */
1708
1725
reconnect (ERROR );
1709
1726
command ("SELECT repack.repack_drop($1, $2)" , 2 , params );
1710
1727
temp_obj_num = 0 ; /* reset temporary object counter after cleanup */
0 commit comments