Class WritableReplayDatabase
- All Implemented Interfaces:
Database
,DatabaseInternal
,WritableDatabase
ReplayDatabase
that also wraps a WritableDatabase
.
No changes are made to the WritableDatabase operations, they are simply delegated to the underlying WritableDatabase.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.deephaven.enterprise.replay.ReplayDatabase
ReplayDatabase.ReplayException
-
Field Summary
Fields inherited from interface io.deephaven.enterprise.database.Database
PARTITIONED_TABLE_INTERNAL_PARTITION_COLUMN
-
Constructor Summary
ConstructorsConstructorDescriptionWritableReplayDatabase
(@NotNull Clock replayClock, @NotNull WritableDatabase wrappedWritable, @NotNull Database wrapped, @NotNull io.deephaven.shadow.enterprise.com.illumon.iris.db.tables.databases.ReplaySettings replaySettings, @NotNull ReplayConfigurationImpl replayConfiguration) Create a new WritableReplayDatabase that wraps an underlying database. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addInputTableSchema
(@NotNull String namespace, @NotNull String tableName, @NotNull TableDefinition prototype, @NotNull String... keyColNames) Add a new input table schema using theTableDefinition
and specified key column names.boolean
addInputTableSchema
(@NotNull String namespace, @NotNull String tableName, @NotNull InputTableSpec inputTableSpec) Add a new input table schema using theInputTableSpec
.boolean
addPartitionedTableSchema
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnName, @NotNull TableDefinition prototype) Adds a schema for a partitioned user table.void
addTablePartition
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnValue, @NotNull Table table) Adds a single column partition of data to a partitioned user table.void
addUnpartitionedTable
(@NotNull String namespace, @NotNull String tableName, @NotNull Table table) Adds an unpartitioned user table.void
appendLiveTable
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnValue, @NotNull Table table) Appends all rows from a given table to a live user table partition.appendLiveTableIncremental
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnValue, @NotNull Table table) Appends all rows from a given table to a live user table partition.boolean
deleteInputTable
(@NotNull String namespace, @NotNull String tableName) Delete the input table given the namespace and table name.boolean
deleteLiveTablePartition
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnValue) Delete a partition from a live user table.boolean
deletePartitionedTable
(@NotNull String namespace, @NotNull String tableName) Delete all partitions, whether direct or live, and the schema, from a partitioned user table.boolean
deleteTablePartition
(@NotNull String namespace, @NotNull String tableName, @NotNull String partitionColumnValue) Deletes a single column partition of data from a partitioned user table.boolean
deleteUnpartitionedTable
(@NotNull String namespace, @NotNull String tableName) Deletes an unpartitioned user table and the schema.inputTable
(@NotNull String namespace, @NotNull String tableName) Retrieve the specified input table view.inputTableSpecFor
(@NotNull String namespace, @NotNull String tableName) Retrieve the current InputTableSpec for the given namespace and table.inputTableUpdater
(@NotNull String namespace, @NotNull String tableName) Retrieve the specifiedInputTableUpdater
, which can be used to programmatically add or delete rows.boolean
isInputTable
(@NotNull String namespace, @NotNull String tableName) Determines whether a table is a Core+ input table.boolean
updateInputTableSchema
(@NotNull String namespace, @NotNull String tableName, InputTableSpec inputTableSpec) Update an existing input table schema using the providedInputTableSpec
.boolean
updatePartitionedTableSchema
(@NotNull String namespace, @NotNull String tableName, @NotNull TableDefinition prototype) Updates a preexisting User table schema.Methods inherited from class io.deephaven.enterprise.replay.ReplayDatabase
clearLocationCache, clearLocationCache, getCatalogTable, getNamespaces, getTableDefinition, getTableDefinitionTable, getTableNames, historicalPartitionedTable, historicalTable, livePartitionedTable, liveTable, useLocationCaches
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.enterprise.database.Database
clearLocationCache, clearLocationCache, getCatalogTable, getNamespaces, getTableDefinition, getTableDefinitionTable, getTableNames, historicalPartitionedTable, historicalPartitionedTable, historicalTable, historicalTable, livePartitionedTable, livePartitionedTable, liveTable, liveTable, useLocationCaches
-
Constructor Details
-
WritableReplayDatabase
public WritableReplayDatabase(@NotNull @NotNull Clock replayClock, @NotNull @NotNull WritableDatabase wrappedWritable, @NotNull @NotNull Database wrapped, @NotNull @NotNull io.deephaven.shadow.enterprise.com.illumon.iris.db.tables.databases.ReplaySettings replaySettings, @NotNull @NotNull ReplayConfigurationImpl replayConfiguration) Create a new WritableReplayDatabase that wraps an underlying database.- Parameters:
replayClock
- the clock for replaying datawrappedWritable
- the WritableDatabase to wrap, very likely the same as wrappedwrapped
- the Database to wrap, very likely the same as wrappedWritablereplaySettings
- the replay settings from the persistent queryreplayConfiguration
- the per-table replay configuration
-
-
Method Details
-
addUnpartitionedTable
public void addUnpartitionedTable(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull Table table) Description copied from interface:WritableDatabase
Adds an unpartitioned user table.
Writes an unpartitioned user table to disk. If the namespace does not exist, then it is created. The schema must not already exist.
If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
addUnpartitionedTable
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table nametable
- table that the definition and data will be based on
-
deleteUnpartitionedTable
public boolean deleteUnpartitionedTable(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName) Description copied from interface:WritableDatabase
Deletes an unpartitioned user table and the schema.If the schema does not exist, then data is not deleted. If there is no data but the schema exists, then the schema is deleted.
The namespace is not removed even if this is the last table in the namespace.
If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
deleteUnpartitionedTable
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table name- Returns:
- true if the data was deleted, false if there was no data or preexisting schema
-
addPartitionedTableSchema
public boolean addPartitionedTableSchema(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnName, @NotNull @NotNull TableDefinition prototype) Description copied from interface:WritableDatabase
Adds a schema for a partitioned user table.The schema is derived from the prototype
TableDefinition
and the partitionColumnName parameter. The prototype definition must not include a partitioning column.If the namespace does not exist, then it is created.
If the schema already exists and it is identical (this is a stricter check than compatibility; all columns must be present in the same order with the same properties), then the method returns false. If the schema already exists and is not identical, then an error is thrown.
- Specified by:
addPartitionedTableSchema
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnName
- name of the partitioning columnprototype
- table definition to derive schema from- Returns:
- true if the partitioned table schema was added, false if it already existed
-
updatePartitionedTableSchema
public boolean updatePartitionedTableSchema(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull TableDefinition prototype) Description copied from interface:WritableDatabase
Updates a preexisting User table schema.If the schema does not exist an error is thrown. Not all schema modifications are permitted. The partitioning column may not be changed. Existing columns may not have their type changed. Columns may be added or deleted.
Note that no data is modified by this operation. Removed columns remain on persistent storage, and added columns are treated as null on read.
Although each modification in isolation is verified for safety, a sequence of modifications to the schema may be unsafe. For example, deleting a column and adding it back with a new type results in unreadable data.
- Specified by:
updatePartitionedTableSchema
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table nameprototype
- table definition to derive schema from- Returns:
- true if the partitioned table schema was updated, false if there was already an identical definition
-
addTablePartition
public void addTablePartition(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnValue, @NotNull @NotNull Table table) Description copied from interface:WritableDatabase
Adds a single column partition of data to a partitioned user table.The data table must have a
mutually compatible definition
with the current schema. The data table must not have a column with the same name as the partitioning column.If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
addTablePartition
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnValue
- value for the partitioning column, e.g. "2015-09-25" for "Date"table
- table to write data from
-
deleteTablePartition
public boolean deleteTablePartition(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnValue) Description copied from interface:WritableDatabase
Deletes a single column partition of data from a partitioned user table.If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
deleteTablePartition
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnValue
- value for the partitioning column, e.g. "2015-09-25" for "Date"- Returns:
- true if the partition was deleted, false if there was no partition or preexisting schema
-
appendLiveTable
public void appendLiveTable(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnValue, @NotNull @NotNull Table table) Description copied from interface:WritableDatabase
Appends all rows from a given table to a live user table partition.The data table must have a
mutually compatible definition
with the current schema. The data table must not have a column with the same name as the partitioning column.The specified column partition may already exist, or may be created by the system.
This method is asynchronous. After returning, the data may not be immediately available. It is possible for the write to fail after this method has returned. When multiple workers append to a partition, ordering is imposed outside the worker by other system components.
If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
appendLiveTable
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnValue
- value for the partitioning column, e.g. "2015-09-25" for "Date"table
- table to append rows from
-
appendLiveTableIncremental
public SafeCloseable appendLiveTableIncremental(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnValue, @NotNull @NotNull Table table) Description copied from interface:WritableDatabase
Appends all rows from a given table to a live user table partition. When rows are added to the table, they are additionally appended to the table.The input table updates can only have additions and shifts. No modifications or removals are permitted.
The data table must have a
mutually compatible definition
with the current schema. The data table must not have a column with the same name as the partitioning column.The specified column partition may already exist, or may be created by the system.
This method is asynchronous, after returning the data may not be immediately available. It is possible for the write to fail after this method has returned. When multiple workers append to a partition, ordering is imposed outside the worker by other system components.
A reference must be maintained to the returned
SafeCloseable
to ensure expected functionality; callingSafeCloseable.close()
will stop incremental appends, and clean up related resources.If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
appendLiveTableIncremental
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnValue
- value for the partitioning column, e.g. "2015-09-25" for "Date"table
- table to append updates from- Returns:
- the
Closeable
reference used to ensure and stop expected functionality
-
deleteLiveTablePartition
public boolean deleteLiveTablePartition(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull String partitionColumnValue) Description copied from interface:WritableDatabase
Delete a partition from a live user table.If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
deleteLiveTablePartition
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table namepartitionColumnValue
- value for the partitioning column, e.g. "2015-09-25" for "Date"- Returns:
- true if the partition was deleted, false if there was no partition or preexisting schema
-
deletePartitionedTable
public boolean deletePartitionedTable(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName) Description copied from interface:WritableDatabase
Delete all partitions, whether direct or live, and the schema, from a partitioned user table.All partitions from the table are deleted sequentially. If a partition cannot be deleted, then the operation fails but some data may have already been removed. After all partitions are deleted, then the schema is deleted. If the schema does not exist, then data is not deleted. If there is no data, but the schema exists, then the schema is deleted.
The namespace is not removed, even if this is the last table in the namespace.
If a
UserTableIOException
is thrown, the state of the table is undefined.- Specified by:
deletePartitionedTable
in interfaceWritableDatabase
- Parameters:
namespace
- table namespacetableName
- table name- Returns:
- true if data was deleted, false if there was no data or preexisting schema
-
addInputTableSchema
public boolean addInputTableSchema(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull InputTableSpec inputTableSpec) Description copied from interface:WritableDatabase
Add a new input table schema using theInputTableSpec
.- Specified by:
addInputTableSchema
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input tableinputTableSpec
- the input table specification- Returns:
- true if the input table schema was added, false if the input table already exists with the same spec
-
addInputTableSchema
public boolean addInputTableSchema(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, @NotNull @NotNull TableDefinition prototype, @NotNull @NotNull String... keyColNames) Description copied from interface:WritableDatabase
Add a new input table schema using theTableDefinition
and specified key column names.- Specified by:
addInputTableSchema
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input tableprototype
-TableDefinition
to derive the input table spec fromkeyColNames
- columns that should be keyed in the input table- Returns:
- true if the input table schema was added, false if the input table already exists with the same spec
-
updateInputTableSchema
public boolean updateInputTableSchema(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName, InputTableSpec inputTableSpec) Description copied from interface:WritableDatabase
Update an existing input table schema using the providedInputTableSpec
.Retrieve and use a new
InputTableUpdater
viaWritableDatabase.inputTableUpdater(String, String)
after updating an input table's specification to ensure proper behavior.- Specified by:
updateInputTableSchema
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input tableinputTableSpec
- the new specification for the input table- Returns:
- true if the input table schema was updated, false if the input table already exists with the same spec
-
deleteInputTable
public boolean deleteInputTable(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName) Description copied from interface:WritableDatabase
Delete the input table given the namespace and table name.- Specified by:
deleteInputTable
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input table- Returns:
- true if the input table was deleted, false if there was no data or preexisting schema for the input table
-
inputTableUpdater
public InputTableUpdater inputTableUpdater(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName) Description copied from interface:WritableDatabase
Retrieve the specifiedInputTableUpdater
, which can be used to programmatically add or delete rows.- Specified by:
inputTableUpdater
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace in which the table exists.tableName
- the name of the table in the namespace.- Returns:
- an
InputTableUpdater
for the specified input table.
-
inputTable
Description copied from interface:WritableDatabase
Retrieve the specified input table view.- Specified by:
inputTable
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace in which the table exists.tableName
- the name of the table in the namespace.- Returns:
- a table view for the specified input table.
-
inputTableSpecFor
public InputTableSpec inputTableSpecFor(@NotNull @NotNull String namespace, @NotNull @NotNull String tableName) Description copied from interface:WritableDatabase
Retrieve the current InputTableSpec for the given namespace and table.- Specified by:
inputTableSpecFor
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input table- Returns:
- the current input table specification for the given namespace and table
-
isInputTable
Description copied from interface:WritableDatabase
Determines whether a table is a Core+ input table.- Specified by:
isInputTable
in interfaceWritableDatabase
- Parameters:
namespace
- the namespace of the input tabletableName
- the name of the input table- Returns:
- true if the table is an input table, false if not
-
getUserContext
- Specified by:
getUserContext
in interfaceDatabaseInternal
-