Browse Source
			
			
			MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855
			
				
		MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855
	
		
	
			
				fil_node_open_file_low() tries to close files from the top of fil_system.space_list if the number of opened files is exceeded. It invokes fil_space_t::try_to_close(), which iterates the list searching for the first opened space. Then it just closes the space, leaving it in the same position in fil_system.space_list. On heavy files opening, like during 'SHOW TABLE STATUS ...' execution, if the number of opened files limit is reached, fil_space_t::try_to_close() iterates more and more closed spaces before reaching any opened space for each fil_node_open_file_low() call. What causes performance regression if the number of spaces is big enough. The fix is to keep opened spaces at the top of fil_system.space_list, and move closed files at the end of the list. For this purpose fil_space_t::space_list_last_opened pointer is introduced. It points to the last inserted opened space in fil_space_t::space_list. When space is opened, it's inserted to the position just after the pointer points to in fil_space_t::space_list to preserve the logic, inroduced in MDEV-23855. Any closed space is added to the end of fil_space_t::space_list. As opened spaces are located at the top of fil_space_t::space_list, fil_space_t::try_to_close() finds opened space faster. There can be the case when opened and closed spaces are mixed in fil_space_t::space_list if fil_system.freeze_space_list was set during fil_node_open_file_low() execution. But this should not cause any error, as fil_space_t::try_to_close() still iterates spaces in the list. There is no need in any test case for the fix, as it does not change any functionality, but just fixes performance regression.bb-10.5-MDEV-30700-postfix
				 4 changed files with 81 additions and 16 deletions
			
			
		- 
					7extra/mariabackup/xtrabackup.cc
- 
					31storage/innobase/fil/fil0fil.cc
- 
					52storage/innobase/include/fil0fil.h
- 
					3storage/innobase/srv/srv0start.cc
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue