mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Make GIN's cleanup pending list process interruptable
Cleanup process could be called by ordinary insert/update and could take a lot of time. Add vacuum_delay_point() to make this process interruptable. Under vacuum this call will also throttle a vacuum process to decrease system load, called from insert/update it will not throttle, and that reduces a latency. Backpatch for all supported branches. Jeff Janes <jeff.janes@gmail.com>
This commit is contained in:
		@@ -800,8 +800,7 @@ ginInsertCleanup(GinState *ginstate,
 | 
				
			|||||||
		 */
 | 
							 */
 | 
				
			||||||
		processPendingPage(&accum, &datums, page, FirstOffsetNumber);
 | 
							processPendingPage(&accum, &datums, page, FirstOffsetNumber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (vac_delay)
 | 
							vacuum_delay_point();
 | 
				
			||||||
			vacuum_delay_point();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Is it time to flush memory to disk?	Flush if we are at the end of
 | 
							 * Is it time to flush memory to disk?	Flush if we are at the end of
 | 
				
			||||||
@@ -841,8 +840,7 @@ ginInsertCleanup(GinState *ginstate,
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				ginEntryInsert(ginstate, attnum, key, category,
 | 
									ginEntryInsert(ginstate, attnum, key, category,
 | 
				
			||||||
							   list, nlist, NULL);
 | 
												   list, nlist, NULL);
 | 
				
			||||||
				if (vac_delay)
 | 
									vacuum_delay_point();
 | 
				
			||||||
					vacuum_delay_point();
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
@@ -922,7 +920,7 @@ ginInsertCleanup(GinState *ginstate,
 | 
				
			|||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Read next page in pending list
 | 
							 * Read next page in pending list
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		CHECK_FOR_INTERRUPTS();
 | 
							vacuum_delay_point();
 | 
				
			||||||
		buffer = ReadBuffer(index, blkno);
 | 
							buffer = ReadBuffer(index, blkno);
 | 
				
			||||||
		LockBuffer(buffer, GIN_SHARE);
 | 
							LockBuffer(buffer, GIN_SHARE);
 | 
				
			||||||
		page = BufferGetPage(buffer);
 | 
							page = BufferGetPage(buffer);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user