apache / apache/grails-core

Query.Lock(boolean) ignores false

Open
#14,501 0 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Task List

- [x] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)

### Steps to Reproduce
1. Call `Query.lock(false)`
3. Observe that it still locks

### Expected Behaviour
If false is passed into the method it should set `LockModeType.NONE`.

### Actual Behaviour
`LockModeType.PESSIMISTIC_WRITE` is always used.

### Example Application
This is easy to verify by inspecting the short method:
https://github.com/grails/grails-data-mapping/blob/ef1730a42bc515cfb96cf9175d81e344d8a08a61/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java#L137-L140

Contributor guide

Open the contributing guide

Research direction

Start with grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java at the linked lines for Query.lock(boolean). Verify the method's behavior for both true and false inputs; done means false selects LockModeType.NONE while preserving the existing locking behavior for true.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.