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

Reserve sequence range for system tables #1265

Merged
merged 1 commit into from
May 22, 2024
Merged

Reserve sequence range for system tables #1265

merged 1 commit into from
May 22, 2024

Conversation

kim
Copy link
Contributor

@kim kim commented May 21, 2024

Reserves an unreasonably large number of sequence values for use by system tables. This means that user-created tables will draw id values starting from the reserved range + 1, as opposed to number of values taken by system tables + 1.

Adding new system tables is thus unlikely to interfere with already-assigned values in existing databases.

API and ABI breaking changes

Breaks existing databases due to id conflicts.

Expected complexity level and risk

1

Testing

Should be covered by smoke tests.

@kim kim added the abi-break A PR that makes an ABI breaking change label May 21, 2024
@kim kim requested a review from Shubham8287 May 21, 2024 09:15
@kim kim changed the title tKim/reserve sys seq Reserve sequence range for system tables May 21, 2024
@kim kim linked an issue May 21, 2024 that may be closed by this pull request
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

Some minor stuff.

@Centril
Copy link
Contributor

Centril commented May 21, 2024

Might conflict a bit with #1263, so I'll wait with merging mine.

@kim kim force-pushed the kim/reserve-sys-seq branch from 51b9a33 to 5103f29 Compare May 21, 2024 11:36
Reserves an unreasonably large number of sequence values for use by system
tables. This means that user-created tables will draw id values starting
from the reserved range + 1, as opposed to number of values taken by
system tables + 1.

Adding new system tables is thus unlikely to interfere with already-assigned
values in existing databases.
@kim kim force-pushed the kim/reserve-sys-seq branch from 5103f29 to 9753f75 Compare May 21, 2024 11:44
///
/// However unlikely it may seem, it is advisable to check for overflow in the
/// test suite when adding sequences to system tables.
pub(crate) const ST_RESERVED_SEQUENCE_RANGE: u32 = 4096;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if this should be equal to SEQUENCE_PREALLOCATION_AMOUNT (sadly defined in the sats crate).

I have deliberately used ST_RESERVED_SEQUENCE_RANGE to set the allocated value of system sequence, so changing the former should not break anything.

Copy link
Contributor Author

@kim kim May 21, 2024

Choose a reason for hiding this comment

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

Equal as in ST_RESERVED_SEQUENCE_RANGE = SEQUENCE_PREALLOCATION_AMOUNT I mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think they really should be related tbh, they serve different purposes, even if they are used for similar things.

Copy link
Contributor

@Shubham8287 Shubham8287 left a comment

Choose a reason for hiding this comment

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

Looks good ✔️

@kim kim added this pull request to the merge queue May 22, 2024
Merged via the queue into master with commit edbca25 May 22, 2024
6 checks passed
@kim kim deleted the kim/reserve-sys-seq branch May 22, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi-break A PR that makes an ABI breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reserve 4096 table ids for adding system tables
4 participants