4paradigm / 4paradigm/OpenMLDB

`CallProcedure` request may not be routed to the best tablet when `partitionnum` > 1

Open
#1,604 2 comments 0 reactions 1 assignee Claimed by @zhanghaohit View on GitHub
enhancement
Dominant language
C++
Stars
1.7k
Forks
331
Avg merge
12d 12h
Merged PRs (30d)
1

Description

**Bug Description**
When the `partitionnum` of a table is > 1, `CallProcedure` request is routed to a random tablet.

Current logic is:
`pid = rand_.Uniform(pid_num);`

The result is wrong but we may have to fetch data from remote tablet to the routed tablet.

**Expected Behavior**
`CallProcedure` request should be routed to the tablet based on the pk.

**Steps to Reproduce**

1. `SQLSDKQueryTest.RequestProcedureTest`: change create statement with `options(partitionnum=8)`
2. will generate a proxy task

Contributor guide

Open the contributing guide

Research direction

The issue points to a routing logic in the code where `pid = rand_.Uniform(pid_num);` is used. Look for the `CallProcedure` request handling and the tablet routing logic. The test `SQLSDKQueryTest.RequestProcedureTest` needs to be modified to use `options(partitionnum=8)` to reproduce. Understanding the partitioning and primary key (pk) based routing is key. Check how other requests route based on pk to see the pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.