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

Transactions when wbq is full #15186

Merged
merged 2 commits into from Oct 2, 2019
Merged

Conversation

@ahmetmircik
Copy link
Member

ahmetmircik commented Jun 17, 2019

ee counterpart is here: hazelcast/hazelcast-enterprise#3161

@ahmetmircik ahmetmircik modified the milestones: 3.12.2, 4.0 Jun 17, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 2 times, most recently from da1767c to 2d5a0f9 Jun 18, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 6 times, most recently from 8179bd4 to 0eb5375 Jun 19, 2019
@ahmetmircik ahmetmircik changed the title WIP WIP Transations when wbq is full Jun 21, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 6 times, most recently from 2caac24 to 8d05718 Jun 25, 2019
@ahmetmircik ahmetmircik changed the title WIP Transations when wbq is full Transactions when wbq is full Jun 27, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 2 times, most recently from db3c0aa to fd9efa6 Jul 1, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 4 times, most recently from 0765db3 to 77dc13a Jul 1, 2019
Copy link
Contributor

mmedenjak left a comment

Looks good, only one comment that you can check out

@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 11 times, most recently from 9d87d28 to cad4b80 Sep 26, 2019
@hazelcast hazelcast deleted a comment from ahmetmircik Sep 30, 2019
void increment(UUID txnId, boolean backup);

/**
* Increments capacity count for a transaction.

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Decrements?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

fixed.

void decrementOnlyReserved(UUID txnId);

/**
* Copies supplied transactions capacity counts fto this counter.

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

type "fto"?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

fixed.

long currentCapacity = nodeWideUsedCapacityCounter.get();
long newCapacity = currentCapacity + delta;

if (newCapacity < 0) {

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

How newCapacity can be negative? Is it an expected scenario?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

maybe a possible overflow but that code hasn't been introduced in this PR, only copied it to this new class.


@Override
public void increment(UUID txnId, boolean backup) {

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Shall we throw an IllegalStateException here or at least put assert?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

no action is expected from this class, it is fine as is.

import java.util.concurrent.atomic.AtomicLong;

import static java.lang.String.format;

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Javadoc would be useful here.

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

added.

public void add(DelayedEntry<Data, Object> delayedEntry) {
writeBehindQueue.addLast(delayedEntry);
@Override
public void addForcibly(DelayedEntry<Data, Object> delayedEntry) {

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

It would be useful to have Javadoc when the forced method is used?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

added javaDoc.

@@ -47,24 +50,31 @@ public Object add(Data key, Object value, long expirationTime, long time) {
return getStore().isPostProcessingMapStore() ? objectValue : value;
}

@Override
public void addForcibly(DelayedEntry delayedEntry) {

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

IllegalStateException?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

fixed.

try {
context.commitTransaction();
} catch (TransactionException e) {
context.rollbackTransaction();

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Shall we fail here since we don't expect exception?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

added fail.

context.rollbackTransaction();
}

sleepSeconds(10);

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Can we make a comment why we need this sleep here?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

It was left over. Removed it.

}

context.commitTransaction();
} catch (Exception e) {

This comment has been minimized.

Copy link
@petrpleshachkov

petrpleshachkov Sep 30, 2019

Contributor

Maybe catch here more specific exception?

This comment has been minimized.

Copy link
@ahmetmircik

ahmetmircik Oct 1, 2019

Author Member

fixed.

@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 6 times, most recently from 0d69aed to 9c191a6 Sep 30, 2019
@ahmetmircik ahmetmircik requested a review from petrpleshachkov Oct 1, 2019
@ahmetmircik ahmetmircik force-pushed the ahmetmircik:fix/4.0/txWbq branch 3 times, most recently from 5d6ed53 to 4b62f09 Oct 1, 2019
@ahmetmircik ahmetmircik merged commit 18aef43 into hazelcast:master Oct 2, 2019
1 check passed
1 check passed
default Test PASSed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.