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

Fix handeling sasl scram error in group coordinator #622

Merged
merged 6 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ private void doReset(
long acknowledge,
int maximum,
long traceId,
long authorization)
long authorization,
Flyweight extension)
{
final ResetFW reset = resetRW.wrap(writeBuffer, 0, writeBuffer.capacity())
.originId(originId)
Expand All @@ -415,6 +416,7 @@ private void doReset(
.maximum(maximum)
.traceId(traceId)
.authorization(authorization)
.extension(extension.buffer(), extension.offset(), extension.sizeof())
.build();

sender.accept(reset.typeId(), reset.buffer(), reset.offset(), reset.sizeof());
Expand Down Expand Up @@ -637,14 +639,11 @@ private void onConsumerFanInitialReset(
final long traceId = reset.traceId();
final OctetsFW extension = reset.extension();

final KafkaResetExFW kafkaResetEx = extension.get(kafkaResetExRO::tryWrap);
final int error = kafkaResetEx != null ? kafkaResetEx.error() : -1;

state = KafkaState.closedInitial(state);

doConsumerFanReplyResetIfNecessary(traceId);

members.forEach(s -> s.doConsumerInitialResetIfNecessary(traceId));
members.forEach(s -> s.doConsumerInitialResetIfNecessary(traceId, extension));

onConsumerFanClosed(traceId);
}
Expand Down Expand Up @@ -833,7 +832,7 @@ private void doConsumerFanReplyReset(
long traceId)
{
doReset(receiver, originId, routedId, replyId, replySeq, replyAck, replyMax,
traceId, authorization);
traceId, authorization, EMPTY_OCTETS);

state = KafkaState.closedReply(state);
}
Expand Down Expand Up @@ -984,23 +983,25 @@ private void onConsumerInitialAbort(
}

private void doConsumerInitialResetIfNecessary(
long traceId)
long traceId,
OctetsFW extension)
{
if (KafkaState.initialOpening(state) && !KafkaState.initialClosed(state))
{
doConsumerInitialReset(traceId);
doConsumerInitialReset(traceId, extension);
}

state = KafkaState.closedInitial(state);
}

private void doConsumerInitialReset(
long traceId)
long traceId,
OctetsFW extension)
{
state = KafkaState.closedInitial(state);

doReset(sender, originId, routedId, initialId, initialSeq, initialAck, initialMax,
traceId, authorization);
traceId, authorization, extension);
}

