mengw15 opened a new pull request, #6906:
URL: https://github.com/apache/texera/pull/6906

   ### What changes were proposed in this PR?
   
   `add_sub_queue` appended a newly created `PriorityGroup` to the end of 
`priority_groups` in the branch that fires when the new group belongs *before* 
the scanned one (`pg.priority > priority`), leaving the list unsorted. The `i` 
counter maintained by that loop exists for exactly this insert and was 
otherwise unused. `DefaultSubQueueSelection.get_next`/`peek` iterate 
`priority_groups` in list order and never compare `pg.priority`, so list order 
*is* the priority order and an unsorted list silently disables prioritisation.
   
   For the worker this means: `InternalQueue` registers `SYSTEM=0`, control 
channels `=1`, data channels `=2`, and registers each channel lazily on its 
first `put`. If any data channel is registered before its control channel, 
`priority_groups` ends up `[0, 2, 1]` and control-channel elements are served 
after data-channel ones — so a paused or queried worker's response time starts 
depending on how much data is backed up, with no exception and nothing in the 
logs. The `not added` fallback further down keeps its `append`, which is 
correct there since that branch only runs when the new group really is the 
lowest priority.
   
   The fix is `insert(i, new_pg)`. No new test was needed: #6444 already added 
`test_control_elements_dequeue_before_data_even_if_data_channel_registered_first`
 for this exact scenario but had to mark it `@pytest.mark.xfail`, naming this 
root cause in its `reason`; this PR drops that marker so the existing test 
guards the fix.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6905. The `xfail` removed here was introduced by #6444. Spotted by 
Copilot while reviewing #6903, which touches neighbouring lines in the same 
method but is otherwise unrelated (it repairs the removal paths).
   
   ### How was this PR tested?
   
   `pytest -m "not integration"` passes with 819 tests and no `xpassed` left; 
`ruff check` and `ruff format --check` are clean. The un-xfailed test fails on 
`main` and passes with the fix, and reverting the one-line change turns it red 
again, so it genuinely guards this line. Also checked all 24 registration 
orders of four priorities now sort correctly, and that same-priority sub-queues 
still share one group.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Fable 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to