Skip to content

Commit 68af392

Browse files
Modify tests and documentation for new return row semantics
Depending on server-side support successful put and delete operations may return existing row information where they did not previously
1 parent 43f90cc commit 68af392

File tree

6 files changed

+245
-81
lines changed

6 files changed

+245
-81
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](http://keepachangelog.com/).
44

5-
## Unreleased
5+
## [Unreleased]
6+
7+
### Fixed
8+
- Fixed an issue when stats collection is enabled debug logs were not
9+
logging.
10+
11+
### Changed
12+
- Put and Put if-present can return the existing row when setReturnRow is
13+
set to true and row already exists.
14+
- Delete can return the deleted row when setReturnRow is set to true.
615

716
### Added
817
- Cloud only: added new OCI regions (RKT, SHJ, RUH, EBB, EBL)

driver/src/main/java/oracle/nosql/driver/NoSQLHandle.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,22 @@ public interface NoSQLHandle extends AutoCloseable {
132132
* on whether the {@link Version} of an existing row matches that supplied
133133
* by {@link DeleteRequest#setMatchVersion}.
134134
* <p>
135-
* It is also possible, on failure, to return information about the existing
136-
* row. The row, including it's {@link Version} can be optionally returned
137-
* if a delete operation fails because of a Version mismatch. The existing
138-
* row information will only be returned if
139-
* {@link DeleteRequest#setReturnRow} is true and the operation fails
140-
* because {@link DeleteRequest#setMatchVersion} is used and the operation
135+
* It is also possible to return information about the existing
136+
* row. The row, including it's {@link Version} can be optionally returned.
137+
* The existing row information will only be returned if
138+
* {@link DeleteRequest#setReturnRow} is true and one of the following
139+
* occurs:
140+
* <ul>
141+
* <li> The {@link DeleteRequest#setMatchVersion} is used and the operation
141142
* fails because the row exists and its version does not match.
143+
* </li>
144+
* <li> The {@link DeleteRequest#setMatchVersion} is not used and the
145+
* operation succeeds provided that the server supports providing the
146+
* existing row.
147+
* </li>
148+
* </ul>
142149
* Use of {@link DeleteRequest#setReturnRow} may result in additional
143-
* consumed read capacity. If the operation is successful there will be
144-
* no information returned about the previous row.
150+
* consumed read capacity.
145151
*
146152
* @param request the input parameters for the operation
147153
*
@@ -204,22 +210,26 @@ public interface NoSQLHandle extends AutoCloseable {
204210
* {@link Version} matches that provided</li>
205211
* </ul>
206212
* <p>
207-
* It is also possible, on failure, to return information about the existing
208-
* row. The row, including it's {@link Version} can be optionally returned
209-
* if a put operation fails because of a Version mismatch or if the
210-
* operation fails because the row already exists. The existing row
211-
* information will only be returned if {@link PutRequest#setReturnRow} is
212-
* true and one of the following occurs:
213+
* It is also possible to return information about the existing
214+
* row. The row, including it's {@link Version} can be optionally returned.
215+
* The existing row information will only be returned if
216+
* {@link PutRequest#setReturnRow} is true and one of the following occurs:
213217
* <ul>
214218
* <li>The {@link Option#IfAbsent} is used and the operation fails because
215219
* the row already exists.</li>
216220
* <li>The {@link Option#IfVersion} is used and the operation fails because
217221
* the row exists and its version does not match.
218222
* </li>
223+
* <li>The {@link Option#IfPresent} is used and the operation succeeds
224+
* provided that the server supports providing the existing row.
225+
* </li>
226+
* <li>The {@link Option} is not used and put operation replaces the
227+
* existing row provided that the server supports providing the existing
228+
* row.
229+
* </li>
219230
* </ul>
220231
* Use of {@link PutRequest#setReturnRow} may result in additional
221-
* consumed read capacity. If the operation is successful there will be
222-
* no information returned about the previous row.
232+
* consumed read capacity.
223233
*
224234
* @param request the input parameters for the operation
225235
*

driver/src/main/java/oracle/nosql/driver/http/StatsControlImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ public class StatsControlImpl
4242
this.statsHandler = config.getStatsHandler();
4343

4444
if (profile != Profile.NONE) {
45-
if (config.getStatsEnableLog() &&
46-
( logger.getLevel() == null ||
47-
logger.getLevel().intValue() > Level.INFO.intValue())) {
45+
/* when stats collection is enabled set log level to INFO if it
46+
* is not set.
47+
*/
48+
if (config.getStatsEnableLog() && !logger.isLoggable(Level.INFO)) {
4849
logger.setLevel(Level.INFO);
4950
}
5051
logger.log(Level.INFO, LOG_PREFIX +

0 commit comments

Comments
 (0)