@@ -205,9 +205,6 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
205205{
206206 TupleTableSlot * slot ;
207207 HeapTuple tup_old = NULL ;
208- double ninserts ,
209- nupdates ,
210- ndeletes ;
211208
212209 if (dstate -> nchanges == 0 )
213210 return ;
@@ -221,9 +218,6 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
221218 */
222219 PushActiveSnapshot (GetTransactionSnapshot ());
223220
224- ninserts = 0 ;
225- nupdates = 0 ;
226- ndeletes = 0 ;
227221 while (tuplestore_gettupleslot (dstate -> tstore , true, false,
228222 dstate -> tsslot ))
229223 {
@@ -305,7 +299,10 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
305299 list_free (recheck );
306300 pfree (tup );
307301
308- ninserts ++ ;
302+ /* Update the progress information. */
303+ SpinLockAcquire (& MyWorkerTask -> mutex );
304+ MyWorkerTask -> progress .ins ++ ;
305+ SpinLockRelease (& MyWorkerTask -> mutex );
309306 }
310307 else if (change -> kind == CHANGE_UPDATE_NEW ||
311308 change -> kind == CHANGE_DELETE )
@@ -342,7 +339,11 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
342339 find_tuple_in_partition (tup_old , rri_old -> ri_RelationDesc ,
343340 partitions , key , nkeys , & ctid );
344341 simple_heap_delete (rri_old -> ri_RelationDesc , & ctid );
345- ndeletes ++ ;
342+
343+ /* Update the progress information. */
344+ SpinLockAcquire (& MyWorkerTask -> mutex );
345+ MyWorkerTask -> progress .del ++ ;
346+ SpinLockRelease (& MyWorkerTask -> mutex );
346347
347348 /* Insert the new tuple into its partition. */
348349 ExecStoreHeapTuple (tup , slot , false);
@@ -370,7 +371,11 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
370371#endif
371372 );
372373 ExecClearTuple (slot );
373- ninserts ++ ;
374+
375+ /* Update the progress information. */
376+ SpinLockAcquire (& MyWorkerTask -> mutex );
377+ MyWorkerTask -> progress .ins ++ ;
378+ SpinLockRelease (& MyWorkerTask -> mutex );
374379
375380 list_free (recheck );
376381 }
@@ -439,12 +444,19 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
439444 list_free (recheck );
440445 }
441446
442- nupdates ++ ;
447+ /* Update the progress information. */
448+ SpinLockAcquire (& MyWorkerTask -> mutex );
449+ MyWorkerTask -> progress .upd ++ ;
450+ SpinLockRelease (& MyWorkerTask -> mutex );
443451 }
444452 else
445453 {
446454 simple_heap_delete (rri -> ri_RelationDesc , & ctid );
447- ndeletes ++ ;
455+
456+ /* Update the progress information. */
457+ SpinLockAcquire (& MyWorkerTask -> mutex );
458+ MyWorkerTask -> progress .del ++ ;
459+ SpinLockRelease (& MyWorkerTask -> mutex );
448460 }
449461 }
450462
@@ -470,10 +482,6 @@ apply_concurrent_changes(EState *estate, ModifyTableState *mtstate,
470482 pfree (tup_change );
471483 }
472484
473- elog (DEBUG1 ,
474- "pg_rewrite: concurrent changes applied: %.0f inserts, %.0f updates, %.0f deletes." ,
475- ninserts , nupdates , ndeletes );
476-
477485 tuplestore_clear (dstate -> tstore );
478486 dstate -> nchanges = 0 ;
479487
0 commit comments