Class ShardedSchemaAdapter
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
-
- org.linuxforhealth.fhir.schema.build.FhirSchemaAdapter
-
- org.linuxforhealth.fhir.schema.build.ShardedSchemaAdapter
-
- All Implemented Interfaces:
ISchemaAdapter
public class ShardedSchemaAdapter extends FhirSchemaAdapter
Adapter implementation used to build the distributed variant of the IBM FHIR Server RDBMS schema. This schema adds a distribution key column to every table identified as distributed. This column is also added to every index and FK relationship as needed. We use a smallint (2 bytes) which represents a signed integer holding values in the range [-32768, 32767]. This provides sufficient spread, assuming we won't be using a database with thousands of nodes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
shardColumnName
-
Fields inherited from class org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
databaseAdapter
-
-
Constructor Summary
Constructors Constructor Description ShardedSchemaAdapter(IDatabaseAdapter databaseAdapter, java.lang.String shardColumnName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createForeignKeyConstraint(java.lang.String constraintName, java.lang.String schemaName, java.lang.String name, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.util.List<java.lang.String> columns, boolean enforced, DistributionType distributionType, boolean targetIsReference)
void
createIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType)
Create an index on the named schema.table objectvoid
createTable(java.lang.String schemaName, java.lang.String name, java.util.List<ColumnBase> columns, PrimaryKeyDef primaryKey, IdentityDef identity, java.lang.String tablespaceName, java.util.List<With> withs, java.util.List<CheckConstraint> checkConstraints, DistributionType distributionType, java.lang.String distributionColumnName)
Build the create table DDLvoid
createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, java.util.List<java.lang.String> includeColumns, DistributionType distributionType, java.lang.String distributionColumnName)
Create a unique indexvoid
createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType, java.lang.String distributionColumnName)
Create a unique index-
Methods inherited from class org.linuxforhealth.fhir.database.utils.common.PlainSchemaAdapter
alterSequenceRestartWith, alterTableAddColumn, alterTableColumnIdentityCache, applyDistributionRules, checkCompatibility, createOrReplaceFunction, createOrReplaceProcedure, createOrReplaceView, createSchema, createSequence, createTablespace, createTablespace, createUniqueConstraint, createView, disableForeignKey, distributeFunction, doesForeignKeyConstraintExist, doesTableExist, dropForeignKey, dropFunction, dropIndex, dropProcedure, dropSequence, dropTable, dropTablespace, dropView, enableForeignKey, grantAllSequenceUsage, grantFunctionPrivileges, grantObjectPrivileges, grantProcedurePrivileges, grantSchemaUsage, grantSequencePrivileges, grantVariablePrivileges, listSchemaObjects, runStatement, setIntegrityOff, setIntegrityUnchecked
-
-
-
-
Constructor Detail
-
ShardedSchemaAdapter
public ShardedSchemaAdapter(IDatabaseAdapter databaseAdapter, java.lang.String shardColumnName)
- Parameters:
databaseAdapter
-
-
-
Method Detail
-
createTable
public void createTable(java.lang.String schemaName, java.lang.String name, java.util.List<ColumnBase> columns, PrimaryKeyDef primaryKey, IdentityDef identity, java.lang.String tablespaceName, java.util.List<With> withs, java.util.List<CheckConstraint> checkConstraints, DistributionType distributionType, java.lang.String distributionColumnName)
Description copied from interface:ISchemaAdapter
Build the create table DDL- Specified by:
createTable
in interfaceISchemaAdapter
- Overrides:
createTable
in classPlainSchemaAdapter
-
createUniqueIndex
public void createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, java.util.List<java.lang.String> includeColumns, DistributionType distributionType, java.lang.String distributionColumnName)
Description copied from interface:ISchemaAdapter
Create a unique index- Specified by:
createUniqueIndex
in interfaceISchemaAdapter
- Overrides:
createUniqueIndex
in classPlainSchemaAdapter
-
createUniqueIndex
public void createUniqueIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType, java.lang.String distributionColumnName)
Description copied from interface:ISchemaAdapter
Create a unique index- Specified by:
createUniqueIndex
in interfaceISchemaAdapter
- Overrides:
createUniqueIndex
in classPlainSchemaAdapter
-
createIndex
public void createIndex(java.lang.String schemaName, java.lang.String tableName, java.lang.String indexName, java.util.List<OrderedColumnDef> indexColumns, DistributionType distributionType)
Description copied from interface:ISchemaAdapter
Create an index on the named schema.table object- Specified by:
createIndex
in interfaceISchemaAdapter
- Overrides:
createIndex
in classPlainSchemaAdapter
-
createForeignKeyConstraint
public void createForeignKeyConstraint(java.lang.String constraintName, java.lang.String schemaName, java.lang.String name, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.util.List<java.lang.String> columns, boolean enforced, DistributionType distributionType, boolean targetIsReference)
- Specified by:
createForeignKeyConstraint
in interfaceISchemaAdapter
- Overrides:
createForeignKeyConstraint
in classPlainSchemaAdapter
distributionType
- distribution type of the source table
-
-