Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Wip/wan tx grouping module 1#7083

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
albertogpz wants to merge20 commits intoapache:develop
base:develop
Choose a base branch
Loading
fromNordix:wip/wan-tx-grouping-module_1

Conversation

albertogpz
Copy link
Contributor

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typicallydevelop)?

  • Is your initial contribution a single, squashed commit?

  • Doesgradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion underASF 2.0?

Copy link
Contributor

@kirklundkirklund left a comment

Choose a reason for hiding this comment

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

Inlined a few comments. Overall looks like a good direction! Here are some general comments and tips:

  1. Prefer interfaces over abstract methods.
  2. Standardize on one library instead of mixing them (such as AssertJ for assertions).
  3. Is there a better word than "txgrouping" for module name and packages?
  4. Declare variables and APIs with interfaces rather than implementations.
  5. Always look for an interface to use instead of an implementation (such as InternalCache instead of GemFireCacheImpl) in both tests and product code.
  6. Always minimize the scope of anything (class, method, variable, constant).

Comment on lines 26 to 28
importstaticorg.assertj.core.api.Assertions.assertThat;
importstaticorg.junit.Assert.assertEquals;
importstaticorg.junit.Assert.assertNotNull;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use AssertJ for all assertions. TheassertEquals can just useassertThat(a).isEqualTo(b) andassertNotNull becomesassertThat(a).isNotNull();

albertogpz reacted with thumbs up emoji

protectedPropertiescreateLocatorConfig(intsystemId,intlocatorPort,intremoteLocatorPort) {
Propertiesconfig =newProperties();
config.setProperty(MCAST_PORT,"0");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the default so you can delete the line withMCAST_PORT

albertogpz reacted with thumbs up emoji
Comment on lines 292 to 294
if (regionSize !=r.keySet().size()) {
await().untilAsserted(() ->assertThat(r.keySet().size()).isEqualTo(regionSize));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would delete the if-statement and just use the await. The if statement is redundant... the await will also immediately complete successfully if the if-statement is true.

albertogpz reacted with thumbs up emoji
await()
.untilAsserted(() ->assertThat(regionQueue.size()).isEqualTo(expectedQueueSize));
}
ArrayList<Integer>stats =newArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember to declare as the weakest interface you need:

List<Integer> stats = new ArrayList<>();

albertogpz reacted with thumbs up emoji
assertThat(creates).isEqualTo(gatewayReceiverStats.getCreateRequest());
}

protectedvoiddoTxPutsWithRetryIfError(StringregionName,finallongputsPerTransaction,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should try to simplify any new method with this many calculations, for-loops, do-whiles and try-blocks. If you really need all of those blocks then try extracting the nested blocks to their own short little methods.

albertogpz reacted with thumbs up emoji
Comment on lines 191 to 160
try {
for (AsyncInvocation<?>asyncInvocation :asyncInvocations) {
asyncInvocation.await();
}
}catch (InterruptedExceptione) {
fail("Interrupted");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't catch an exception and usefail. Instead just addthrows InterruptedException to the test and delete the try-catch lines.

albertogpz reacted with thumbs up emoji
Comment on lines 467 to 415
}finally {
exp.remove();
exp1.remove();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

IgnoredException implementsAutoCloseable so you can use it in try-with-resources syntax. Using import-static andaddIgnoredException(Class) tidies it up nicely:

import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;try (IgnoredException ie1 = addIgnoredException(RegionDestroyedException.class);     IgnoredException ie2 = addIgnoredException(ForceReattemptException.class)) {  // ...}

albertogpz reacted with thumbs up emoji
+statistics.getUnprocessedEventsRemovedByPrimary())).isEqualTo(eventsReceived);
}

privateBooleankillPrimarySender(StringsenderId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The dunit testing framework originally required primitive wrappers, so I think you may have copied some of this from elsewhere. It's better to just use simple primitives for return types and parameters now, such asboolean instead ofBoolean.

albertogpz reacted with thumbs up emoji
importorg.apache.geode.internal.cache.wan.GatewaySenderException;
importorg.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes;

publicabstractclassCommonTxGroupingGatewaySenderFactory {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should make this an interface instead of an abstract class. Thestatic validator method would then become adefault implementation which would probably only ever be overridden by a test.

Copy link
ContributorAuthor

@albertogpzalbertogpzDec 1, 2021
edited
Loading

Choose a reason for hiding this comment

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

What would be the benefit of using an interface over an abstract class here?
Given that it provides helper static methods I tend to think it is better to define it is a class but I have no strong argument in favor of it.

Comment on lines 64 to 72
while (true) {
for (Iterator<Map.Entry<TransactionId,Integer>>iter =
incompleteTransactionIdsInBatch.entrySet().iterator();iter.hasNext();) {
Map.Entry<TransactionId,Integer>pendingTransaction =iter.next();
TransactionIdtransactionId =pendingTransaction.getKey();
intbucketId =pendingTransaction.getValue();
List<Object>events =
peekEventsWithTransactionId(partitionedRegion,bucketId,transactionId);
for (Objectobject :events) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to extract any nested loops to their own smaller methods. It helps keep things better organized and more readable.

albertogpz reacted with thumbs up emoji
}

@Override
publicsynchronizedvoidremove()throwsCacheException {
Copy link
Contributor

Choose a reason for hiding this comment

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

At first glance it looks like a lot of the remove method content is reimplemented here. Is there a way break up the original with some extension points to deduce the duplication?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Nice!

final@NotNullGatewaySenderAttributesImplattributes) {
finalintmyDSId =cache.getDistributionManager().getDistributedSystemId();
intmyDSId;
if (cacheinstanceofCacheCreation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

MaybeCacheCreation should be fixed to behave like any otherInternalCache rather than making consumer know subtile differences in behavior.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You mean to implement inCacheCreation thegetDistributionManager() method as follows?

  @Override  public DistributionManager getDistributionManager() {    return InternalDistributedSystem.getAnyInstance().getDistributionManager()  }

addIgnoredException("could not get remote locator");

StringcreateCommandString =
"create gateway-sender --id=sender1 --remote-distributed-system-id=1 --parallel --group-transaction-events=true";
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem modular yet. Is this testing deprecated--group-transaction-events and work is pending to add at--type=TxGroupingParallelGatewaySender?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can find an example of modularizing this in the first POC. Follow the newtype property on thecreate gateway-sender command.
https://github.com/pivotal-jbarrett/geode/blob/wip/wan-spi/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/CreateGatewaySenderCommand.java#L83

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done. We'll have to see how we reflect this in the documentation as we will need documentation specific for the module.

@jake-at-work
Copy link
Contributor

@albertogpz Can you please rebase this from develop. There as a fixed added there to address issues with Gradle builds.

albertogpz reacted with thumbs up emoji

@jake-at-work
Copy link
Contributor

jake-at-work commentedDec 1, 2021
edited
Loading

@albertogpz we need to extract out the TX batching specific elements form theGatewaySenderEventImpl object. I replaced it with a implementation definedmetadata object. SeeTxBatchMetadata from my previous example on making this a module. This gets set on the event object when constructed via an override onAbstractGatewaySenderEventProcessor. See examplehere.

@albertogpz
Copy link
ContributorAuthor

Inlined a few comments. Overall looks like a good direction! Here are some general comments and tips:

1. Prefer interfaces over abstract methods.2. Standardize on one library instead of mixing them (such as AssertJ for assertions).3. Is there a better word than "txgrouping" for module name and packages?4. Declare variables and APIs with interfaces rather than implementations.5. Always look for an interface to use instead of an implementation (such as InternalCache instead of GemFireCacheImpl) in both tests and product code.6. Always minimize the scope of anything (class, method, variable, constant).

Thanks for your comments.
Regarding the name, I do not have one that I really like. Other alternatives could be: txeventsgrouping, grouptxevents, txaware,...
If you like any of these or have any other proposal, please, let me know.

@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch 3 times, most recently from1850646 toee9b459CompareDecember 2, 2021 15:16
@albertogpz
Copy link
ContributorAuthor

albertogpz commentedDec 2, 2021
edited
Loading

@albertogpz we need to extract out the TX batching specific elements form theGatewaySenderEventImpl object. I replaced it with a implementation definedmetadata object. SeeTxBatchMetadata from my previous example on making this a module. This gets set on the event object when constructed via an override onAbstractGatewaySenderEventProcessor. See examplehere.

@pivotal-jbarrett As I said in a previous e-mail, I do not think we can make these changes without breaking backward compatibility. The feature was production ready at 1.14 so we can expect that it is used by customers. Therefore, we cannot just ignore those changes when interworking with 1.14 servers.
Am I missing something?

@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch fromf238c66 tod6d80b2CompareDecember 14, 2021 10:32
@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch 5 times, most recently from520d955 to1ac52a6CompareDecember 15, 2021 14:48
@onichols-pivotal
Copy link
Contributor

this PR appears to be abandoned, can it be closed?

@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch from1ac52a6 todd7f827CompareFebruary 7, 2022 08:20
@albertogpz
Copy link
ContributorAuthor

this PR appears to be abandoned, can it be closed?

It is not abandoned. Still waiting for comments after review changes. I have rebased the branch to remove the conflicts with develop.

onichols-pivotal reacted with thumbs up emoji

@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch 3 times, most recently from7a03267 to13ea059CompareFebruary 8, 2022 09:44
@albertogpzalbertogpzforce-pushed thewip/wan-tx-grouping-module_1 branch from13ea059 to4ce6664CompareFebruary 8, 2022 15:37
@kirklundkirklund removed their request for reviewApril 4, 2022 16:51
@semioticrobotic
Copy link
Contributor

@albertogpz and@kirklund: I know this has been dormant for a bit, but I believe it still has merit and would certainly be happy to see it included in a future release.@JinwooHwang and I have been reviewing outstanding PRs and are wondering if you have a moment to return to this one and give us your assessment. Is this still something you'd like to see merged?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kirklundkirklundkirklund left review comments

@jake-at-workjake-at-workAwaiting requested review from jake-at-work

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@albertogpz@jake-at-work@onichols-pivotal@semioticrobotic@kirklund

[8]ページ先頭

©2009-2025 Movatter.jp