Repository navigation
cli: accept timestamps in partitions list-offsets - #3214
Open
LemonCondor wants to merge 1 commit into
Open
LemonCondor wants to merge 1 commit into
LemonCondor wants to merge 1 commit into
Conversation
The help text says a spec may be a millisecond timestamp, but since dpkp#2905 the value goes straight to OffsetSpec.build_from(), which only knows the named specs: "-s 1700000000000" fails with "Unrecognized OffsetSpec". Parse integers as OffsetTimestamp, as groups reset-offsets accepts them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The help of
partitions list-offsetssays that a spec may be a millisecond timestamp (both-sand-p TOPIC:PARTITION:SPEC), but a number is rejected (output ofkafka.cli.admin.run_cli()against the testMockBroker):This looks unintended: #2905 replaced the local
_parse_spec(), which triedint()first, withOffsetSpec.build_from(), which only knows the named specs.KafkaAdminClient.list_partition_offsets()itself accepts timestamps, andgroups reset-offsets --specstill does.The command now parses an integer as
OffsetTimestampand passes everything else toOffsetSpec.build_from(), so named specs and theUnrecognized OffsetSpecmessage are unchanged.Test: added
TestListPartitionOffsetsCliintest/admin/test_admin_partitions.py. On master the three numeric cases fail and the two others pass; all five pass with the change.pytest test/adminpasses (208 tests, MockBroker only, no real cluster), andpylint --errors-onlyonkafka/cliand the test file reports nothing.