-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/os/5.1' into saurabh/sync-syntax
# Conflicts: # gradle.properties
- Loading branch information
Showing
14 changed files
with
345 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
data/avro-schema/src/main/resources/avro/net/corda/data/scheduler/ScheduledTaskTrigger.avsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"type": "record", | ||
"name": "ScheduledTaskTrigger", | ||
"namespace": "net.corda.data.scheduler", | ||
"fields": [ | ||
{ | ||
"name": "name", | ||
"type": "string", | ||
"doc": "Name of the scheduled task." | ||
}, | ||
{ | ||
"name": "timestamp", | ||
"type": { | ||
"type": "long", | ||
"logicalType": "timestamp-millis" | ||
}, | ||
"doc": "Timestamp for the trigger." | ||
} | ||
] | ||
} |
73 changes: 73 additions & 0 deletions
73
...src/test/kotlin/net/corda/data/flow/state/checkpoint/CheckpointSchemaCompatibilityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package net.corda.data.flow.state.checkpoint | ||
|
||
import net.corda.data.KeyValuePairList | ||
import org.apache.avro.Schema | ||
import org.apache.avro.SchemaCompatibility | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
|
||
class CheckpointSchemaCompatibilityTest { | ||
|
||
@Test | ||
fun `Flow checkpoint schema changes between Corda 5_0 and 5_1 are compatible`() { | ||
val oldSchemaJson = """ | ||
{ | ||
"type": "record", | ||
"name": "Checkpoint", | ||
"namespace": "net.corda.data.flow.state.checkpoint", | ||
"doc": "Represents the current state of a flow, plus information required to operate the flow engine.", | ||
"fields": [ | ||
{ | ||
"name": "flowId", | ||
"type": "string", | ||
"doc": "Internal, globally unique key for a flow instance." | ||
}, | ||
{ | ||
"name": "initialPlatformVersion", | ||
"type": "int", | ||
"doc": "The platform version at the time the flow was started." | ||
}, | ||
{ | ||
"name": "pipelineState", | ||
"type": "net.corda.data.flow.state.checkpoint.PipelineState", | ||
"doc": "State required by the pipeline, e.g. to support retries." | ||
}, | ||
{ | ||
"name": "flowState", | ||
"type": [ | ||
"null", | ||
"net.corda.data.flow.state.checkpoint.FlowState" | ||
], | ||
"doc": "Current flow execution state. Null if the flow has not yet been started, for example in the face of a retry-able error." | ||
}, | ||
{ | ||
"name": "flowMetricsState", | ||
"type": "string", | ||
"default": "{}", | ||
"doc": "Internal storage for recording flow metrics" | ||
} | ||
] | ||
} | ||
""".trimIndent() | ||
|
||
val oldSchema = Schema.Parser() | ||
.addTypes( | ||
mapOf( | ||
PipelineState::class.java.name to PipelineState.`SCHEMA$`, | ||
FlowState::class.java.name to FlowState.`SCHEMA$`, | ||
KeyValuePairList::class.java.name to KeyValuePairList.`SCHEMA$` | ||
) | ||
) | ||
.parse(oldSchemaJson) | ||
|
||
val newSchema = Checkpoint.`SCHEMA$` | ||
|
||
val compatibility = SchemaCompatibility.checkReaderWriterCompatibility(newSchema, oldSchema) | ||
|
||
Assertions.assertEquals( | ||
compatibility.type, | ||
SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, | ||
"Failed due to incompatible change. ${compatibility.description}" | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...n/resources/net/corda/schema/configuration/messaging/1.0/state-manager-db-properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2019-09/schema", | ||
"$id": "https://corda.r3.com/net/corda/schema/configuration/db/1.0/corda.db.json", | ||
"title": "State Manager Database Configuration Schema", | ||
"description": "Configuration schema for the database section. Note that this configuration cannot be updated dynamically through the REST endpoint.", | ||
"type": "object", | ||
"properties": { | ||
"database": { | ||
"description": "Database settings.", | ||
"type": "object", | ||
"default": {}, | ||
"properties": { | ||
"user": { | ||
"description": "The database user.", | ||
"type": "string" | ||
}, | ||
"pass": { | ||
"description": "The database password.", | ||
"type": "string" | ||
}, | ||
"jdbc": { | ||
"description": "JDBC settings.", | ||
"type": "object", | ||
"default": {}, | ||
"properties": { | ||
"driver": { | ||
"description": "The JDBC driver.", | ||
"type": "string", | ||
"default": "org.postgresql.Driver" | ||
}, | ||
"directory": { | ||
"description": "The directory that contains the JDBC drivers.", | ||
"type": "string", | ||
"default": "/opt/jdbc-driver" | ||
}, | ||
"url": { | ||
"description": "The JDBC URL.", | ||
"type": "string", | ||
"default": "jdbc:postgresql://state-manager-db:5432/state_manager" | ||
}, | ||
"persistenceUnitName": { | ||
"description": "The persistent unit name.", | ||
"type": "string", | ||
"default": "corda-state-manager" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"pool": { | ||
"description": "Database pool settings.", | ||
"type": "object", | ||
"default": {}, | ||
"properties": { | ||
"max_size": { | ||
"description": "The maximum database pool size.", | ||
"type": "integer", | ||
"minimum": 1, | ||
"default": 10 | ||
}, | ||
"min_size": { | ||
"description": "The minimum database pool size. If left null will default to the `max_size` value.", | ||
"default": null, | ||
"anyOf": [ | ||
{ | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
{ | ||
"type": "null" | ||
} | ||
] | ||
}, | ||
"idleTimeoutSeconds": { | ||
"description": "The maximum time (in seconds) a connection can stay idle in the pool. A value of 0 means that idle connections are never removed from the pool.", | ||
"type": "integer", | ||
"minimum": 0, | ||
"default": 120 | ||
}, | ||
"maxLifetimeSeconds": { | ||
"description": "The maximum time (in seconds) a connection can stay in the pool, regardless if it has been idle or has been recently used. If a connection is in-use and has reached \"maxLifetime\" timeout, it will be removed from the pool only when it becomes idle.", | ||
"type": "integer", | ||
"minimum": 1, | ||
"default": 1800 | ||
}, | ||
"keepAliveTimeSeconds": { | ||
"description": "The interval time (in seconds) in which connections will be tested for aliveness. Connections which are no longer alive are removed from the pool. A value of 0 means this check is disabled.", | ||
"type": "integer", | ||
"minimum": 0, | ||
"default": 0 | ||
}, | ||
"validationTimeoutSeconds": { | ||
"description": "The maximum time (in seconds) that the pool will wait for a connection to be validated as alive.", | ||
"type": "integer", | ||
"minimum": 1, | ||
"default": 5 | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"default": {} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...chema/src/main/resources/net/corda/db/schema/config/migration/scheduler-creation-v5.1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"> | ||
|
||
<property name="now" value="now()" dbms="hsqldb"/> | ||
<property name="now" value="now()" dbms="postgresql"/> | ||
|
||
<changeSet author="R3.Corda" id="scheduler-creation-v5.1"> | ||
|
||
<createTable tableName="task_scheduler_log"> | ||
<column name="task_name" type="VARCHAR(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="last_scheduled" type="TIMESTAMP WITH TIME ZONE" defaultValueDate="${now}"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="scheduler_id" type="VARCHAR(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</createTable> | ||
|
||
<addPrimaryKey columnNames="task_name" constraintName="task_scheduler_log_task_name_pk" tableName="task_scheduler_log"/> | ||
</changeSet> | ||
</databaseChangeLog> |
6 changes: 6 additions & 0 deletions
6
data/db-schema/src/main/resources/net/corda/db/schema/statemanager/db.changelog-master.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> | ||
<include file="net/corda/db/schema/statemanager/migration/state-manager-migration-v5.1.xml"/> | ||
</databaseChangeLog> |
35 changes: 35 additions & 0 deletions
35
...ain/resources/net/corda/db/schema/statemanager/migration/state-manager-migration-v5.1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> | ||
|
||
<property name="now" value="now()" dbms="postgresql"/> | ||
<property name="json.column.type" value="JSONB" dbms="postgresql"/> | ||
<property name="state.column.type" value="bytea" dbms="postgresql"/> | ||
|
||
<!-- Please note that HSQLDB schema is supported for integration test purposes only. --> | ||
<property name="now" value="now()" dbms="hsqldb"/> | ||
<property name="json.column.type" value="CLOB" dbms="hsqldb"/> | ||
<property name="state.column.type" value="binary" dbms="hsqldb"/> | ||
|
||
<changeSet author="R3.Corda" id="state-manager-migration-v5.1"> | ||
<createTable tableName="state"> | ||
<column name="key" type="varchar(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="value" type="${state.column.type}"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="version" type="INT"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="metadata" type="${json.column.type}"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="modified_time" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</createTable> | ||
<addPrimaryKey columnNames="key" constraintName="state_key" tableName="state"/> | ||
</changeSet> | ||
</databaseChangeLog> |
Oops, something went wrong.