Skip to content

Commit 925efbd

Browse files
CORE-4415 CPI Info DB/Kafka reconciliation (#343) (#343)
*adds version field to `cpi` table (CPI metadata table). *adds `is_deleted flag` at `cpi` table for soft DB deletes. *adds missing CPK metadata. *adds reconciliation config schema. Co-authored-by: Kyriakos Tharrouniatis <[email protected]>
1 parent 331a99c commit 925efbd

File tree

6 files changed

+168
-6
lines changed

6 files changed

+168
-6
lines changed

data/config-schema/src/main/kotlin/net/corda/schema/configuration/ConfigKeys.kt

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ object ConfigKeys {
4747
// Scheduled reconciliation tasks
4848
const val RECONCILIATION_PERMISSION_SUMMARY_INTERVAL_MS = "permissionSummary.intervalMs"
4949
const val RECONCILIATION_CPK_WRITE_INTERVAL_MS = "cpkWrite.intervalMs"
50+
const val RECONCILIATION_CPI_INFO_INTERVAL_MS = "cpiInfo.intervalMs"
5051

5152
// Sandbox
5253
const val SANDBOX_CACHE_SIZE = "cache.size"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://corda.r3.com/net/corda/schema/configuration/reconciliation/1.0/corda.reconciliation.json",
4+
"title": "Corda Reconciliation Configuration Schema",
5+
"description": "Configuration schema for the reconciliation subsection.",
6+
"type": "object",
7+
"properties": {}
8+
}

data/config-schema/src/test/kotlin/net/corda/schema/configuration/provider/impl/SchemaProviderImplTest.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import net.corda.schema.configuration.ConfigKeys.MESSAGING_CONFIG
88
import net.corda.schema.configuration.ConfigKeys.P2P_CONFIG
99
import net.corda.schema.configuration.ConfigKeys.PLATFORM_CONFIG
1010
import net.corda.schema.configuration.ConfigKeys.POLICY_CONFIG
11+
import net.corda.schema.configuration.ConfigKeys.RECONCILIATION_CONFIG
1112
import net.corda.schema.configuration.ConfigKeys.RPC_CONFIG
1213
import net.corda.schema.configuration.ConfigKeys.SANDBOX_CONFIG
1314
import net.corda.schema.configuration.ConfigKeys.SECRETS_CONFIG
@@ -37,7 +38,8 @@ class SchemaProviderImplTest {
3738
POLICY_CONFIG,
3839
RPC_CONFIG,
3940
SECRETS_CONFIG,
40-
SANDBOX_CONFIG
41+
SANDBOX_CONFIG,
42+
RECONCILIATION_CONFIG
4143
)
4244
private val VERSIONS = listOf("1.0")
4345

data/db-schema/src/main/kotlin/net/corda/db/schema/DbSchema.kt

-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ object DbSchema {
2828

2929
const val DB_MESSAGE_BUS = "DB_MESSAGE_BUS"
3030

31-
// The values here are placeholders, until reasonable values are determined.
32-
const val CPI_REVISION_SEQUENCE = "r_db"
33-
const val CPI_REVISION_SEQUENCE_ALLOC_SIZE = 1
34-
3531
const val CRYPTO = "CRYPTO"
3632
const val CRYPTO_WRAPPING_KEY_TABLE = "crypto_wrapping_key"
3733
const val CRYPTO_SIGNING_KEY_TABLE = "crypto_signing_key"

data/db-schema/src/main/resources/net/corda/db/schema/config/migration/cpx-creation-v1.0.xml

+155
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
<column name="file_upload_request_id" type="VARCHAR(255)">
3737
<constraints nullable="true"/>
3838
</column>
39+
<column name="entity_version" type="INT">
40+
<constraints nullable="false"/>
41+
</column>
42+
<column name="is_deleted" type="BOOLEAN">
43+
<constraints nullable="false"/>
44+
</column>
3945
<column name="insert_ts" type="TIMESTAMP"
4046
defaultValueComputed="CURRENT_TIMESTAMP">
4147
<constraints nullable="false"/>
@@ -81,6 +87,28 @@
8187
<column name="cpk_file_checksum" type="VARCHAR(255)">
8288
<constraints nullable="false"/>
8389
</column>
90+
<column name="cpk_main_bundle_name" type="VARCHAR(255)">
91+
<constraints nullable="false"/>
92+
</column>
93+
<column name="cpk_main_bundle_version" type="VARCHAR(255)">
94+
<constraints nullable="false"/>
95+
</column>
96+
<column name="cpk_signer_summary_hash" type="VARCHAR(255)">
97+
<constraints nullable="false"/>
98+
</column>
99+
<column name="cpk_manifest_major_version" type="INT">
100+
<constraints nullable="false"/>
101+
</column>
102+
<column name="cpk_manifest_minor_version" type="INT">
103+
<constraints nullable="false"/>
104+
</column>
105+
<!-- duplicate with cpk_main_bundle_name? -->
106+
<column name="cpk_main_bundle" type="VARCHAR(255)">
107+
<constraints nullable="false"/>
108+
</column>
109+
<column name="cpk_type" type="VARCHAR(255)">
110+
<constraints nullable="true"/>
111+
</column>
84112
<column name="insert_ts" type="TIMESTAMP"
85113
defaultValueComputed="CURRENT_TIMESTAMP">
86114
<constraints nullable="false"/>
@@ -102,5 +130,132 @@
102130
baseTableSchemaName="${schema.name}"
103131
referencedTableSchemaName="${schema.name}"/>
104132

133+
<createTable tableName="cpk_library" schemaName="${schema.name}">
134+
<column name="cpi_name" type="VARCHAR(255)">
135+
<constraints nullable="false"/>
136+
</column>
137+
<column name="cpi_version" type="VARCHAR(255)">
138+
<constraints nullable="false"/>
139+
</column>
140+
<column name="cpi_signer_summary_hash" type="VARCHAR(255)">
141+
<constraints nullable="false"/>
142+
</column>
143+
<column name="cpk_file_checksum" type="VARCHAR(255)">
144+
<constraints nullable="false"/>
145+
</column>
146+
<column name="library_name" type="VARCHAR(255)">
147+
<constraints nullable="false"/>
148+
</column>
149+
</createTable>
150+
151+
<addPrimaryKey tableName="cpk_library"
152+
columnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum, library_name"
153+
constraintName="cpk_library_pk"
154+
schemaName="${schema.name}"/>
155+
156+
<addForeignKeyConstraint baseTableName="cpk_library" baseColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
157+
referencedTableName="cpi_cpk" referencedColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
158+
constraintName="FK_cpk_library_cpi_cpk"
159+
baseTableSchemaName="${schema.name}"
160+
referencedTableSchemaName="${schema.name}"/>
161+
162+
<createTable tableName="cpk_dependency" schemaName="${schema.name}">
163+
<column name="cpi_name" type="VARCHAR(255)">
164+
<constraints nullable="false"/>
165+
</column>
166+
<column name="cpi_version" type="VARCHAR(255)">
167+
<constraints nullable="false"/>
168+
</column>
169+
<column name="cpi_signer_summary_hash" type="VARCHAR(255)">
170+
<constraints nullable="false"/>
171+
</column>
172+
<column name="cpk_file_checksum" type="VARCHAR(255)">
173+
<constraints nullable="false"/>
174+
</column>
175+
<column name="main_bundle_name" type="VARCHAR(255)">
176+
<constraints nullable="false"/>
177+
</column>
178+
<column name="main_bundle_version" type="VARCHAR(255)">
179+
<constraints nullable="false"/>
180+
</column>
181+
<column name="signer_summary_hash" type="VARCHAR(255)">
182+
<constraints nullable="false"/>
183+
</column>
184+
</createTable>
185+
186+
<addPrimaryKey tableName="cpk_dependency"
187+
columnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum, main_bundle_name, main_bundle_version, signer_summary_hash"
188+
constraintName="cpk_dependency_pk"
189+
schemaName="${schema.name}"/>
190+
191+
<addForeignKeyConstraint baseTableName="cpk_dependency" baseColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
192+
referencedTableName="cpi_cpk" referencedColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
193+
constraintName="FK_cpk_dependency_cpi_cpk"
194+
baseTableSchemaName="${schema.name}"
195+
referencedTableSchemaName="${schema.name}"/>
196+
197+
<createTable tableName="cpk_cordapp_manifest" schemaName="${schema.name}">
198+
<column name="cpi_name" type="VARCHAR(255)">
199+
<constraints nullable="false"/>
200+
</column>
201+
<column name="cpi_version" type="VARCHAR(255)">
202+
<constraints nullable="false"/>
203+
</column>
204+
<column name="cpi_signer_summary_hash" type="VARCHAR(255)">
205+
<constraints nullable="false"/>
206+
</column>
207+
<column name="cpk_file_checksum" type="VARCHAR(255)">
208+
<constraints nullable="false"/>
209+
</column>
210+
<!-- Check if we could rename this to main_bundle_name -->
211+
<column name="bundle_symbolic_name" type="VARCHAR(255)">
212+
<constraints nullable="false"/>
213+
</column>
214+
<!-- Check if we could rename this to main_bundle_version -->
215+
<column name="bundle_version" type="VARCHAR(255)">
216+
<constraints nullable="false"/>
217+
</column>
218+
<column name="min_platform_version" type="INT">
219+
<constraints nullable="false"/>
220+
</column>
221+
<column name="target_platform_version" type="INT">
222+
<constraints nullable="false"/>
223+
</column>
224+
<column name="contract_info_short_name" type="VARCHAR(255)">
225+
<constraints nullable="true"/>
226+
</column>
227+
<column name="contract_info_vendor" type="VARCHAR(255)">
228+
<constraints nullable="true"/>
229+
</column>
230+
<column name="contract_info_version_id" type="INT">
231+
<constraints nullable="true"/>
232+
</column>
233+
<column name="contract_info_license" type="VARCHAR(255)">
234+
<constraints nullable="true"/>
235+
</column>
236+
<column name="work_flow_info_short_name" type="VARCHAR(255)">
237+
<constraints nullable="true"/>
238+
</column>
239+
<column name="work_flow_info_vendor" type="VARCHAR(255)">
240+
<constraints nullable="true"/>
241+
</column>
242+
<column name="work_flow_info_version_id" type="INT">
243+
<constraints nullable="true"/>
244+
</column>
245+
<column name="work_flow_info_license" type="VARCHAR(255)">
246+
<constraints nullable="true"/>
247+
</column>
248+
</createTable>
249+
250+
<addPrimaryKey tableName="cpk_cordapp_manifest"
251+
columnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum, bundle_symbolic_name, bundle_version, min_platform_version, target_platform_version"
252+
constraintName="cpk_cordapp_manifest_pk"
253+
schemaName="${schema.name}"/>
254+
255+
<addForeignKeyConstraint baseTableName="cpk_cordapp_manifest" baseColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
256+
referencedTableName="cpi_cpk" referencedColumnNames="cpi_name, cpi_version, cpi_signer_summary_hash, cpk_file_checksum"
257+
constraintName="FK_cpk_cordapp_manifest_cpi_cpk"
258+
baseTableSchemaName="${schema.name}"
259+
referencedTableSchemaName="${schema.name}"/>
105260
</changeSet>
106261
</databaseChangeLog>

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cordaProductVersion = 5.0.0
77
# NOTE: update this each time this module contains a breaking change
88
## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to
99
## a per module property in which case module versions can change independently.
10-
cordaApiRevision = 98
10+
cordaApiRevision = 99
1111

1212
# Main
1313
kotlinVersion = 1.6.21

0 commit comments

Comments
 (0)