Skip to content

Commit 92f16ee

Browse files
authored
Added support for On-Demand tables (#17)
- Cloud only: Support for On-Demand tables in TableLimits - Row modification time made available in GetResult - Existing row modification time made available in PutResult and DeleteResult when operation fails and previous value is requested - On-Prem only: Support for setting Durability in write operations (put/delete/writeMultiple/multiDelete) Changed: - Internally, the SDK now detects the serial version of the server it's connected to, and adjusts its capabilities to match. If the server is an older version, and some features may not be available, client apps may get a one-time log message (at INFO level) with text like "The requested feature is not supported by the connected server".
1 parent f256668 commit 92f16ee

31 files changed

+972
-77
lines changed

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
3-
43
The format is based on [Keep a Changelog](http://keepachangelog.com/).
54

5+
## [Unreleased]
6+
7+
### Added
8+
- Cloud only: Support for On-Demand tables in TableLimits
9+
- Row modification time made available in GetResult
10+
- Existing row modification time made available in PutResult and DeleteResult when operation fails and previous value is requested
11+
- On-Prem only: Support for setting Durability in write operations (put/delete/writeMultiple/multiDelete)
12+
13+
### Changed
14+
- Internally, the SDK now detects the serial version of the server it's connected to, and adjusts its capabilities to match. If the server is an older version, and some features may not be available, client apps may get a one-time log message (at INFO level) with text like "The requested feature is not supported by the connected server".
15+
16+
617
## [5.2.31] 2022-01-28
718

819
Oracle internal use release
@@ -78,7 +89,7 @@ NoSQLHandleConfig.setPoolMaxPending() and NoSQLHandleConfig.getPoolMaxPending().
7889
- Added new SignatureProvider constructors to allow use of an instance principal with delegation token in a file for authorization and authentication.
7990
- SignatureProvider.createInstancePrincipalForDelegation(File delegationTokenFile)
8091
- SignatureProvider.createInstancePrincipalForDelegation(String iamAuthUri, Region region, File delegationTokenFile, Logger logger)
81-
- Added is* methods on FieldValue for convenience checking of whether an instance is
92+
- Added methods on FieldValue for convenience checking of whether an instance is
8293
of a given type, e.g. FieldValue.isInteger(), etc.
8394

8495
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ project. The version changes with each release.
3737
<dependency>
3838
<groupId>com.oracle.nosql.sdk</groupId>
3939
<artifactId>nosqldriver</artifactId>
40-
<version>5.2.31</version>
40+
<version>5.3.0</version>
4141
</dependency>
4242
```
4343

driver/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<groupId>com.oracle.nosql.sdk</groupId>
3131
<artifactId>nosqldriver</artifactId>
32-
<version>5.2.31</version>
32+
<version>5.3.0</version>
3333
<packaging>jar</packaging>
3434

3535
<organization>
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
/*-
2+
* Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* Licensed under the Universal Permissive License v 1.0 as shown at
5+
* https://oss.oracle.com/licenses/upl/
6+
*/
7+
8+
package oracle.nosql.driver;
9+
10+
/**
11+
* Defines the durability characteristics associated with a standalone write
12+
* (put or update) operation.
13+
* <p>
14+
* This is currently only supported in On-Prem installations. It is ignored
15+
* in the cloud service.
16+
* <p>
17+
* The overall durability is a function of the {@link SyncPolicy} and {@link
18+
* ReplicaAckPolicy} in effect for the Master, and the {@link SyncPolicy} in
19+
* effect for each Replica.
20+
* </p>
21+
*
22+
* @since 5.3.0
23+
*/
24+
public class Durability {
25+
26+
/**
27+
* A convenience constant that defines a durability policy with COMMIT_SYNC
28+
* for Master commit synchronization.
29+
*
30+
* The policies default to COMMIT_NO_SYNC for commits of replicated
31+
* transactions that need acknowledgment and SIMPLE_MAJORITY for the
32+
* acknowledgment policy.
33+
*/
34+
public static final Durability COMMIT_SYNC =
35+
new Durability(SyncPolicy.SYNC,
36+
SyncPolicy.NO_SYNC,
37+
ReplicaAckPolicy.SIMPLE_MAJORITY);
38+
39+
/**
40+
* A convenience constant that defines a durability policy with
41+
* COMMIT_NO_SYNC for Master commit synchronization.
42+
*
43+
* The policies default to COMMIT_NO_SYNC for commits of replicated
44+
* transactions that need acknowledgment and SIMPLE_MAJORITY for the
45+
* acknowledgment policy.
46+
*/
47+
public static final Durability COMMIT_NO_SYNC =
48+
new Durability(SyncPolicy.NO_SYNC,
49+
SyncPolicy.NO_SYNC,
50+
ReplicaAckPolicy.SIMPLE_MAJORITY);
51+
52+
/**
53+
* A convenience constant that defines a durability policy with
54+
* COMMIT_WRITE_NO_SYNC for Master commit synchronization.
55+
*
56+
* The policies default to COMMIT_NO_SYNC for commits of replicated
57+
* transactions that need acknowledgment and SIMPLE_MAJORITY for the
58+
* acknowledgment policy.
59+
*/
60+
public static final Durability COMMIT_WRITE_NO_SYNC =
61+
new Durability(SyncPolicy.WRITE_NO_SYNC,
62+
SyncPolicy.NO_SYNC,
63+
ReplicaAckPolicy.SIMPLE_MAJORITY);
64+
65+
/**
66+
* Defines the synchronization policy to be used when committing a
67+
* transaction. High levels of synchronization offer a greater guarantee
68+
* that the transaction is persistent to disk, but trade that off for
69+
* lower performance.
70+
*/
71+
public enum SyncPolicy {
72+
73+
/**
74+
* Write and synchronously flush the log on transaction commit.
75+
* Transactions exhibit all the ACID (atomicity, consistency,
76+
* isolation, and durability) properties.
77+
*/
78+
SYNC,
79+
80+
/**
81+
* Do not write or synchronously flush the log on transaction commit.
82+
* Transactions exhibit the ACI (atomicity, consistency, and isolation)
83+
* properties, but not D (durability); that is, database integrity will
84+
* be maintained, but if the application or system fails, it is
85+
* possible some number of the most recently committed transactions may
86+
* be undone during recovery. The number of transactions at risk is
87+
* governed by how many log updates can fit into the log buffer, how
88+
* often the operating system flushes dirty buffers to disk, and how
89+
* often log checkpoints occur.
90+
*/
91+
NO_SYNC,
92+
93+
/**
94+
* Write but do not synchronously flush the log on transaction commit.
95+
* Transactions exhibit the ACI (atomicity, consistency, and isolation)
96+
* properties, but not D (durability); that is, database integrity will
97+
* be maintained, but if the operating system fails, it is possible
98+
* some number of the most recently committed transactions may be
99+
* undone during recovery. The number of transactions at risk is
100+
* governed by how often the operating system flushes dirty buffers to
101+
* disk, and how often log checkpoints occur.
102+
*/
103+
WRITE_NO_SYNC;
104+
}
105+
106+
/**
107+
* A replicated environment makes it possible to increase an application's
108+
* transaction commit guarantees by committing changes to its replicas on
109+
* the network. ReplicaAckPolicy defines the policy for how such network
110+
* commits are handled.
111+
*/
112+
public enum ReplicaAckPolicy {
113+
114+
/**
115+
* All replicas must acknowledge that they have committed the
116+
* transaction. This policy should be selected only if your replication
117+
* group has a small number of replicas, and those replicas are on
118+
* extremely reliable networks and servers.
119+
*/
120+
ALL,
121+
122+
/**
123+
* No transaction commit acknowledgments are required and the master
124+
* will never wait for replica acknowledgments. In this case,
125+
* transaction durability is determined entirely by the type of commit
126+
* that is being performed on the master.
127+
*/
128+
NONE,
129+
130+
/**
131+
* A simple majority of replicas must acknowledge that they have
132+
* committed the transaction. This acknowledgment policy, in
133+
* conjunction with an election policy which requires at least a simple
134+
* majority, ensures that the changes made by the transaction remains
135+
* durable if a new election is held.
136+
*/
137+
SIMPLE_MAJORITY;
138+
}
139+
140+
/* The sync policy in effect on the Master node. */
141+
private final SyncPolicy masterSync;
142+
143+
/* The sync policy in effect on a replica. */
144+
final private SyncPolicy replicaSync;
145+
146+
/* The replica acknowledgment policy to be used. */
147+
final private ReplicaAckPolicy replicaAck;
148+
149+
/**
150+
* Creates an instance of a Durability specification.
151+
*
152+
* @param masterSync the SyncPolicy to be used when committing the
153+
* transaction on the Master.
154+
* @param replicaSync the SyncPolicy to be used remotely, as part of a
155+
* transaction acknowledgment, at a Replica node.
156+
* @param replicaAck the acknowledgment policy used when obtaining
157+
* transaction acknowledgments from Replicas.
158+
*/
159+
public Durability(SyncPolicy masterSync,
160+
SyncPolicy replicaSync,
161+
ReplicaAckPolicy replicaAck) {
162+
this.masterSync = masterSync;
163+
this.replicaSync = replicaSync;
164+
this.replicaAck = replicaAck;
165+
}
166+
167+
@Override
168+
public String toString() {
169+
return masterSync.toString() + "," +
170+
replicaSync.toString() + "," +
171+
replicaAck.toString();
172+
}
173+
174+
/**
175+
* Returns the transaction synchronization policy to be used on the Master
176+
* when committing a transaction.
177+
* @return the master transaction synchronization policy
178+
*/
179+
public SyncPolicy getMasterSync() {
180+
return masterSync;
181+
}
182+
183+
/**
184+
* Returns the transaction synchronization policy to be used by the replica
185+
* as it replays a transaction that needs an acknowledgment.
186+
* @return the replica transaction synchronization policy
187+
*/
188+
public SyncPolicy getReplicaSync() {
189+
return replicaSync;
190+
}
191+
192+
/**
193+
* Returns the replica acknowledgment policy used by the master when
194+
* committing changes to a replicated environment.
195+
* @return the replica acknowledgment policy
196+
*/
197+
public ReplicaAckPolicy getReplicaAck() {
198+
return replicaAck;
199+
}
200+
201+
@Override
202+
public int hashCode() {
203+
final int prime = 31;
204+
int result = 1;
205+
result = (prime * result) + masterSync.hashCode();
206+
result = (prime * result) + replicaAck.hashCode();
207+
result = (prime * result) + replicaSync.hashCode();
208+
return result;
209+
}
210+
211+
@Override
212+
public boolean equals(Object obj) {
213+
if (this == obj) {
214+
return true;
215+
}
216+
if (obj == null) {
217+
return false;
218+
}
219+
if (!(obj instanceof Durability)) {
220+
return false;
221+
}
222+
Durability other = (Durability) obj;
223+
if (!masterSync.equals(other.masterSync)) {
224+
return false;
225+
}
226+
if (!replicaAck.equals(other.replicaAck)) {
227+
return false;
228+
}
229+
if (!replicaSync.equals(other.replicaSync)) {
230+
return false;
231+
}
232+
return true;
233+
}
234+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public class NoSQLHandleConfig implements Cloneable {
150150
private List<String> ciphers;
151151

152152
/**
153-
* The protocols used by the driver, or null if not configured
153+
* The SSL protocols used by the driver, or null if not configured
154154
* by the user.
155155
*/
156156
private List<String> protocols;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*-
2+
* Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* Licensed under the Universal Permissive License v 1.0 as shown at
5+
* https://oss.oracle.com/licenses/upl/
6+
*/
7+
8+
package oracle.nosql.driver;
9+
10+
/**
11+
* This exception is thrown if the server does not support the current
12+
* driver protocol version.
13+
*
14+
* @since 5.3.0
15+
*/
16+
public class UnsupportedProtocolException extends NoSQLException {
17+
18+
private static final long serialVersionUID = 1L;
19+
20+
/**
21+
* @hidden
22+
* @param msg the exception message
23+
*/
24+
public UnsupportedProtocolException(String msg) {
25+
super(msg);
26+
}
27+
}

0 commit comments

Comments
 (0)