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

[WFCORE-6739] Allow ordering of ServerActivity execution by registerin… #5884

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

bstansberry
Copy link
Contributor

@bstansberry bstansberry commented Feb 26, 2024

…g them in distinct, ordered, 'execution groups'

https://issues.redhat.com/browse/WFCORE-6739

This is a draft pending further discussion, particularly of how suitable this is for the transaction subsystem's implementation of https://issues.redhat.com/browse/WFLY-17742.

@jmfinelli FYI.

@github-actions github-actions bot added the deps-ok Dependencies have been checked, and there are no significant changes label Feb 26, 2024
@wildfly-ci
Copy link

Core -> Full Integration Build 13523 outcome was FAILURE using a merge of 804b199
Summary: Tests failed: 1 (1 new), passed: 7712, ignored: 119 Build time: 04:54:01

Failed tests

org.jboss.as.test.clustering.cluster.ejb.timer.DistributedTimerServiceTestCase.test: java.lang.AssertionError: node-2: org.jboss.as.test.clustering.cluster.ejb.timer.beans.SingleActionPersistentTimerBean expected:<1> but was:<0>
	at org.jboss.as.test.clustering.cluster.ejb.timer.AbstractTimerServiceTestCase.test(AbstractTimerServiceTestCase.java:95)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
------- Stdout: -------
node-2  [0m23:28:59,482 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location /opt/buildAgent/work/e8e0dd9c7c4ba60/full/testsuite/integration/clustering/target/wildfly-2/standalone/data/content/cd/3b78b7aaa08820f35d18457b34945d6804dbcc/content
 [0mnode-2  [0m23:28:59,487 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "DistributedTimerServiceTestCase.war" (runtime-name: "DistributedTimerServiceTestCase.war")
 [0mnode-2  [0m23:28:59,903 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) WFLYWELD0003: Processing weld deployment DistributedTimerServiceTestCase.war
 [0mnode-2  [0m23:28:59,919 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-7) WFLYEJB0473: JNDI bindings for session bean named 'AutoTransientTimerBean' in deployment unit 'deployment "DistributedTimerServiceTestCase.war"' are as follows:

	java:global/DistributedTimerServiceTestCase/AutoTransientTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.TimerBean
	java:app/DistributedTimerServiceTestCase/AutoTransientTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.TimerBean
	java:module/AutoTransientTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.TimerBean
	java:global/DistributedTimerServiceTestCase/AutoTransientTimerBean
	java:app/DistributedTimerServiceTestCase/AutoTransientTimerBean
	java:module/AutoTransientTimerBean

 [0mnode-2  [0m23:28:59,919 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-7) WFLYEJB0473: JNDI bindings for session bean named 'SingleActionPersistentTimerBean' in deployment unit 'deployment "DistributedTimerServiceTestCase.war"' are as follows:

	java:global/DistributedTimerServiceTestCase/SingleActionPersistentTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.ManualTimerBean
	java:app/DistributedTimerServiceTestCase/SingleActionPersistentTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.ManualTimerBean
	java:module/SingleActionPersistentTimerBean!org.jboss.as.test.clustering.cluster.ejb.timer.beans.ManualTimerBean
	java:global/DistributedTimerServiceTestCase/SingleActionPersistentTimerBean
	java:app/DistributedTimerServiceTestCase/SingleActionPersistentTimerBean
	java:module/SingleActionPersistentTimerBean

 [0mnode-2  [0m23:28:59,919 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-7) WFLYEJB0473: JNDI bindings for session bean named 'AutoPersistentTimerBean' in deployment unit 'deployment "DistributedTimerServiceTestCase.war"' are as follows:



Copy link

@jmfinelli jmfinelli left a comment

Choose a reason for hiding this comment

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

I'm not sure why this is a DRAFT PR :-) It looks super good to me.
I just left a comment in the code.

Thank you very much @bstansberry for taking care of this

@@ -75,20 +81,32 @@ public synchronized void suspend(long timeoutMillis) {
for(OperationListener listener: new ArrayList<>(operationListeners)) {
listener.suspendStarted();
}
outstandingCount = activities.size();
if (outstandingCount == 0) {
groupsCount = activities.size();

Choose a reason for hiding this comment

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

Shouldn't this be

Suggested change
groupsCount = activities.size();
// Work out the number of ServerActivity implementations
activities.forEach((ranking,executionGroup) -> groupsCount =+ executionGroup.size());

Or, we could also add a groupsCount++ in registerActivity(ServerActivity)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. This var is meant to track the number of groups, not the number of activities. When each group completes preSuspend work it signals preSuspendGroupCallBack. When preSuspendGroupCallBack get groupsCount signals, it proceeds with the 'suspend' phase.

I should probably rename the 'activities' field to 'activitiesByGroup'.

Choose a reason for hiding this comment

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

Yep, I see it now. Sorry for the noise.

@bstansberry bstansberry changed the title [WFLY-19067] Allow ordering of ServerActivity execution by registerin… [WFCORE-6739] Allow ordering of ServerActivity execution by registerin… Mar 13, 2024
@bstansberry
Copy link
Contributor Author

Thanks for the review, @jmfinelli.

It's draft for a couple reasons. :-)

The biggest is that we're doing this to meet your use case, so before having other folks waste time looking at it, I wanted to make sure you thought it would. When we talked I thought we understood each other and something like this should solve your problem, but maybe I misunderstood or you thought more and don't think it will help etc. Sounds like it's ok though, so that's good.

The other is that I should write a unit test. This works fine it that it doesn't break existing tests but that doesn't prove it actually works. :)

Looking at SuspendController it seems very unit-testable, and the basic behavior that needs testing is straightforward (activities are invoked in the expected order regardless of the order of calls to registerActivity).

@jmfinelli
Copy link

Yep, it look super good to me and it reflects exactly what we talked about during the meeting :-) I think this is the last piece of the puzzle 🥳 I also declared a dependency in the proposal.

…g them in distinct, ordered, 'execution groups'
@bstansberry bstansberry marked this pull request as ready for review March 15, 2024 01:01
@bstansberry
Copy link
Contributor Author

@jmfinelli I added the test and moved this out of draft state.

@bstansberry bstansberry merged commit 45e4a25 into wildfly:main Mar 18, 2024
12 checks passed
@bstansberry bstansberry deleted the WFLY-19067 branch March 18, 2024 19:34
@bstansberry
Copy link
Contributor Author

Thanks @jmfinelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deps-ok Dependencies have been checked, and there are no significant changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants