treat the type of 'dual' table as 'TypeReference'#5268
treat the type of 'dual' table as 'TypeReference'#5268sougou merged 2 commits intovitessio:masterfrom
Conversation
eee755c to
35fe4b1
Compare
|
@sougou In this case can we return response from cache or just return a canned response? |
|
I agree in principle. However, we also need to remove the Another alternative is to categorize |
|
This is an interesting approach, but it will work incorrectly for non-idempotent expressions like I think changing |
|
@sougou Thanks for your advice. I've updated this PR, and only changed a small piece of logic. I also add a test case for last_insert_id(). |
Signed-off-by: wh <wanghao.seed@gmail.com>
77aa432 to
27b5aae
Compare
sougou
left a comment
There was a problem hiding this comment.
Sorry about not being clear on this one. The change should actually be much simpler. All you have to do is change this function: https://github.com/vitessio/vitess/blob/master/go/vt/vtgate/vindexes/vschema.go#L367 to create dual as a reference table instead of one that's pinned to keyspace id 0.
Signed-off-by: wh <wanghao.seed@gmail.com>
32bb9e9 to
001ec07
Compare
|
@sougou I was just thinking of not changing exist test cases. But what you have mentioned above are totally right, I've fixed it. |
JDBC Driver may produce the following sql which includes pseudo table 'dual':
select @@session.tx_read_only from dual
select @@session.tx_isolation from dual
select 1 from dual
... etc.
The default behavior of vtgate to treat those sql queries is routing them to a default shard, which will significantly increase the burden on a specific vttablet.

why not treating the route type of those sql queries as SelectDBA? Since these sql queries will be executed on any shard and will not result in any hotspot among vttablets.