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

IGNITE-8863 Tx rollback can cause remote tx hang. #4262

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,6 +29,7 @@
import org.apache.ignite.internal.util.GridLongList;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
Expand Down Expand Up @@ -473,6 +474,11 @@ public void needReturnValue(boolean retVal) {
return 27;
}

/** {@inheritDoc} */
@Override public int partition() {
return U.safeAbs(version().hashCode());
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtTxFinishRequest.class, this, super.toString());
Expand Down
Expand Up @@ -380,11 +380,6 @@ public boolean skipCompletedVersion() {
}
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtTxPrepareRequest.class, this, "super", super.toString());
}

/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
Expand Down Expand Up @@ -612,4 +607,14 @@ public boolean skipCompletedVersion() {
@Override public byte fieldsCount() {
return 33;
}

/** {@inheritDoc} */
@Override public int partition() {
return U.safeAbs(version().hashCode());
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtTxPrepareRequest.class, this, "super", super.toString());
}
}
Expand Up @@ -757,9 +757,6 @@ private void finish(int miniId, GridDistributedTxMapping m, boolean commit, bool
if (m.explicitLock())
syncMode = FULL_SYNC;

// Version to be added in completed versions on primary node.
GridCacheVersion completedVer = !commit && useCompletedVer ? tx.xidVersion() : null;

GridNearTxFinishRequest req = new GridNearTxFinishRequest(
futId,
tx.xidVersion(),
Expand All @@ -772,7 +769,7 @@ private void finish(int miniId, GridDistributedTxMapping m, boolean commit, bool
m.explicitLock(),
tx.storeEnabled(),
tx.topologyVersion(),
completedVer, // Reuse 'baseVersion' to do not add new fields in message.
null,
null,
null,
tx.size(),
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
Expand Down Expand Up @@ -216,6 +217,11 @@ public void miniId(int miniId) {
return 22;
}

/** {@inheritDoc} */
@Override public int partition() {
return U.safeAbs(version().hashCode());
}

/** {@inheritDoc} */
@Override public String toString() {
return GridToStringBuilder.toString(GridNearTxFinishRequest.class, this, "super", super.toString());
Expand Down
Expand Up @@ -30,6 +30,7 @@
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
Expand Down Expand Up @@ -415,6 +416,11 @@ private boolean isFlag(int mask) {
return 26;
}

/** {@inheritDoc} */
@Override public int partition() {
return U.safeAbs(version().hashCode());
}

/** {@inheritDoc} */
@Override public String toString() {
StringBuilder flags = new StringBuilder();
Expand Down
Expand Up @@ -797,9 +797,9 @@ else if (txFinishMsgLog.isDebugEnabled()) {
if (locTx != null)
req.txState(locTx.txState());

// 'baseVersion' message field is re-used for version to be added in completed versions.
if (!req.commit() && req.baseVersion() != null)
ctx.tm().addRolledbackTx(null, req.baseVersion());
// Always add near version to rollback history to prevent races with rollbacks.
if (!req.commit())
ctx.tm().addRolledbackTx(null, req.version());

// Transaction on local cache only.
if (locTx != null && !locTx.nearLocallyMapped() && !locTx.colocatedLocallyMapped())
Expand Down