Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-13621 Idempotency id table definition #1222

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

kyriathar
Copy link

@kyriathar kyriathar commented Aug 18, 2023

Introduces table in vnode-vault schema which holds executed persistence requests (ids) from PersistenceService, to be used for deduplicating them.

runtime-os PR: #4491

@corda-jenkins-ci02
Copy link
Contributor

corda-jenkins-ci02 bot commented Aug 18, 2023

Jenkins build for PR 1222 build 9

Build Successful:
Jar artifact version produced by this PR: 5.1.0.20-alpha-1695156397723

@kyriathar kyriathar force-pushed the kyriakos/CORE-13621-idemopotency-id-table branch from a54e444 to 61f4833 Compare August 18, 2023 16:07
@kyriathar kyriathar force-pushed the kyriakos/CORE-13621-idemopotency-id-table branch from 61f4833 to d6c774e Compare August 29, 2023 11:42
@kyriathar kyriathar changed the title CORE-13621 Idemopotency id table definition CORE-13621 Idempotency id table definition Aug 30, 2023
@kyriathar kyriathar marked this pull request as ready for review August 30, 2023 08:46
@kyriathar kyriathar requested a review from a team as a code owner August 30, 2023 08:46
@kyriathar kyriathar force-pushed the kyriakos/CORE-13621-idemopotency-id-table branch 2 times, most recently from f345126 to ad613b3 Compare September 1, 2023 14:49
<column name="request_id" type="NVARCHAR(255)">
<constraints nullable="false" primaryKey="true"/>
</column>
</createTable>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the cleanup strategy for this table?
Would it not be useful to have a timestamp column that can be used for partitioning and/or cleanup?
Given it is insert only, I suspect it would be very cheap to have a DB auto-populated timestamp column, but we could check with @ifrankrui

Copy link
Author

@kyriathar kyriathar Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup strategy will be done in follow-up work. This PR only introduces the part of the deduplication table (the request ids) needed to deduplicate the persistence requests (in corda/corda-runtime-os#4491).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But do we have a design yet for the clean-up strategy?
I'm a bit uncomfortable with merging something in which we know will cause problems, without a plan for how we will mitigate it.
And if we know what the design will be, we may as well get the DB structure correct from the get-go.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you already include the housekeeping strategy here?

Yes, you could have a timestamp column for the deduplication table and populate the timestamp as a part of the insert request. However, I would not recommend using DB auto-populated timestamp column. They are implemented differently between databases and there isn't one simple way to define them in Liquibase change log.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there isn't one simple way to define them in Liquibase change log.

@ifrankrui I'm interested in this comment. Why is that?
We do this in a number of places already (e.g.:

)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driessamyn As pointed out in the above changelog, you have to define an extra property for one type of database when you support multiple database types. If you populate the timestamp column as a part of a persistence request, then you don't need these Liquibase properties.

@kyriathar kyriathar force-pushed the kyriakos/CORE-13621-idemopotency-id-table branch from ad613b3 to 77afe26 Compare September 12, 2023 17:05
@kyriathar kyriathar force-pushed the kyriakos/CORE-13621-idemopotency-id-table branch from 77afe26 to f3c1624 Compare September 19, 2023 20:46
Copy link
Contributor

@davidcurrie davidcurrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kyriathar kyriathar merged commit 1e00cfd into release/os/5.1 Sep 20, 2023
@kyriathar kyriathar deleted the kyriakos/CORE-13621-idemopotency-id-table branch September 20, 2023 12:46
@@ -6,5 +6,11 @@
<addColumn tableName="vnode_member_info">
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"/>
</addColumn>

<createTable tableName="vnode_persistence_request_id">
<column name="request_id" type="NVARCHAR(255)">
Copy link
Contributor

@conalsmith-r3 conalsmith-r3 Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just passing by, but I wonder if NVARCHAR(36) would be suffice as I think a UUID fits in it? I guess it depends how we build the idempotency ID.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only store the UUID.toString() in it. Will take a look to see if we can shorten the DB field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants