Reset world on live server
Posted: Sun Mar 03, 2019 08:03
I am working on a new sub-game that requires a periodic reset of the world to it's initial/original mapgen state. I have tried minetest.delete_area, however it would take precisely 1 second less than infinity to reset an entire world. So this approach is non-viable.
I then tried to delete the world's map.sqlite file, but this crashes the server. However, on reboot, the world is indeed reset in a flash. This is what I want, but without the crash obviously. Is there any way to tell Minetest to regenerate the map.sqlite file without restarting the server?
Here is the error message produced when I delete the map.sqlite file...
So minetest crashes once a query to the deleted map.sqlite fails. So I'm curious if I can execute the same regeneration of the map.sqlite file that occurs on reboot whenever a database query fails - instead of throwing a fatal error.
Something like if !table then create_sqlfile() is what I need I suppose.
Or is there a better or existing solution?
I then tried to delete the world's map.sqlite file, but this crashes the server. However, on reboot, the world is indeed reset in a flash. This is what I want, but without the crash obviously. Is there any way to tell Minetest to regenerate the map.sqlite file without restarting the server?
Here is the error message produced when I delete the map.sqlite file...
Code: Select all
2019-03-03 20:43:31: ERROR[Emerge-0]: An unhandled exception occurred: Failed to prepare query 'SELECT `data` FROM `blocks` WHERE `pos` = ? LIMIT 1': no such table: blocks
2019-03-03 20:43:31: ERROR[Emerge-0]: In thread 7f206bfff700:
2019-03-03 20:43:31: ERROR[Emerge-0]: /home/realcourse/minetest5/newestMT5/compiled/minetest/src/emerge.cpp:2aa: virtual void* EmergeThread::run(): A fatal error occurred: Failed to prepare query 'SELECT `data` FROM `blocks` WHERE `pos` = ? LIMIT 1': no such table: blocks
Something like if !table then create_sqlfile() is what I need I suppose.
Or is there a better or existing solution?