You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TiFlash only supports the read-only statement due to a historical reason(or mistake?).
The worry in the past is that TiFlash can not support select ... for update because this SQL acquires some transaction locks and can not be done in TiFlash.
The behavior of the lock acquired by select ... for update in TiDB is a little bit complicated.
There are two kinds of cases:
If the primary key or unique key can be used for the condition, then PointGet or BatchPointGet will be used. The lock will be acquired when getting the result. Note that the lock is acquired no matter whether the data exists or not. This case can only be handled in TiKV.
Else coprocessor will be used. TiDB gets the row data and then sends lock requests to TiKV.
In case 1, it's very tricky. Fortunately, TiFlash doesn't support PointGet or BatchPointGet. It can only be sent to TiKV.
In case 2, there is no difference between TiKV and TiFlash that does the coprocessor work.
In conclusion, it's totally ok to enable write statements to read on TiFlash.
However, TiFlash only supports read-only statements for a long time, and the support of SQL mode is weak, there are many different behaviors when meeting warnings or errors. For example, in strict SQL mode, division by zero is a warning in read SQL while it's an error in write SQL. TiFlash doesn't distinguish the read SQL and write SQL for now.
Though we can not turn on this feature immediately, a config can be added for testing.
The text was updated successfully, but these errors were encountered:
Enhancement
TiFlash only supports the read-only statement due to a historical reason(or mistake?).
The worry in the past is that TiFlash can not support
select ... for update
because this SQL acquires some transaction locks and can not be done in TiFlash.The behavior of the lock acquired by
select ... for update
in TiDB is a little bit complicated.There are two kinds of cases:
PointGet
orBatchPointGet
will be used. The lock will be acquired when getting the result. Note that the lock is acquired no matter whether the data exists or not. This case can only be handled in TiKV.In case 1, it's very tricky. Fortunately, TiFlash doesn't support
PointGet
orBatchPointGet
. It can only be sent to TiKV.In case 2, there is no difference between TiKV and TiFlash that does the coprocessor work.
In conclusion, it's totally ok to enable write statements to read on TiFlash.
However, TiFlash only supports read-only statements for a long time, and the support of SQL mode is weak, there are many different behaviors when meeting warnings or errors. For example, in strict SQL mode, division by zero is a warning in read SQL while it's an error in write SQL. TiFlash doesn't distinguish the read SQL and write SQL for now.
Though we can not turn on this feature immediately, a config can be added for testing.
The text was updated successfully, but these errors were encountered: