Richard Zowalla created OPENJPA-3057:
----------------------------------------

             Summary: Slice target hint and QueryTargetPolicy are ignored by 
bulk UPDATE and native bulk statements
                 Key: OPENJPA-3057
                 URL: https://issues.apache.org/jira/browse/OPENJPA-3057
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Richard Zowalla
            Assignee: Richard Zowalla
             Fix For: 4.2.0


In openjpa-slice, the target slices of a query (the 
{{openjpa.hint.slice.Target}} hint or a configured {{QueryTargetPolicy}}) are 
honoured by queries and by a JPQL bulk DELETE, but not by the other bulk 
statements:

* A JPQL bulk UPDATE runs on every slice: 
{{DistributedStoreQuery.ParallelExecutor#executeUpdate}} loops over all 
executors without calling {{findTargets()}}, while {{#executeDelete}} in the 
same class does.
* A native SQL UPDATE or DELETE run with {{executeUpdate()}} runs on every 
slice: {{DistributedSQLStoreQuery.ParallelExecutor#executeDelete}} and 
{{#executeUpdate}} do not filter either, while {{#executeQuery}} does.
* A configured {{QueryTargetPolicy}} is not applied to any bulk statement, 
including the JPQL DELETE: the policy is applied in 
{{DistributedQueryImpl.execute(Map)}}, and {{deleteAll}}/{{updateAll}} do not 
go through it.
* A target hint that names no active slice falls back to all slices 
({{DistributedJDBCStoreManager#getTargets}}).
* {{TargetFetchConfiguration.setHint}} resets the explicit-target flag when any 
other hint is set after the target hint, so a configured policy then replaces 
the explicit target.

The bulk UPDATE path was never brought in line when the DELETE path got its 
target filter (OPENJPA-2365).

Fix: filter by target in all bulk executors, apply the {{QueryTargetPolicy}} to 
bulk statements, and fail with an error when the target names no active slice 
instead of running on all slices. Without any target the statement still runs 
on all slices, as documented.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to