Does /deleteblocks actually delete the blocks?

User avatar
Hume2
Member
 
Posts: 346
Joined: Tue Jun 19, 2018 08:24
Location: Czech Republic
GitHub: Hume2
In-game: Hume2

Does /deleteblocks actually delete the blocks?

by Hume2 » Thu Oct 17, 2019 12:57

Does the command /deleteblocks delete the mapblocks from the database entirely or it only marks them as invalid?

I deleted everything in range from (7000 -23000 -1000) to (10000 -11500 1000) by 1km thick layers, from bottom to top. Deleting one layer took up to a few minutes, so it must have been deleting something. I also made sure that a few bits from the area were really deleted. I walked into these bits and looked that they generated according to my new mapgen. I certainly didn't explore them again. However, the disc usage was about constant all the time. How is that possible?
If you lack the reality, go on a trip or find a job.
 

User avatar
sfan5
Moderator
 
Posts: 3816
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Does /deleteblocks actually delete the blocks?

by sfan5 » Thu Oct 17, 2019 16:53

Yes, /deleteblocks really deletes the mapblocks. However, SQLite usually does not free up unused space by downsizing its file.
You can force SQLite to free up space using the VACUUM SQL command.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Hume2
Member
 
Posts: 346
Joined: Tue Jun 19, 2018 08:24
Location: Czech Republic
GitHub: Hume2
In-game: Hume2

Re: Does /deleteblocks actually delete the blocks?

by Hume2 » Thu Oct 17, 2019 19:29

This makes sense, thanks!
If you lack the reality, go on a trip or find a job.
 

ShadMOrdre
Member
 
Posts: 534
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: Does /deleteblocks actually delete the blocks?

by ShadMOrdre » Sat Oct 26, 2019 20:05

@sfan5,

Shouldn't the MT engine code that calls out to SQLite then be the appropriate place to use the "VACUUM" statement. This should just be already, a part of the embedded SQL calls.

So as not to place more work on the core devs, and to offer my own SQL expertise, if this is something that should be done, but needs manpower, can you point me to where in the code I can find embedded SQL, or even generated SQL, to help optimize the code?

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
Hume2
Member
 
Posts: 346
Joined: Tue Jun 19, 2018 08:24
Location: Czech Republic
GitHub: Hume2
In-game: Hume2

Re: Does /deleteblocks actually delete the blocks?

by Hume2 » Sun Oct 27, 2019 05:47

I found this:
VACUUM requires you to have at least twice as bigger disc than your database currently occupies. So if your map occupies more than 50% of HDD, you won't perform it unless you move it somewhere else.
If you install sqlite3, you can open any database and then send SQL commands via terminal.
If you lack the reality, go on a trip or find a job.
 

micheal65536
Member
 
Posts: 130
Joined: Mon May 22, 2017 20:27

Re: Does /deleteblocks actually delete the blocks?

by micheal65536 » Sun Oct 27, 2019 20:00

ShadMOrdre wrote:Shouldn't the MT engine code that calls out to SQLite then be the appropriate place to use the "VACUUM" statement. This should just be already, a part of the embedded SQL calls.

No. Vacuum is a resource-intensive operation that should not be carried out while the server is online/running and/or without explicit request from the user. It's also unnecessary in a large majority of situations (most of the time, map files grow by adding new blocks but old blocks aren't deleted). Even when blocks are deleted, it cannot be assumed that the user/mod author/script also wants to vacuum the database (for example they may just be deleting the blocks so that they can be regenerated fresh, which won't cause the database to grow in size).
 


Return to Problems



Who is online

Users browsing this forum: No registered users and 6 guests