public interface TableAPI
key/value interface. While the two interfaces
are not incompatible, in general applications will use one or the other.
To create a TableAPI instance use getTableAPI().
The table interface is required to use secondary indexes and supported data types.
Tables are similar to tables in a relational database. They are named and
contain a set of strongly typed records, called rows. Rows in an Oracle
NoSQL Database table are analogous to rows in a relational system and each
row has one or more named, typed data values. These fields can be compared
to a relational database column. A single top-level row in a table is
contained in a Row object. Row is used as return value for TableAPI
get operations as well as a key plus value object for TableAPI put
operations. All rows in a given table have the same fields. Tables have a
well-defined primary key which comprises one or more of its fields, in
order. Primary key fields must be simple (single-valued) data types.
The data types supported in tables are well-defined and include simple single-valued types such as Integer, String, Date, etc., in addition to several complex, multi-valued types -- Array, Map, and Record. Complex objects allow for creation of arbitrarily complex, nested rows.
All operations on this interface include parameters that supply optional arguments to control non-default behavior. The types of these parameter objects varies depending on whether the operation is a read, update, or a multi-read style operation returning more than one result or an iterator.
In order to control, and take advantage of sharding across partitions tables may be defined in a hierarchy. A top-level table is one without a parent and may be defined in a way such that its primary key spreads the table rows across partitions. The primary key for this sort of table has a complete shard key but an empty minor key. Tables with parents always have a primary key with a minor key. The primary key of a child table comprises the primary key of its immediate parent plus the fields defined in the child table as being part of its primary key. This means that the fields of a child table implicitly include the primary key fields of all of its ancestors.
Some of the methods in this interface include MultiRowOptions which
can be used to cause operations to return not only rows from the target
table but from its ancestors and descendant tables as well. This allows
for efficient and transactional mechanisms to return related groups of rows.
The MultiRowOptions object is also used to specify value ranges that apply
to the operation.
Iterators returned by methods of this interface can only be used safely
by one thread at a time unless synchronized externally.
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
SYSDEFAULT_NAMESPACE_NAME |
Name of "sysdefault" namespace.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
delete(PrimaryKey key,
ReturnRow prevRow,
WriteOptions writeOptions) |
Deletes a row from a table.
|
boolean |
deleteIfVersion(PrimaryKey key,
Version matchVersion,
ReturnRow prevRow,
WriteOptions writeOptions) |
Deletes a row from a table but only if its version matches the one
specified in matchVersion.
|
ExecutionFuture |
execute(java.lang.String statement) |
Deprecated.
since 3.3 in favor of
KVStore.execute(java.util.List<oracle.kv.Operation>) |
java.util.List<TableOperationResult> |
execute(java.util.List<TableOperation> operations,
WriteOptions writeOptions) |
This method provides an efficient and transactional mechanism for
executing a sequence of operations associated with tables that share the
same shard key portion of their primary keys.
|
StatementResult |
executeSync(java.lang.String statement) |
Deprecated.
since 3.3 in favor of
KVStore.executeSync(java.lang.String) |
Row |
get(PrimaryKey key,
ReadOptions readOptions) |
Gets the
Row associated with the primary key. |
Table |
getTable(java.lang.String fullNamespaceName) |
Gets an instance of a table.
|
Table |
getTable(java.lang.String namespace,
java.lang.String tableFullName) |
Gets an instance of a table.
|
TableOperationFactory |
getTableOperationFactory() |
Returns a
TableOperationFactory to create operations passed
to execute(java.lang.String). |
java.util.Map<java.lang.String,Table> |
getTables() |
Gets all known tables.
|
java.util.Map<java.lang.String,Table> |
getTables(java.lang.String namespace) |
Gets all known tables in the specified namespace.
|
java.util.Set<java.lang.String> |
listNamespaces() |
Gets all known namespaces.
|
int |
multiDelete(PrimaryKey key,
MultiRowOptions getOptions,
WriteOptions writeOptions) |
Deletes multiple rows from a table in an atomic operation.
|
java.util.List<Row> |
multiGet(PrimaryKey key,
MultiRowOptions getOptions,
ReadOptions readOptions) |
Returns the rows associated with a partial primary key in an
atomic manner.
|
java.util.List<PrimaryKey> |
multiGetKeys(PrimaryKey key,
MultiRowOptions getOptions,
ReadOptions readOptions) |
Return the keys associated with a partial primary key in an
atomic manner.
|
void |
put(java.util.List<EntryStream<Row>> streams,
BulkWriteOptions bulkWriteOptions) |
Loads rows supplied by special purpose streams into the store.
|
Version |
put(Row row,
ReturnRow prevRow,
WriteOptions writeOptions) |
Puts a row into a table.
|
Version |
putIfAbsent(Row row,
ReturnRow prevRow,
WriteOptions writeOptions) |
Puts a row into a table, but only if the row does not exist.
|
Version |
putIfPresent(Row row,
ReturnRow prevRow,
WriteOptions writeOptions) |
Puts a row into a table, but only if the row already exists.
|
Version |
putIfVersion(Row row,
Version matchVersion,
ReturnRow prevRow,
WriteOptions writeOptions) |
Puts a row, but only if the version of the existing row matches the
matchVersion argument.
|
TableIterator<Row> |
tableIterator(java.util.Iterator<PrimaryKey> primaryKeyIterator,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the rows matching the primary keys supplied by
iterator (or the rows in ancestor or descendant tables, or those in a
range specified by the MultiRowOptions argument).
|
TableIterator<Row> |
tableIterator(java.util.List<java.util.Iterator<PrimaryKey>> primaryKeyIterators,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the rows matching the primary keys supplied by
iterator (or the rows in ancestor or descendant tables, or those in a
range specified by the MultiRowOptions argument).
|
TableIterator<Row> |
tableIterator(IndexKey key,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the rows associated with an index key.
|
TableIterator<Row> |
tableIterator(PrimaryKey key,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the rows associated with a partial primary key.
|
TableIterator<PrimaryKey> |
tableKeysIterator(java.util.Iterator<PrimaryKey> primaryKeyIterator,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the keys matching the primary keys supplied by
iterator (or the rows in ancestor or descendant tables, or those in a
range specified by the MultiRowOptions argument).
|
TableIterator<PrimaryKey> |
tableKeysIterator(java.util.List<java.util.Iterator<PrimaryKey>> primaryKeyIterators,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the keys matching the primary keys supplied by
iterator (or the rows in ancestor or descendant tables, or those in a
range specified by the MultiRowOptions argument).
|
TableIterator<KeyPair> |
tableKeysIterator(IndexKey key,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Return the keys for matching rows associated with an index key.
|
TableIterator<PrimaryKey> |
tableKeysIterator(PrimaryKey key,
MultiRowOptions getOptions,
TableIteratorOptions iterateOptions) |
Returns an iterator over the keys associated with a partial primary key.
|
static final java.lang.String SYSDEFAULT_NAMESPACE_NAME
@Deprecated ExecutionFuture execute(java.lang.String statement) throws java.lang.IllegalArgumentException, KVSecurityException, FaultException
KVStore.execute(java.util.List<oracle.kv.Operation>)
An ExecutionFuture instance is returned which extends
Future and can be used to get information
about the status of the operation, or to await completion of the
operation.
For example:
// Create a table
ExecutionFuture future = null;
try {
future = tableAPI.execute
("CREATE TABLE users (" +
"id INTEGER, " +
"firstName STRING, " +
"lastName STRING, " +
"age INTEGER, " +
"PRIMARY KEY (id))");
} catch (IllegalArgumentException e) {
System.out.println("The statement is invalid: " + e);
} catch (FaultException e) {
System.out.println("There is a transient problem, retry the " +
"operation: " + e);
}
// Wait for the operation to finish
StatementResult result = future.get()
If the statement is a data definition or administrative operation, and the store is currently executing an operation that is the logical equivalent of the action specified by the statement, the method will return an ExecutionFuture that serves as a handle to that operation, rather than starting a new invocation of the command. The caller can use the ExecutionFuture to await the completion of the operation.
// process A starts an index creation
ExecutionFuture futureA =
tableAPI.execute("CREATE INDEX age ON users(age)");
// process B starts the same index creation. If the index creation is
// still running in the cluster, futureA and futureB will refer to
// the same operation
ExecutionFuture futureB =
tableAPI.execute("CREATE INDEX age ON users(age)");
Note that, in a secure store, creating and modifying table and index
definitions may require a level of system privileges over and beyond
that required for reads and writes of table records.
See the Data Definition Language for Tables guide in the documentation
for information about supported statements.
statement - must follow valid Table syntax.java.lang.IllegalArgumentException - if the statement is not validKVSecurityException - if the operation fails due to a failure in
authorization or authentication.FaultException - if the statement cannot be completed. This
indicates a transient problem with communication to the server or
within the server, and the statement can be retried.@Deprecated StatementResult executeSync(java.lang.String statement)
KVStore.executeSync(java.lang.String)execute(String), but offers synchronous behavior as a convenience.
ExecuteSync() is the equivalent of:
ExecutionFuture future = tableAPI.execute( ... ); return future.get();When executeSync() returns, statement execution will have terminated, and the resulting
StatementResult will provide information
about the outcome.statement - must follow valid Table syntax.java.lang.IllegalArgumentException - if the statement is not validexecute(String),
Read exceptions,
Write exceptionsTable getTable(java.lang.String fullNamespaceName)
This interface will only retrieve top-level tables -- those with no
parent table. Child tables are retrieved using
Table.getChildTable(java.lang.String).
fullNamespaceName - the full name or namespace qualified name of
the target table. If an unqualified name is used then the
"sysdefault" namespace will be used. If fullNamespaceName specifies a
namespace followed by a colon before specifying the full name, then
that is equivalent to calling
getTable(String, String) with the namespace and full
name.Table getTable(java.lang.String namespace, java.lang.String tableFullName)
This interface will only retrieve top-level tables -- those with no
parent table. Child tables are retrieved using
Table.getChildTable(java.lang.String).
namespace - the namespace of the target table. If null, the
"sysdefault"
SYSDEFAULT_NAMESPACE_NAME namespace
will be used and the result is the same as calling the single
argument method.tableFullName - the full name of the target tablejava.util.Map<java.lang.String,Table> getTables()
Table.getChildTables().java.util.Map<java.lang.String,Table> getTables(java.lang.String namespace)
Table.getChildTables().namespace - the namespace to use. If null, the initial
SYSDEFAULT_NAMESPACE_NAME
namespace will be used and the result is the same as calling the method
without parameters.java.util.Set<java.lang.String> listNamespaces()
throws FaultException
SYSDEFAULT_NAMESPACE_NAME.FaultExceptionRow get(PrimaryKey key, ReadOptions readOptions)
Row associated with the primary key.key - the primary key for a table. It must be a complete primary
key, with all fields set.readOptions - non-default options for the operation or null
to get default behaviornull if not foundjava.lang.IllegalArgumentException - if the primary key is not completejava.util.List<Row> multiGet(PrimaryKey key, MultiRowOptions getOptions, ReadOptions readOptions)
key - the primary key for the operation. It may be partial or
complete.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.readOptions - non-default options for the operation or null
to get default behaviorjava.lang.IllegalArgumentException - if the primary key is malformed or
does not contain the required fieldsjava.util.List<PrimaryKey> multiGetKeys(PrimaryKey key, MultiRowOptions getOptions, ReadOptions readOptions)
key - the primary key for the operation. It may be partial or
complete.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.readOptions - non-default options for the operation or null
to get default behaviorjava.lang.IllegalArgumentException - if the primary key is malformed or
does not contain the required fieldsTableIterator<Row> tableIterator(PrimaryKey key, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
key - the primary key for the operation. It may be partial or
complete shard key. If the key contains a partial shard key the
iteration goes to all partitions in the store. If the key contains a
complete shard key the operation is restricted to the target partition.
If the key has no fields set the entire table is matched.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.iterateOptions - the non-default arguments for consistency of the
operation and to control the iteration or null to get default
behavior. If the primary key contains a complete shard key, the default
Direction in TableIteratorOptions is Direction.FORWARD. Otherwise, the default Direction in
TableIteratorOptions is Direction.UNORDERED.ParallelScanIterator, such as
statistics, will not return meaningful information because the iteration
will be single-partition and not parallel.java.lang.IllegalArgumentException - if the primary key is malformed or an
invalid option is specified, such as iteration order without a complete
shard key.TableIterator<PrimaryKey> tableKeysIterator(PrimaryKey key, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
key - the primary key for the operation. It may be partial or
complete shard key. If the key contains a partial shard key the
iteration goes to all partitions in the store. If the key contains a
complete shard key the operation is restricted to the target partition.
If the key has no fields set the entire table is matched.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.iterateOptions - the non-default arguments for consistency of the
operation and to control the iteration or null to get default
behavior. If the primary key contains a complete shard key, the default
Direction in TableIteratorOptions is Direction.FORWARD. Otherwise, the default Direction in
TableIteratorOptions is Direction.UNORDERED.ParallelScanIterator, such as statistics, will not return meaningful
information because the iteration will be single-partition and not
parallel.java.lang.IllegalArgumentException - if the primary key is malformed or an
invalid option is specified, such as iteration order without a complete
shard keyTableIterator<Row> tableIterator(IndexKey key, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
getOptions parameter. Index operations may not specify the
return of child table rows.key - the index key for the operation. It may be partial or
complete. If the key has no fields set the entire index is matched.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table on which
the index is defined is always included as a target. Child tables
cannot be included for index operations.iterateOptions - the non-default arguments for consistency of the
operation and to control the iteration or null to get default
behavior. The default Direction in TableIteratorOptions is
Direction.FORWARD.java.lang.IllegalArgumentException - if the primary key is malformedjava.lang.UnsupportedOperationException - if the getOptions
parameter specifies the return of child tablesTableIterator<KeyPair> tableKeysIterator(IndexKey key, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
getOptions parameter. Index operations may not specify the
return of child table keys.key - the index key for the operation. It may be partial or
complete. If the key has no fields set the entire index is matched.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table on which
the index is defined is always included as a target. Child tables
cannot be included for index operations.iterateOptions - the non-default arguments for consistency of the
operation and to control the iteration or null to get default
behavior. The default Direction in TableIteratorOptions is
Direction.FORWARD.KeyPair objects, which provide access
to both the PrimaryKey associated with a match as well as the
values in the matching IndexKey without an additional fetch of
the Row itself.java.lang.IllegalArgumentException - if the primary key is malformedjava.lang.UnsupportedOperationException - if the getOptions
parameter specifies the return of child tablesTableIterator<Row> tableIterator(java.util.Iterator<PrimaryKey> primaryKeyIterator, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
The result is not transactional and the operation effectively provides read-committed isolation. The implementation batches the fetching of rows in the iterator, to minimize the number of network round trips, while not monopolizing the available bandwidth. Batches are fetched in parallel across multiple Replication Nodes, the degree of parallelism is controlled by the TableIteratorOptions argument.
primaryKeyIterator - it yields a sequence of primary keys, the
primary key may be partial or complete, it must contain all of the
fields defined for the table's shard key. The iterator implementation
need not be thread-safe.getOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the results. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.iterateOptions - the non-default arguments for consistency of the
operation and to control the iteration or null to get default
behavior. Currently, the Direction in TableIteratorOptions can
only be Direction.UNORDERED, others are not supported.
primaryKeyIterator yields duplicate keys, the row associated with the
duplicate keys will be returned at least once and potentially multiple
times. The implementation makes an effort to minimize these duplicate
values but the exact number of repeated rows is not defined by the
implementation, since weeding out such duplicates can be resource
intensive.java.lang.IllegalArgumentException - if the supplied key iterator is
null or invalid option is specified, such as unsupported iteration
orderTableIterator<PrimaryKey> tableKeysIterator(java.util.Iterator<PrimaryKey> primaryKeyIterator, MultiRowOptions getOptions, TableIteratorOptions iterateOptions) throws ConsistencyException, RequestTimeoutException, KVSecurityException, FaultException
This method is almost identical to tableIterator(Iterator,
MultiRowOptions, TableIteratorOptions) but differs solely in the type
of its return value (PrimaryKeys instead of rows).
TableIterator<Row> tableIterator(java.util.List<java.util.Iterator<PrimaryKey>> primaryKeyIterators, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
Except for the difference in the type of the first argument:
primaryKeyIterators, which is a list of iterators instead of a single
iterator, this method is identical to the overloaded tableIterator(Iterator, MultiRowOptions, TableIteratorOptions) method.
One or more of the iterators in the primaryKeyIterators list may
be read in parallel to maximize input throughput, the element of key
iterator list should be non-null.
tableIterator(Iterator, MultiRowOptions, TableIteratorOptions)TableIterator<PrimaryKey> tableKeysIterator(java.util.List<java.util.Iterator<PrimaryKey>> primaryKeyIterators, MultiRowOptions getOptions, TableIteratorOptions iterateOptions)
Except for the difference in the type of the first argument:
primaryKeyIterators, which is a list of iterators instead of a single
iterator, this method is identical to the overloaded tableKeysIterator(Iterator, MultiRowOptions, TableIteratorOptions)
method. One or more of the iterators in the primaryKeyIterators
list may be read in parallel to maximize input throughput, the element
of key iterator list should be non-null.
tableKeysIterator(Iterator, MultiRowOptions, TableIteratorOptions)Version put(Row row, ReturnRow prevRow, WriteOptions writeOptions)
row - the row to putprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that they should not be returned, the
version in this object is set to null and none of the row's
fields are available.
If a non-null ReturnRow is specified and a previous
row exists, then the expiration time of the previous row can be accessed
by calling getExpirationTime() on
prevRow.
writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behavior. See
WriteOptions for more information.java.lang.IllegalArgumentException - if the row does not have a complete
primary key or is otherwise invalidVersion putIfAbsent(Row row, ReturnRow prevRow, WriteOptions writeOptions)
row - the row to putprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that nothing should be returned, the version
in this object is set to null and none of the row's fields are
available. This object will only be initialized if the operation fails
because of an existing row.
If a non-null ReturnRow is specified and a previous
row exists, then the expiration time of the previous row can be accessed
by calling getExpirationTime() on
prevRow.
writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviornull if an existing
value is present and the put is unsuccessfuljava.lang.IllegalArgumentException - if the row does not have a complete
primary key or is otherwise invalidVersion putIfPresent(Row row, ReturnRow prevRow, WriteOptions writeOptions)
row - the row to putprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that nothing should be returned, the version
in this object is set to null and none of the row's fields are
available.
If a non-null ReturnRow is specified and a previous
row exists, then the expiration time of the previous row can be accessed
by calling getExpirationTime() on
prevRow.
writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviornull if there is no
existing row and the put is unsuccessfuljava.lang.IllegalArgumentException - if the Row does not have
a complete primary key or is otherwise invalidVersion putIfVersion(Row row, Version matchVersion, ReturnRow prevRow, WriteOptions writeOptions)
row - the row to putmatchVersion - the version to matchprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that nothing should be returned, the version
in this object is set to null and none of the row's fields are
available. This object will only be initialized if the operation fails
with a version mismatch.
If a non-null ReturnRow is specified and a previous row
exists, then the expiration time of the previous row can be accessed by
calling getExpirationTime() on
prevRow.writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviornull if the versions do
not match and the put is unsuccessfuljava.lang.IllegalArgumentException - if the Row does not have
a complete primary key or is otherwise invalidboolean delete(PrimaryKey key, ReturnRow prevRow, WriteOptions writeOptions)
key - the primary key for the row to deleteprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that they should not be returned, the
version in this object is set to null and none of the row's
fields are available.writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviortrue if the row existed and was deleted, and
false otherwisejava.lang.IllegalArgumentException - if the primary key is not completeboolean deleteIfVersion(PrimaryKey key, Version matchVersion, ReturnRow prevRow, WriteOptions writeOptions)
key - the primary key for the row to deletematchVersion - the version to matchprevRow - a ReturnRow object to contain the previous row
value and version associated with the given row, or null if they
should not be returned. If a previous row does not exist, or the ReturnRow.Choice specifies that they should not be returned, or the
matchVersion parameter matches the existing value and the delete is
successful, the version in this object is set to null and none
of the row's fields are available.writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviortrue if the row existed, and its version matched
matchVersion and was successfully deleted, and false otherwisejava.lang.IllegalArgumentException - if the primary key is not completeint multiDelete(PrimaryKey key, MultiRowOptions getOptions, WriteOptions writeOptions)
key - the primary key for the row to deletegetOptions - a MultiRowOptions object used to control
ranges in the operation and whether ancestor and descendant tables are
included in the operation. It may be null. The table used to
construct the PrimaryKey parameter is always included as a
target.writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviorjava.lang.IllegalArgumentException - if the primary key is malformed or does
not contain all shard key fieldsTableOperationFactory getTableOperationFactory()
TableOperationFactory to create operations passed
to execute(java.lang.String). Not all operations must use the same table but
they must all use the same shard portion of the primary key.TableOperationFactoryjava.util.List<TableOperationResult> execute(java.util.List<TableOperation> operations, WriteOptions writeOptions) throws TableOpExecutionException
The operations passed to this method are created using an TableOperationFactory, which is obtained from the getTableOperationFactory() method.
All the operations specified are executed within the scope of a
single transaction that effectively provides serializable isolation.
The transaction is started and either committed or aborted by this
method. If the method returns without throwing an exception, then all
operations were executed atomically, the transaction was committed, and
the returned list contains the result of each operation.
If the transaction is aborted for any reason, an exception is thrown. An abort may occur for two reasons:
FaultException is thrown.true was passed for the
abortIfUnsuccessful parameter when the operation was created using
the TableOperationFactory.
A TableOpExecutionException
is thrown, and the exception contains information about the failed
operation.
Operations are not executed in the sequence they appear the
operations list, but are rather executed in an internally defined
sequence that prevents deadlocks. Additionally, if there are two
operations for the same key, their relative order of execution is
arbitrary; this should be avoided.
operations - the list of operations to be performed. Note that all
operations in the list must specify primary keys with the same
complete shard key.writeOptions - non-default arguments controlling the durability of
the operation, or null to get default behaviorTableOpExecutionException - if an operation is not successful as
defined by the particular operation (e.g., a delete operation for a
non-existent key) and true was passed for the
abortIfUnsuccessful parameter when the operation was created using the
TableOperationFactoryjava.lang.IllegalArgumentException - if operations is null or empty,
or not all operations operate on primary keys with the same shard key,
or more than one operation has the same primary key, or any of the
primary keys are incompletevoid put(java.util.List<EntryStream<Row>> streams, BulkWriteOptions bulkWriteOptions)
Entries are supplied to the loader by a list of EntryStream instances.
Each stream is read sequentially, that is, each EntryStream.getNext() is
allowed to finish before the next operation is issued. The load
operation typically reads from these streams in parallel as determined
by BulkWriteOptions.getStreamParallelism().
If an entry is associated with a primary key that's already present in
the store, the EntryStream.keyExists(E) method is invoked on it and
the entry is not loaded into the store by this method; the
EntryStream.keyExists(E) method may of course choose to do so
itself, if the values differ.
If the key is absent, a new entry is created in the store, that is, the load operation has putIfAbsent semantics. The putIfAbsent semantics permit restarting a load of a stream that failed for some reason.
The collection of streams defines a partial insertion order, with insertion of rows containing the same shard key within a stream being strictly ordered, but with no ordering constraints being imposed on keys across streams, or for different keys within the same stream.
The behavior of the bulk put operation with respect to duplicate entries
contained in different streams is thus undefined. If the duplicate
entries are just present in a single stream, then the first entry will
be inserted (if it's not already present) and the second entry and
subsequent entries will result in the invocation of the
EntryStream.keyExists(E) method. If duplicates exist across
streams, then the first entry to win the race is inserted and subsequent
duplicates will result in EntryStream.keyExists(E) being invoked on
them.
Load operations tend to be long running. In order to facilitate
resumption of such a long running operation due to a process or client
machine failure, the application may use to checkpoint its progress at
granularity of a stream, using the
EntryStream.completed() method. The javadoc for this
method provides further details.
Exceptions encountered during the reading of streams result in the put operation being terminated and the first such exception being thrown from the put method.
Exceptions encountered when inserting a row into the store result in the
EntryStream.catchException(java.lang.RuntimeException, E) being invoked.
streams - the streams that supply the rows to be inserted. The rows
within each stream may be associated with different tables. Elements
of stream list must not be null.bulkWriteOptions - non-default arguments controlling the behavior
the bulk write operationsCopyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.