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

tx/group compaction fixes #24637

Merged
merged 21 commits into from
Jan 3, 2025
Merged

tx/group compaction fixes #24637

merged 21 commits into from
Jan 3, 2025

Conversation

bharathv
Copy link
Contributor

@bharathv bharathv commented Dec 21, 2024

Check individual commit message for details

Main changes

  • Adds a lots of observability
    • Now consumer offsets partitions are supported in describe_producers Kafka API
    • Adds a v1/producers/kafka/topic/partition end point that gives detailed producer level debug info
  • Adds an escape hatch to force abort any stuck group transactions /v1/transaction/unsafe_abort_group_transaction/{group_id}
  • Fixes a couple of compaction bugs with group transactions

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.3.x
  • v24.2.x
  • v24.1.x

Release Notes

Bug Fixes

  • Fixes an issue that blocked the compaction of consumer offsets with group transactions.

@bharathv
Copy link
Contributor Author

/dt

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Dec 21, 2024

CI test results

test results on build#60037
test_id test_kind job_url test_status passed
test_consumer_group_recovery_rpunit.test_consumer_group_recovery_rpunit unit https://buildkite.com/redpanda/redpanda/builds/60037#0193e7ef-114e-474c-b463-9426fd2ed955 FAIL 0/2
test_consumer_group_recovery_rpunit.test_consumer_group_recovery_rpunit unit https://buildkite.com/redpanda/redpanda/builds/60037#0193e7ef-1152-4aea-a1e2-19d14ea9a00a FAIL 0/2
test results on build#60049
test_id test_kind job_url test_status passed
kafka_server_rpfixture.kafka_server_rpfixture unit https://buildkite.com/redpanda/redpanda/builds/60049#0193f07e-533f-4715-b8a1-0f31c067b1da FLAKY 1/2
rptest.tests.cloud_storage_scrubber_test.CloudStorageScrubberTest.test_scrubber.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0bf-dcc3-4557-af8c-d9940a72aff1 FAIL 0/1
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0bf-dcc1-4950-bb16-fd655ecc86af FLAKY 3/6
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0bf-dcc2-4f4b-8cde-76741d798378 FLAKY 4/6
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0c5-171e-474d-aa8e-0d0ffb161139 FLAKY 1/6
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0c5-171f-4e2a-8beb-403808ca77b4 FLAKY 2/6
rptest.tests.e2e_topic_recovery_test.EndToEndTopicRecovery.test_restore_with_aborted_tx.recovery_overrides=.retention.local.target.bytes.1024.redpanda.remote.write.True.redpanda.remote.read.True.cloud_storage_type=CloudStorageType.ABS ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0c5-171b-40a1-bfbf-37f5a6e814bf FAIL 0/1
rptest.transactions.consumer_offsets_test.VerifyConsumerOffsetsThruUpgrades.test_consumer_group_offsets.versions_to_upgrade=3 ducktape https://buildkite.com/redpanda/redpanda/builds/60049#0193f0c5-1719-46be-8112-309c6520cae5 FAIL 0/1
test results on build#60058
test_id test_kind job_url test_status passed
rptest.tests.cloud_storage_scrubber_test.CloudStorageScrubberTest.test_scrubber.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60058#0193f31d-2f6d-4a69-8dc9-12c8e28584c6 FAIL 0/1
rptest.tests.data_migrations_api_test.DataMigrationsApiTest.test_mount_inexistent ducktape https://buildkite.com/redpanda/redpanda/builds/60058#0193f337-48f5-4f5d-b1f2-e3b95d1ca948 FLAKY 5/6
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60058#0193f31d-2f6c-47ff-9829-30ea21edb404 FLAKY 2/6
rptest.transactions.producers_api_test.ProducersAdminAPITest.test_producers_state_api_during_load ducktape https://buildkite.com/redpanda/redpanda/builds/60058#0193f31d-2f6f-44e5-8895-92629bdc07fb FAIL 0/1
rptest.transactions.producers_api_test.ProducersAdminAPITest.test_producers_state_api_during_load ducktape https://buildkite.com/redpanda/redpanda/builds/60058#0193f337-48f5-4f5d-b1f2-e3b95d1ca948 FAIL 0/1
test results on build#60103
test_id test_kind job_url test_status passed
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60103#0193f706-0cb5-4c9d-88ba-d8b9ef93524e FLAKY 2/6
rptest.transactions.producers_api_test.ProducersAdminAPITest.test_producers_state_api_during_load ducktape https://buildkite.com/redpanda/redpanda/builds/60103#0193f702-3285-483a-b9fb-81658e3e80bb FAIL 0/1
rptest.transactions.producers_api_test.ProducersAdminAPITest.test_producers_state_api_during_load ducktape https://buildkite.com/redpanda/redpanda/builds/60103#0193f706-0cb5-4c9d-88ba-d8b9ef93524e FAIL 0/1
test_group_tx_compaction_rpunit.test_group_tx_compaction_rpunit unit https://buildkite.com/redpanda/redpanda/builds/60103#0193f6bf-f184-47e1-84a0-4b121a138781 FAIL 0/2
test_group_tx_compaction_rpunit.test_group_tx_compaction_rpunit unit https://buildkite.com/redpanda/redpanda/builds/60103#0193f6bf-f184-4e44-8109-e4d183911389 FAIL 0/2
test results on build#60115
test_id test_kind job_url test_status passed
partition_balancer_simulator_test_rpunit.partition_balancer_simulator_test_rpunit unit https://buildkite.com/redpanda/redpanda/builds/60115#0193f7b9-a957-48fc-8c6a-db1d4996766d FLAKY 1/2
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60115#0193f800-181d-4b4b-a17b-030b181e6427 FLAKY 3/6
rptest.tests.datalake.partition_movement_test.PartitionMovementTest.test_cross_core_movements.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/60115#0193f800-181e-4a88-93a8-db3096d09b07 FLAKY 4/6
rptest.tests.maintenance_test.MaintenanceTest.test_maintenance_sticky.use_rpk=True ducktape https://buildkite.com/redpanda/redpanda/builds/60115#0193f812-e6f8-41cc-8c78-144da0e50294 FLAKY 5/6
test results on build#60249
test_id test_kind job_url test_status passed
rptest.tests.data_migrations_api_test.DataMigrationsApiTest.test_mount_inexistent ducktape https://buildkite.com/redpanda/redpanda/builds/60249#01942ae9-8ee8-4ffe-ae4e-71370ce7f503 FLAKY 5/6
rptest.transactions.consumer_offsets_test.VerifyConsumerOffsetsThruUpgrades.test_consumer_group_offsets.versions_to_upgrade=3 ducktape https://buildkite.com/redpanda/redpanda/builds/60249#01942ae9-8ee8-4ffe-ae4e-71370ce7f503 FAIL 0/1
rptest.transactions.consumer_offsets_test.VerifyConsumerOffsetsThruUpgrades.test_consumer_group_offsets.versions_to_upgrade=3 ducktape https://buildkite.com/redpanda/redpanda/builds/60249#01942aed-863f-46ee-8a8a-c6505749bd17 FAIL 0/1

