[ 
https://issues.apache.org/jira/browse/IGNITE-7015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294317#comment-16294317
 ] 

Roman Kondakov commented on IGNITE-7015:
----------------------------------------

[~vozerov], I optimized my patch as you wrote in a comment above. A set of the 
indexed columns was added to {{GridH2Table}}. This set is changed on each index 
add/remove action. Temporary indexes are considered as normal indexes in this 
case. All comparison logic moved to {{GridH2Table}}.

As for {{GridQueryProcessor.store}} invocation - I went through the code 
execution in case of in-place update is possible and made sure that 
{{GridQueryProcessor.store}} is not executed in this case because in the method 
 {{GridCacheMapEntry.AtomicCacheUpdateClosure#update}} we can see this snippet:

{code:java}
treeOp = oldRow != null && oldRow.link() == newRow.link() ?
                    IgniteTree.OperationType.NOOP : 
IgniteTree.OperationType.PUT;
{code}

which is responsible for a choosing further tree operation after the closure 
update. And if rows links are equal (which is true for in-place update), the 
{{NOOP}} is chosen and therefore methods {{CacheDataStoreImpl#finishUpdate}} 
and {{GridQueryProcessor#store}} are not called in 
{{CacheDataStoreImpl#invoke}}.

TC tests are OK. Please review.

> SQL: index should be updated only when relevant values changed
> --------------------------------------------------------------
>
>                 Key: IGNITE-7015
>                 URL: https://issues.apache.org/jira/browse/IGNITE-7015
>             Project: Ignite
>          Issue Type: Task
>          Components: sql
>            Reporter: Vladimir Ozerov
>            Assignee: Roman Kondakov
>              Labels: iep-1, performance
>             Fix For: 2.4
>
>
> See {{GridH2Table.update}} method. Whenever value is updated, we propagate it 
> to all indexes. Consider the following case:
> 1) Old row is not null, so this is "update", not "create".
> 2) Link hasn't changed
> 3) Indexed fields haven't changed
> If all conditions are met, we can skip index update completely, as state 
> before and after will be the same. This is especially important when 
> persistence is enabled because currently we generate unnecessary dirty pages 
> what increases IO pressure.
> Suggested fix:
> 1) Iterate over index columns, skipping key and affinity columns (as they are 
> guaranteed to be the same);
> 2) Compare relevant index columns of both old and new rows
> 3) If all columns are equal, do nothing.
> Fields should be read through {{GridH2KeyValueRowOnheap#getValue}}, because 
> in this case we will re-use value cache transparently.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to