Evgeny Stanilovsky created IGNITE-20925:
-------------------------------------------
Summary: Sql. Await primary replica only once per transaction,
avoid of terms in enlist.
Key: IGNITE-20925
URL: https://issues.apache.org/jira/browse/IGNITE-20925
Project: Ignite
Issue Type: Improvement
Components: sql
Affects Versions: 3.0.0-beta1
Reporter: Evgeny Stanilovsky
After [1] for statements like :
START TRANSACTION;
INSERT INTO T1 VALUES(1);
INSERT INTO T1 VALUES(2);
COMMIT;
we will call primary partition detection code SqlQueryProcessor#primaryReplicas
as many times as insert operation is raised. It`s weird cause :
1. If transaction already enlisted into NODE1 for TABLE1_PARTITION1 in scope of
this transaction it can`t be enlisted into different NODE2 for
TABLE1_PARTITION1 due to lease expiration or node failure scenarios.
2. Additional useless time consumption due to code execution.
Additionally seems we can call [2] for already awaited primary partitions.
Thus proposal is:
1. Reduce calling primaryReplicas for 1 time per source and store this call
usage only for further mapping planning.
2. Change semantic IgniteRelShuttle#enlist(int tableId, List<NodeWithTerm>
assignments) for IgniteRelShuttle#enlist(int tableId, HybridTimestamp clock)
seems no need to transfer assignments here they can be obtained from [2]. Also
we can check tx.enlistedNodeAndTerm(tablePartId) and ReplicaMeta#getStartTime
for term equality is not equal fast exception can be raised otherwise we need
to wait such exception from tx erroneous enlisting logic.
[1] https://issues.apache.org/jira/browse/IGNITE-19619
[2] PlacementDriver#getPrimaryReplica
--
This message was sent by Atlassian Jira
(v8.20.10#820010)