[
https://issues.apache.org/jira/browse/OPENJPA-3057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136938#comment-18136938
]
ASF subversion and git services commented on OPENJPA-3057:
----------------------------------------------------------
Commit 18908d59da3bc00dbab57200b63095e8b26829cc in openjpa's branch
refs/heads/master from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=18908d59d ]
[OPENJPA-3057] Apply the slice target to bulk UPDATE and native bulk statements
(#253)
A JPQL bulk UPDATE and a native SQL UPDATE or DELETE ran on every slice,
ignoring the openjpa.hint.slice.Target hint; only queries and the JPQL bulk
DELETE filtered by target. A configured QueryTargetPolicy was not applied to
any bulk statement, since it was only consulted in execute(Map).
- Filter by target in DistributedStoreQuery#executeUpdate and in both bulk
methods of DistributedSQLStoreQuery, as executeDelete already does.
- Apply the QueryTargetPolicy in deleteAll/updateAll as well.
- A target hint that names no active slice now fails instead of running on
all slices. Without a target a statement still runs on all slices.
- Setting another hint after the target hint no longer resets the explicit
target, so a policy does not replace it.
> 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
> Priority: Major
> 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)