rpk: don't require --partition when using %p in topic produce#30879
rpk: don't require --partition when using %p in topic produce#30879telegraphchi wants to merge 1 commit into
Conversation
rpk topic produce only enabled the manual partitioner when --partition was set to a non-negative value, so a %p directive in the --format string was silently ignored unless the flag was also passed. The flag's presence, rather than its value, was the real switch, which was confusing. Enable the manual partitioner whenever the input format references the partition via %p, so %p works on its own. Update the help text and the flag description to match. Closes redpanda-data#17697 Signed-off-by: Mohamad Reza Chegini <mrchcoin@gmail.com>
|
Docs here seem to indicate this is expected behavior. They will at the very least, need updating, should we alter the behavior like this |
|
Good catch — agreed the docs need updating. That examples page describes today's behavior (where On whether we should change it: the motivation (#17697) is that the current behavior is surprising — when Happy to gate it differently if you'd prefer (e.g. keep it flag-driven but document clearly), but this seemed like the least-surprising option. Let me know your preference on the docs follow-up too. |
I don't mind if your code is AI generated but I wish your responses to me weren't, just FYI. I think the new behavior is probably better, but @r-vasquez is probably the person to make that call. |
|
Thanks Willem, appreciate you taking a look. Agreed it's @r-vasquez's call — I'm happy either way. Whichever way it lands, I'll update that docs page to match. |
rpk topic produceonly enabled franz-go's manual partitioner when--partitionwas set to a non-negative value, so a%pdirective in the--formatstring was silently ignored unless-pwas also passed. As theissue notes, the flag's presence — not its value — was the real switch,
which is confusing:
This PR enables the manual partitioner whenever the input format references the
partition via
%p, so%pworks on its own. A small helper detects a real%pdirective while respecting the%%,%{and%}escapes (so%%pisliteral text, not a directive). The help text and the
--partitionflagdescription are updated to match.
Fixes #17697
Backports Required
Release Notes
Improvements
rpk topic producenow honors a%ppartition directive in--formatwithout requiring the
--partitionflag.