@bharathv
Copy link
Contributor Author

/ci-repeat 3

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Dec 23, 2024

Retry command for Build#60049

please wait until all jobs are finished before running the slash command



/ci-repeat 1
tests/rptest/tests/cloud_storage_scrubber_test.py::CloudStorageScrubberTest.test_scrubber@{"cloud_storage_type":1}
tests/rptest/transactions/consumer_offsets_test.py::VerifyConsumerOffsetsThruUpgrades.test_consumer_group_offsets@{"versions_to_upgrade":3}
tests/rptest/tests/e2e_topic_recovery_test.py::EndToEndTopicRecovery.test_restore_with_aborted_tx@{"cloud_storage_type":2,"recovery_overrides":{"redpanda.remote.read":true,"redpanda.remote.write":true,"retention.local.target.bytes":1024}}

@bharathv bharathv marked this pull request as ready for review December 23, 2024 09:29
@bharathv bharathv requested a review from a team as a code owner December 23, 2024 09:29
@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Dec 23, 2024

Retry command for Build#60058

please wait until all jobs are finished before running the slash command



/ci-repeat 1
tests/rptest/transactions/producers_api_test.py::ProducersAdminAPITest.test_producers_state_api_during_load
tests/rptest/tests/cloud_storage_scrubber_test.py::CloudStorageScrubberTest.test_scrubber@{"cloud_storage_type":1}

Copy link
Contributor

@nvartolomei nvartolomei left a comment

Choose a reason for hiding this comment

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

Skimmed the PR to be up-to-date with the changes. Hope the observations are useful.

}

if (pid_str.empty() || epoch_str.empty() || sequence_str.empty()) {
throw ss::httpd::bad_param_exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should happen out of the box btw. This seems to be called implicitly when handling requests https://github.com/redpanda-data/seastar/blob/09a59a23ff2740a2fa591b0e65d978ca83d2b9e3/include/seastar/http/handlers.hh#L76

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya pretty conservative check, was thinking to convert to an assert but probably not worth it.

dedicated fence batch type (group_tx_fence) was used for group
transaction fencing.

After this buggy compaction, these uncleaned tx_fence batches are
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the buggy compaction fixed now? Otherwise. shouldn't we just fix the buggy compaction instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't fix that easily without a major refactor of the code and we don't need to (as outlined in the comment) as we already moved away from that problematic tx_fence batch infavor of group_tx_fence, so the whole fix revolves around how to get rid of the outdated tx_fence batches.

model::producer_identity{header.producer_id, header.producer_epoch},
header.base_offset);
model::record_batch_header, kafka::group_tx::offsets_metadata) {
// Transaction boundaries are determined by fence/commit or abort
Copy link
Contributor

Choose a reason for hiding this comment

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

This change doesn't seem to be explained by the commit message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is split this into a separate commit (and added more changes to it)

producers.producers.push(std::move(producer_state));
co_await ss::coroutine::maybe_yield();
}
co_return ss::json::json_return_type(std::move(producers));
Copy link
Contributor

Choose a reason for hiding this comment

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

ss::json::stream_range_as_array?

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 wanted to do it originally but I didn't because the final output is not array, It is something like

{
  ntp = foo,
  producers = [...]
}

it there a better way to do this?

Consider group_metadata to determine if a group transaction should be
considered open. Eg: if a group if tombstoned, any transaction
corresponding to the group is ignored. This invariant is also held in
the actual group stm to ensure groups are not tombstoned before any
pending transactions are cleaned up
This somewhat simplifies cases where the stm needs to disambiguate between
legit tx_fence batches and leftover tx_fence batches from compaction.
(see next commit)
This will result in hanging transactions and subsequent blocking
of compaction.
If a group got tombstoned all the producers to that group should be
ignored. The current logic is incorrectly recovering producers and
loading them up to expire later.
.. for a given partition, to be hooked up with REST API in the next
commit.
/v1/debug/producers/{namespace}/{topic}/{partition}

.. includes low level debug information about producers for
idempotency/transactional state.
.. in this case the state machine proceeds on to applying from the log.
Bumps the supported snapshot version so the existing snapshots are
invalidated as they may contain stale max_collectible_offset. This forces
the stm to reconstruct the state form the log and recompute correct
max_collectible_offset.
@bharathv bharathv merged commit 0eadf28 into redpanda-data:dev Jan 3, 2025
18 checks passed
@bharathv bharathv deleted the fix_co branch January 3, 2025 21:00
@vbotbuildovich
Copy link
Collaborator

/backport v24.3.x

@vbotbuildovich
Copy link
Collaborator

/backport v24.2.x

@vbotbuildovich
Copy link
Collaborator

Failed to create a backport PR to v24.3.x branch. I tried:

git remote add upstream https://github.com/redpanda-data/redpanda.git
git fetch --all
git checkout -b backport-pr-24637-v24.3.x-292 remotes/upstream/v24.3.x
git cherry-pick -x 89478480b4 cdd274a2a5 24c8e89f4f 8c5ecca7b5 3736f00b6a 835f3fce5d 9eee6326c5 f7191ad708 6ca81b456f 3d65c3933d 6fc62bb05b 2b79687b9a ac2204129a 7c8d6335a3 c7f953efd9 9958ca60a0 6efd325f85 23c8e295a7 70e36ebe57 c833f50286 0051463f23

Workflow run logs.

@vbotbuildovich
Copy link
Collaborator

Failed to create a backport PR to v24.2.x branch. I tried:

git remote add upstream https://github.com/redpanda-data/redpanda.git
git fetch --all
git checkout -b backport-pr-24637-v24.2.x-818 remotes/upstream/v24.2.x
git cherry-pick -x 89478480b4 cdd274a2a5 24c8e89f4f 8c5ecca7b5 3736f00b6a 835f3fce5d 9eee6326c5 f7191ad708 6ca81b456f 3d65c3933d 6fc62bb05b 2b79687b9a ac2204129a 7c8d6335a3 c7f953efd9 9958ca60a0 6efd325f85 23c8e295a7 70e36ebe57 c833f50286 0051463f23

Workflow run logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants