Looking to colab/Solve the issue with geo_patch bloat

Place for sharing your game modifications for Life is Feudal: Your Own
User avatar
Eslake
 
Posts: 73
Joined: 30 Dec 2014, 17:15

Looking to colab/Solve the issue with geo_patch bloat

Post by Eslake » 19 Mar 2015, 06:27

Anyone who runs a server for more than a week knows there is a problem with continually increasing lag- tied to mining, tunneling, terraforming and even the gathering of mushrooms and berries.

The source of the problem is that all of this information is added into the database table geo_patch, but nothing .. at all .. is ever removed from that table.

Drop soil, +2 lines, pick it back up +2 more, farm in the same place for 10 days.. + several k.
After a while, each time someone digs or picks a mushroom, the entire server hangs for a couple of seconds for everyone on it.

And eventually the server simply refuses to load.
..
Simply deleting rows from the geo_patch table will break the map. Most or All of the buildings and items will vanish and the terraforming undone. It is like a partial wipe but without the benefit of unclogging the database.

-- Removed the code snippet as it was the Wrong One, and incomplete.

If anyone has any further work on this issue, please append it here. Maybe we can start to come up with usable results.
Last edited by Eslake on 23 May 2015, 08:41, edited 1 time in total.

User avatar
Razoreqx
 
Posts: 91
Joined: 06 Oct 2014, 13:13

Re: Looking to colab/Solve the issue with geo_patch bloat

Post by Razoreqx » 20 Mar 2015, 12:10

I agree this is a serious issue. Personally id like to see the devs address this issue as this would introduce an unplayable MMO given the number of players.

If anyone has anything to contribute to this thread it would be much appreciated.

to the OP. I have done a similar script but its risky to run. I recommend strongly you backup the database before running any script that removes line items from the DB.
Razors Edge
A Life is Feudal Persistent World
http://razors-edge.org
22 Custom MODS / Custom Graphics models Planned. Visit our Gallery.


RudgerWolvram
 
Posts: 37
Joined: 01 Jan 2015, 22:27

Re: Looking to colab/Solve the issue with geo_patch bloat

Post by RudgerWolvram » 21 Mar 2015, 20:54

I had an idea on this, but haven't had time to work on it.

The idea would be to "collapse" the ground stacks.
From what i can tell, the whole reason the geo_patch is there is to keep track of what is on the ground (quality of dirt/etc) and every modified square under it. e.g. you throw down sand, then snow, then dirt. dig them up and you get dirt, snow then sand.

My idea is to collapse and reset all dirt. This way, it will not affect ore/rock piles, etc.

So it would need to find the highest version of a particular square that is a type of soil/sand/snow (so it ignores ore/rock). Then, remove all versions for that geo_id. I'm not sure if the version number should be dropped to 1 or left alone (haven't written code to test).

What this will hopefully do is shrink the size and essentially reset the current map to act as if it was the original map.

It would have to be a nightly reboot process. But even though it doesn't do it on the fly, it would hopefully make the table small enough it would not have any issues until you had like 64 players flattening for 20 hours straight. Then the nightly maintenance would hopefully take care of it.

Potential problems.
Likely:
Tearing in the terrain. e.g. a square and the next square is not meeting edges properly.

Flattened terrain with buildings may get dirt in them. e.g. you have a flattened edge, and the next square is 2.0 in height, the flattened square may slope up from it's middle, putting dirt in the building that can't be fixed.

Unlikely:
Someone decides to put iron or rock on every square they heavily teraformed so that it intentionally increases the table size and stays that way until dirt is put on top or the iron is removed.

It would destroy any ore or rock pile someone is trying to hide by putting dirt on top and making it look like a dirt pile. I don't know of anyone that does this.

Unknowns.
No idea what would happen to mines/tunnels. It could leave them alone or turn them into an M.C. Escher piece.

No idea how the map will react to being collapsed like that. If I put sand down in the snow, let the script run, then come back, will there be nothing but sand as i dig down or will it dig down until it hits the original map and you get snow?

No idea how it will handle intersecting with the original map. Most have seen the terrain lag from loading into a world and the terrain is all wonky until the full geo_patch loads for them. I don't know if things will load fast enough that it's normal, or you end up with the original map until it all loads. Hopefully, it would load fast enough that it wouldn't be noticed.

User avatar
Eslake
 
Posts: 73
Joined: 30 Dec 2014, 17:15

Re: Looking to colab/Solve the issue with geo_patch bloat

Post by Eslake » 22 Mar 2015, 00:17

I understand the idea, but in practice it tends to break things.

If you start a fresh map, flatten down an area to place a house, and build it.
Then go in and remove all but the last couple of versions on each geodataID location, then use the sql I provided in the main post, it will re-sync the versions and update the max in the terrain_blocks table.

Most of the time, you get the results you want. A flattened area with a house on it and very little waste-data in geo_patch.

Unfortunately if you try to do the same after building 3 or 4 houses, or doing any random amount of mining and/or tunneling, the same thing will typically Delete all placed buildings/objects and undo most of the terraforming on the map.

I haven't found the 'break' point at which things go from 'as expected' to catastrophic.

Removing all entries for a patch location will restore it to the default state, but with similar results as the flatten-and-place test.

In short, the more that has been changed on the map, the less you can safely remove, even if the specific data being removed is very simple - and does no harm on a less used map.

Return to Game mods