feat: add tdbg CLI command to get user data for a task queue partition#9935
Conversation
dnr
left a comment
There was a problem hiding this comment.
As an aside, the PR description is really verbose and has a lot of unnecessary detail. That goes into the commit message, so it'll show up in git log, etc. I'd suggest trimming that down to just the important stuff.
| string namespace = 1; | ||
| string task_queue = 2; | ||
| temporal.api.enums.v1.TaskQueueType task_queue_type = 3; | ||
| // If non-zero, fetch the user data loaded by this partition instead of the root. |
There was a problem hiding this comment.
You don't have to say this, zero is the root so it's always the partition id you're asking about
There was a problem hiding this comment.
This change was removed from this PR. RPC changes were merged in #9934
| string task_queue = 2; | ||
| temporal.api.enums.v1.TaskQueueType task_queue_type = 3; | ||
| // If non-zero, fetch the user data loaded by this partition instead of the root. | ||
| int32 partition_id = 4; |
There was a problem hiding this comment.
But is there some reason we need the type and partition id? User data is defined on the task queue family (i.e. identified by namespace + task queue name, across types), so they should all be the same. Is it just for debugging?
There was a problem hiding this comment.
This change was removed from this PR. RPC changes were merged in #9934
| } | ||
| tqType := enumspb.TaskQueueType(tlTypeInt) | ||
| if tqType == enumspb.TASK_QUEUE_TYPE_UNSPECIFIED { | ||
| return errors.New("invalid task queue type") // nolint |
There was a problem hiding this comment.
if we do keep this field/flag, we should just default to workflow instead of erroring
There was a problem hiding this comment.
I was considering that too! But based on the Jira ticket, queue name and type should be mandatory, and partition-id should be optional. So I think this should be good!
We need a tdbg task-queue get-user-data that returns the User Data stored in server for a particular task queue name + type
Also it should have an optional --partition-id arg so user can ask to fetch the data loaded from a given partition rather than getting it from the root partition (default behavior)
There was a problem hiding this comment.
Not sure I interpret that as having the type to always be specified; I think @dnr is right here in that if a user does not specify a task queue type, we should default this to being the workflow type
Adds AdminService.GetTaskQueueUserData proto + generated code, and wires it up as a tdbg command. Accepts --task-queue (required), --task-queue-type (default: workflow), and --partition-id (default: 0). The backend handler implementation is in a separate PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mand Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
daf36a3 to
7a8e6b1
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| }, | ||
| }, | ||
| { | ||
| Name: "get-user-data", |
There was a problem hiding this comment.
I think we should name this as "get-task-queue-user-data"; Looking at the way the other commands have also been formulated, it seems like we should be explicit with our naming here!
- Rename command from get-user-data to get-task-queue-user-data for consistency with other tdbg taskqueue subcommands - Default to TASK_QUEUE_TYPE_WORKFLOW when UNSPECIFIED is passed instead of returning an error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shivs11
left a comment
There was a problem hiding this comment.
approving in confidence that you address this comment too!
| Name: FlagTaskQueueType, | ||
| Value: "TASK_QUEUE_TYPE_WORKFLOW", | ||
| Usage: "Task Queue type: TASK_QUEUE_TYPE_WORKFLOW, TASK_QUEUE_TYPE_ACTIVITY, TASK_QUEUE_TYPE_NEXUS", | ||
| }, |
There was a problem hiding this comment.
Quite similar to the partitionID usage message, we should now include that the default task queue type is indeed workflow type so that a user knows that they do not need to input this value
|
|
||
| // TestGetTaskQueueUserData tests that the cli accepts the various arguments for get-task-queue-user-data. | ||
| func (s *taskQueueCommandTestSuite) TestGetTaskQueueUserData() { | ||
| baseCommand := []string{"tdbg", "taskqueue", "get-task-queue-user-data", |
There was a problem hiding this comment.
task-queue seems redundant, tdbg taskqueue get-user-data reads better
There was a problem hiding this comment.
oh good point, I forgot the command starts with a task-queue.
- Revert command name from get-task-queue-user-data back to get-user-data - Add "(default TASK_QUEUE_TYPE_WORKFLOW)" to --task-queue-type usage string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
What changed?
This PR adds a
tdbg taskqueue get-user-dataCLI command totdbgto get theTaskQueueUserDatafor a particular task queue partition.This PR depends on #9934. See #9934 for more context.
Files changed
tools/tdbg/tdbg_commands.goget-user-datasubcommand undertaskqueuewith--namespace,--task-queue,--task-queue-type, and--partition-idflagstools/tdbg/task_queue_commands.goAdminGetTaskQueueUserData: reads flags, callsAdminService.GetTaskQueueUserData, pretty-prints responsetools/tdbg/task_queue_commands_test.goHow did you test it?
Unit tests
--task-queue my-queueonly--namespace defaultonly--task-queue-type INVALIDStringToEnumreturns error before RPC is called--task-queue-type TASK_QUEUE_TYPE_UNSPECIFIEDTASK_QUEUE_TYPE_WORKFLOW, succeeds--partition-idpartition_id=0, prints response--partition-id 1partition_id=1, prints responseManual tests
Setup
Root partition, workflow type
version=2reflects writes from the assignment rule;user_dataabsent as expected (versioning rules live inversioning_data, notper_type).Root partition, activity type
user_datapopulated with the rate limit config set viaUpdateTaskQueueConfig.Non-root partition, workflow type
Same version as root — replication is working.
Non-root partition, activity type
Unspecified type defaults to workflow
Passing
TASK_QUEUE_TYPE_UNSPECIFIEDdefaults to workflow type instead of erroring — output matches the workflow-type test above.