Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: do not wait for chunk loads when calling #2912

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dordsor21
Copy link
Member

No description provided.

@github-actions github-actions bot added Bugfix This PR fixes a bug Feature This PR adds a new feature labels Sep 14, 2024
@dordsor21 dordsor21 changed the base branch from main to fix/chunk-get-write-improvements September 14, 2024 17:33
@dordsor21 dordsor21 changed the title fix: some improvements to GET chunk writing feat: do not wait for chunk loads when calling Sep 14, 2024
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 3a3648f to bd3cc64 Compare September 14, 2024 21:51
Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

Base automatically changed from fix/chunk-get-write-improvements to main September 25, 2024 17:20
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 6c31979 to 45f84fb Compare September 25, 2024 17:24
Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 45f84fb to 56b7c6e Compare September 29, 2024 10:49
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 56b7c6e to 7fe7ec3 Compare October 27, 2024 10:12
@dordsor21 dordsor21 marked this pull request as ready for review October 28, 2024 21:15
@dordsor21 dordsor21 requested a review from a team as a code owner October 28, 2024 21:15
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 5cb0b3b to 051f5c3 Compare November 16, 2024 12:12
@@ -118,6 +124,7 @@ public boolean trim(boolean aggressive, int layer) {
public synchronized IChunkSet reset() {
for (int i = 0; i < sectionCount; i++) {
sections[i] = EMPTY;
VarHandle.storeStoreFence();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we synchronize on the section lock instead? Although there might be more places (e.g. loadIfPresent) where we don't synchronize...

Copy link
Member Author

@dordsor21 dordsor21 Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to enforce order of operation in compiled code, I did not believe that it would necessarily be enforced given it's nested, despite the sync on the method

if (!callLock.isHeldByCurrentThread()) {
throw new IllegalStateException("Attempted to call chunk GET but chunk was not call-locked.");
}
forceLoadSections = false;
LevelChunk nmsChunk = ensureLoaded(serverLevel, chunkX, chunkZ);
final ServerLevel nmsWorld = serverLevel;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given large parts of that logic aren't version-specific, can we somehow reduce duplication here?

Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from 051f5c3 to 162dea8 Compare December 24, 2024 17:47
@dordsor21 dordsor21 requested review from SirYwell and a team December 26, 2024 22:10
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from a0b008a to adb22c7 Compare December 28, 2024 16:40
@dordsor21 dordsor21 force-pushed the feat/no-wait-for-chunk-load branch from adb22c7 to 0efd9ed Compare December 28, 2024 16:41
Copy link
Member

@SirYwell SirYwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work

@dordsor21 dordsor21 requested a review from a team December 30, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix This PR fixes a bug Feature This PR adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants