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-11541 Add internal metadata to write commands #8113

Merged
merged 1 commit into from Apr 14, 2020

Conversation

pruivo
Copy link
Member

@pruivo pruivo commented Mar 26, 2020

@pruivo pruivo force-pushed the t_commands_internal_metadata branch 2 times, most recently from ae96055 to 919a3c7 Compare March 30, 2020 08:55
@pruivo pruivo force-pushed the t_commands_internal_metadata branch from 919a3c7 to 38d1bd6 Compare April 6, 2020 15:15
@tristantarrant
Copy link
Member

Should we perfack this ?

@ryanemerson
Copy link
Contributor

@pruivo Is this PR still valid in light of #7858 (comment)?

Probably, it is best just to create a simple class with 2 fields (irac version and opt-tx version)

@pruivo
Copy link
Member Author

pruivo commented Apr 7, 2020

@pruivo Is this PR still valid in light of #7858 (comment)?

Probably, it is best just to create a simple class with 2 fields (irac version and opt-tx version)

yes. I have already the InternalCacheEntry updated and if I change the class, it would break this PR and create a bunch of conflicts in the next ones.
I would rather have everything integrated with MetaParamsInternalMetadata and change it later in one go.

@pruivo
Copy link
Member Author

pruivo commented Apr 7, 2020

run performance tests please

@ryanemerson
Copy link
Contributor

I would rather have everything integrated with MetaParamsInternalMetadata and change it later in one go.

How far down the line are we talking? This touches a lot of classes, so it makes it somewhat of a moving target for us working in the same area.

@pruivo
Copy link
Member Author

pruivo commented Apr 7, 2020

The persistence is missing. My plans are to open a PR after this one.
It includes updating MarshallableEntry and the CacheStore implementations

//TODO! why adding version for replace?
//if (!configuration.transaction().transactionMode().isTransactional()) {
// interceptorChain.appendInterceptor(createInterceptor(new VersionInterceptor(), VersionInterceptor.class), false);
//}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still meant to be commented?

If we're removing this, should it be a separate commit/Jira?

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot to ask @gustavonalle about it. Is the VersionInterceptor still needed?
It sets some version for the replace commands and I didn't find any usage of that version.
It breaks the xsite tests if non-tx cache (on site 1) backups to a tx cache (on site 2).

Choose a reason for hiding this comment

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

I am not sure TBH. This is a relic from the compat mode times

Copy link
Member Author

Choose a reason for hiding this comment

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

oh... I found a failure... EmbeddedRestMemcachedHotRodTest fails without it.
I need to drop the version in the receiver site... bah...

@@ -733,6 +733,7 @@ protected IntSet getOwnedSegments(ConsistentHash consistentHash) {
InternalMetadataImpl metadata = new InternalMetadataImpl(e);
PutKeyValueCommand put = commandsFactory.buildPutKeyValueCommand(e.getKey(), e.getValue(), segmentId,
metadata, STATE_TRANSFER_FLAGS);
put.setInternalMetadata(e.getInternalMetadata());
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add MetaParamsInternalMetadata to CommandsFactory#buildPutKeyValueCommand.

Similarly, I noticed that the internal metadata is not set in ProtobufMetadataManagerInterceptor. How are internal commands handled by xsite, should this be set there as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

We should add MetaParamsInternalMetadata to CommandsFactory#buildPutKeyValueCommand.

I didn't add it because I want to try to avoid touching too much interface... it would require a lot of changes everywhere and most of the places, the value is null.

Similarly, I noticed that the internal metadata is not set in ProtobufMetadataManagerInterceptor.
Is it needed? and set it to what exactly? (sorry, no idea what ProtobufMetadataManagerInterceptor is)

The current xsite impl doesn't use it.
In the new one, the internal metadata is set by the primary owner before replicating it to the backup owners.
It is also used by the state transfer so the joiners can set the correct versions.

@@ -20,6 +24,7 @@
long flags;
DataConversion keyDataConversion;
DataConversion valueDataConversion;
Map<Object, MetaParamsInternalMetadata> internalMetadataMap;
Copy link
Member

Choose a reason for hiding this comment

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

Is there no way we can trim this somehow... a ConcurrentHashMap for every functional command is a lot of bloat. Why not just 1 like we did with the other metadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

The internal metadata is stored per key. Each key will have a different version.

@ryanemerson
Copy link
Contributor

The persistence is missing. My plans are to open a PR after this one.
It includes updating MarshallableEntry and the CacheStore implementations

I have looked through the code and for the most part it seems fine. However it is not easy reviewing knowing that nearly all of the changes in this PR are going to change. Let's get the the follow ups in quickly (I'll make sure I'm timely with a review). I'll hold off rebasing my marshalling branch until then and progress locally, as it's too much of a moving target otherwise due to all of the areas this touches. Plus a simple class containing the two versions will make my life simpler in the long run.

@@ -30,13 +35,15 @@ protected AbstractWriteManyCommand(CommandInvocationId commandInvocationId,
this.flags = params.toFlagsBitSet();
this.keyDataConversion = keyDataConversion;
this.valueDataConversion = valueDataConversion;
this.internalMetadataMap = new ConcurrentHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use an immutable empty list here?

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, otherwise I will get an UnsupportedException when I try to put metadata there.
It can be null but then I will have to put some null checks before get/put and do a proper synchronization around it. I would rather not do it.

@pruivo pruivo force-pushed the t_commands_internal_metadata branch from 38d1bd6 to 11252ee Compare April 7, 2020 15:46
@pruivo
Copy link
Member Author

pruivo commented Apr 7, 2020

@ryanemerson updated!
thanks for the review.

@ryanemerson
Copy link
Contributor

@diegolovison Perk ack didn't run for some reason. Can you take a look?

@pruivo pruivo force-pushed the t_commands_internal_metadata branch 2 times, most recently from d853df1 to c577dd6 Compare April 8, 2020 08:37
@ghost
Copy link

ghost commented Apr 8, 2020

Performance tests didn't finish successfully. @diegolovison, can you review it?

Additional info:
Commit: 38d1bd6
Build number: #428
Comment body: run performance tests please
skip ci

@diegolovison
Copy link
Contributor

run performance tests please

@ghost
Copy link

ghost commented Apr 8, 2020

Performance tests didn't finish successfully. @diegolovison, can you review it?

Additional info:
Commit: c577dd6
Build number: #431
Comment body: run performance tests please
skip ci

@diegolovison
Copy link
Contributor

run performance tests please

@ghost
Copy link

ghost commented Apr 8, 2020

Performance tests run successfully. Link to the results here.

Additional info:
Commit: c577dd6
Build number: #433
Comment body: run performance tests please
skip ci

@pruivo
Copy link
Member Author

pruivo commented Apr 8, 2020

perf looks good @ryanemerson

Copy link
Contributor

@ryanemerson ryanemerson left a comment

Choose a reason for hiding this comment

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

Two very minor things. I'm looking at the follow up now

@pruivo pruivo force-pushed the t_commands_internal_metadata branch from c577dd6 to 7438ff6 Compare April 9, 2020 09:24
@pruivo pruivo force-pushed the t_commands_internal_metadata branch from 7438ff6 to 2e3d496 Compare April 13, 2020 10:19
@ryanemerson ryanemerson merged commit f10d8b5 into infinispan:master Apr 14, 2020
@ryanemerson
Copy link
Contributor

Thanks @pruivo

@pruivo pruivo deleted the t_commands_internal_metadata branch April 14, 2020 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants