Plex-FAWE/worldedit-core
dordsor21 f6af9925e8
Char block null check (#1030)
**Add a null-check to CharBlocks FULL section layer-retrieval.**
 - It is possible to trim CharBlocks whilst it is attempting to read data due to the batching of chunks to help reduce memory
 - This is done when the number of chunks sitting loaded in memory with having been "submitted" to the queue for writing to disk becomes high
 - Seconday operations such as heightmap processing and lighting will quickly load chunks, meaning many chunks are submitted early
 - This leads to much higher chances of the chunk being submitted and subsequently trimmed given heightmap and light processing is done layer-by-layer over many chunks, rather than chunk-by-chunk - thus leading to NPEs.
 - By adding synchronisation to and around only the specific sections when loading/updating, and not blocking the whole chunk, many access can still be thread-safe without causing deadlocks
 - This allows removal of lots of the needless and very-slowing synchronisation on get**Block** methods

**Remove much of the synchronisation from ChunkHolder**
 - We shouldn't be synchronising with call() and safety should be added elsewhere. (plus it's making edits very very slow when queue target size is hit)
 - Also remove much of synchronisation because we've added the null-check and section-specific synchronisation to CharBlocks
 
**Some QOL/thread-safe data access changes**
- Replaces the Array#clone seen in the get blocks classes with System#arraycopy as deep cloning is not required, and is also slower than arraycopy
- Add System#arraycopy when accessing chunk section data via history to ensure it is not altered whilst being written
- Renaming EMPTY to empty means it is not implied to be a static variable

Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1028
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1025
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1089
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1091
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1097
2021-06-08 14:28:16 +00:00
..
doctools Update to Gradle 7 (#1078) 2021-05-14 23:42:37 +02:00
src Char block null check (#1030) 2021-06-08 14:28:16 +00:00
build.gradle.kts Fixes #1098 2021-05-30 23:49:46 +02:00