private void doConsumerInitialWindow(
Expand Down Expand Up @@ -1110,7 +1111,7 @@ private void onConsumerReplyReset(

fan.onConsumerFanMemberClosed(traceId, this);

doConsumerInitialResetIfNecessary(traceId);
doConsumerInitialResetIfNecessary(traceId, EMPTY_OCTETS);
}

private void onConsumerReplyWindow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ private void doReset(
long acknowledge,
int maximum,
long traceId,
long authorization)
long authorization,
Flyweight extension)
{
final ResetFW reset = resetRW.wrap(writeBuffer, 0, writeBuffer.capacity())
.originId(originId)
Expand All @@ -518,6 +519,7 @@ private void doReset(
.maximum(maximum)
.traceId(traceId)
.authorization(authorization)
.extension(extension.buffer(), extension.offset(), extension.sizeof())
.build();

sender.accept(reset.typeId(), reset.buffer(), reset.offset(), reset.sizeof());
Expand Down Expand Up @@ -747,6 +749,7 @@ private void onConsumerInitialReset(
final long sequence = reset.sequence();
final long acknowledge = reset.acknowledge();
final long traceId = reset.traceId();
final OctetsFW extension = reset.extension();

assert acknowledge <= sequence;
assert acknowledge >= this.initialAck;
Expand All @@ -756,7 +759,7 @@ private void onConsumerInitialReset(

assert this.initialAck <= this.initialSeq;

streams.forEach(m -> m.cleanup(traceId));
streams.forEach(m -> m.cleanup(traceId, extension));

doConsumerReplyReset(traceId);

Expand Down Expand Up @@ -999,7 +1002,7 @@ private void onConsumerReplyAbort(

assert replyAck <= replySeq;

streams.forEach(s -> s.cleanup(traceId));
streams.forEach(s -> s.cleanup(traceId, EMPTY_OCTETS));

doConsumerInitialAbort(traceId);

Expand All @@ -1012,7 +1015,7 @@ private void doConsumerReplyReset(
if (!KafkaState.replyClosed(state))
{
doReset(receiver, originId, routedId, replyId, replySeq, replyAck, replyMax,
traceId, authorization);
traceId, authorization, EMPTY_OCTETS);

state = KafkaState.closedReply(state);
}
Expand Down Expand Up @@ -1269,7 +1272,7 @@ private void onConsumerInitialEnd(

assert initialAck <= initialSeq;

cleanup(traceId);
cleanup(traceId, EMPTY_OCTETS);
}

private void onConsumerInitialFlush(
Expand Down Expand Up @@ -1316,18 +1319,19 @@ private void onConsumerInitialAbort(

assert initialAck <= initialSeq;

cleanup(traceId);
cleanup(traceId, EMPTY_OCTETS);
}

private void doConsumerInitialReset(
long traceId)
long traceId,
OctetsFW extension)
{
if (KafkaState.initialOpening(state) && !KafkaState.initialClosed(state))
{
state = KafkaState.closedInitial(state);

doReset(sender, originId, routedId, initialId, initialSeq, initialAck, initialMax,
traceId, authorization);
traceId, authorization, extension);
}

state = KafkaState.closedInitial(state);
Expand Down Expand Up @@ -1416,7 +1420,7 @@ private void onConsumerReplyReset(

assert replyAck <= replySeq;

cleanup(traceId);
cleanup(traceId, EMPTY_OCTETS);
}

private void onConsumerReplyWindow(
Expand Down Expand Up @@ -1456,9 +1460,10 @@ private void onConsumerReplyWindow(
}

private void cleanup(
long traceId)
long traceId,
OctetsFW extension)
{
doConsumerInitialReset(traceId);
doConsumerInitialReset(traceId, extension);
doConsumerReplyAbort(traceId);

offsetCommit.cleanup(traceId);
Expand Down Expand Up @@ -1569,6 +1574,7 @@ private void onOffsetCommitInitialReset(
final long sequence = reset.sequence();
final long acknowledge = reset.acknowledge();
final long traceId = reset.traceId();
final OctetsFW extension = reset.extension();

assert acknowledge <= sequence;
assert acknowledge >= delegate.initialAck;
Expand All @@ -1578,7 +1584,7 @@ private void onOffsetCommitInitialReset(

assert delegate.initialAck <= delegate.initialSeq;

delegate.cleanup(traceId);
delegate.cleanup(traceId, extension);

doOffsetCommitReplyReset(traceId);
}
Expand Down Expand Up @@ -1687,7 +1693,7 @@ private void onOffsetCommitReplyEnd(

assert replyAck <= replySeq;

delegate.cleanup(traceId);
delegate.cleanup(traceId, EMPTY_OCTETS);
}

private void onOffsetCommitReplyAbort(
Expand All @@ -1705,7 +1711,7 @@ private void onOffsetCommitReplyAbort(

assert replyAck <= replySeq;

delegate.cleanup(traceId);
delegate.cleanup(traceId, EMPTY_OCTETS);
}

private void doOffsetCommitReplyReset(
Expand All @@ -1714,7 +1720,7 @@ private void doOffsetCommitReplyReset(
if (!KafkaState.replyClosed(state))
{
doReset(receiver, originId, routedId, replyId, replySeq, replyAck, replyMax,
traceId, authorization);
traceId, authorization, EMPTY_OCTETS);

state = KafkaState.closedReply(state);
}
Expand Down
Loading