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

ISPN-14740 Do not persist empty metadata #10798

Merged

Conversation

wburns
Copy link
Member

@wburns wburns commented Apr 10, 2023

  • PersistenceManager won't pass metadata with no expiration or version

https://issues.redhat.com/browse/ISPN-14740

Reworked this to not change the in memory persistence and instead now we just ignore the metadata when passing to a store.

This saves approximately 40 bytes per entry and avoids serializing the metadata to protostream.

This change is the equivalent to https://github.com/infinispan/infinispan/blob/main/core/src/main/java/org/infinispan/container/impl/InternalEntryFactoryImpl.java#L88 which avoids the allocation in memory.

Copy link
Member

@jabolina jabolina left a comment

Choose a reason for hiding this comment

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

LGTM just waiting CI.

@wburns
Copy link
Member Author

wburns commented Apr 10, 2023

Oh, I forgot some persistent tests will fail now due to the smaller size, I will fix those after CI finds them. There shouldn't be any other failures 🤞

@wburns
Copy link
Member Author

wburns commented Apr 11, 2023

Interestingly this PR seems more likely to reproduce the OOM issue we have in the server test suite that happens with a CompletionStage that has what seems to be an infinitely growing dependency graph.

@jabolina
Copy link
Member

Replaying CI.

@wburns wburns force-pushed the ISPN-14740_persistence_metadata_ignore branch from da2180c to 9db721b Compare April 12, 2023 00:32
@wburns
Copy link
Member Author

wburns commented Apr 12, 2023

I have pushed a commit that should reduce how many tasks can pile up from state transfer as it will resume on an executor thread, so it cannot resume again before other tasks are completed and also frees up the non blocking thread for other tasks to be ran first.

@wburns wburns force-pushed the ISPN-14740_persistence_metadata_ignore branch from 9db721b to fedd938 Compare April 12, 2023 00:49
@wburns
Copy link
Member Author

wburns commented Apr 12, 2023

Two runs without the failure now is looking promising. Running a few more.

@wburns wburns force-pushed the ISPN-14740_persistence_metadata_ignore branch from fedd938 to 57a159c Compare April 12, 2023 02:59
@wburns
Copy link
Member Author

wburns commented Apr 14, 2023

Looks like it still failed.. so I would need to look into this further.

@pruivo
Copy link
Member

pruivo commented May 17, 2023

needs rebase

@wburns wburns force-pushed the ISPN-14740_persistence_metadata_ignore branch from 57a159c to 8e408c7 Compare May 19, 2023 16:34
@wburns
Copy link
Member Author

wburns commented May 19, 2023

Rebased and removed the extra testing commit.

Copy link
Member

@pruivo pruivo left a comment

Choose a reason for hiding this comment

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

LGTM, 2 questions :)

@@ -205,6 +210,11 @@ public Metadata.Builder builder() {
return super.builder().lifespan(lifespan).maxIdle(maxIdle);
}

@Override
public boolean isEmpty() {
return super.isEmpty() && lifespan < 0 && maxIdle < 0;
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be <= 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, 0 has a different meaning or expiration so it has to be <

Copy link
Member

Choose a reason for hiding this comment

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

what does 0 means? Expire immediately?

@@ -34,6 +34,11 @@ private MemcachedMetadata(int flags, long lifespan, EntryVersion version) {
this.flags = flags;
}

@Override
public boolean isEmpty() {
return super.isEmpty() && flags != 0;
Copy link
Member

Choose a reason for hiding this comment

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

typo?

Suggested change
return super.isEmpty() && flags != 0;
return super.isEmpty() && flags == 0;

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good catch. This is from before when I had the code as the inverse (isPresent or w/e I called it). Fixing.

* PersistenceManager won't pass metadata with no expiration or version
@wburns wburns force-pushed the ISPN-14740_persistence_metadata_ignore branch from 8e408c7 to 4417557 Compare May 19, 2023 19:10
@wburns
Copy link
Member Author

wburns commented May 19, 2023

Updated

@pruivo pruivo merged commit cc0b41d into infinispan:main May 23, 2023
3 of 4 checks passed
@pruivo
Copy link
Member

pruivo commented May 23, 2023

merged! thanks @wburns !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants