Skip to content

Conversation

@dorinhogea
Copy link
Contributor

@dorinhogea dorinhogea commented Dec 24, 2025

New syntax:
ALTER TABLE <table> PARTITIONED BY TIME PEROD <period> RETENTION <retention> START <start> RETROACTIVELY

The command will partition <table> into a time partition and distribute existing data from <table> into proper shards.
It will create <retention> shards, going back into the past starting from <start>.
It will use the timestamp embedded in the genid to distribute the row into a proper shard.
Comments:

  • rows older than the oldest shard are moved into the latter
  • rows newer than the are moved into the current shard
  • if <start> is in the past, it is possible that the server will rollout the new time partition into present and in the process wipe some data out; there is an option to disable rollout

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Error ⚠.
Regression testing: 551/639 tests failed ⚠.

The first 10 failing tests are:
sc_constraints [core dumped]
scindex [core dumped]
sc_inserts_deletes_partial_index_off_generated [core dumped]
sc_inserts_deletes [core dumped]
sc_redo [core dumped]
sc_partial_datacopy [core dumped]
sc_datacopy [core dumped]
sc_blob_update [core dumped]
sc_versmismatch
sc_inserts

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.

The first 10 failing tests are:
sc_resume_logicalsc_generated
sc_resume
insert_lots_ssl_generated
insert_lots
scindex
sc_constraints
sc_inserts_deletes_partial_index_off_generated
sc_inserts_deletes
sc_fieldlarger
sc_repeated_updates

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Success ✓.
Regression testing: 579/639 tests failed ⚠.

The first 10 failing tests are:
truncatesc_offline_generated [core dumped]
logfill_logput_window_generated
scindex
sc_constraints
sc_inserts_deletes_partial_index_off_generated
sc_inserts_deletes
sc_resume_logicalsc_generated
sc_resume
sc_fieldlarger
sc_repeated_updates

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Success ✓.
Regression testing: Success ✓.

The first 10 failing tests are:
comdb2sys_queueodh_generated
comdb2sys_pagesize_generated
comdb2sys
consumer_non_atomic_default_consumer_generated
auth_twofiles_generated
auth_queueodh_generated
auth
sc_transactional_rowlocks_generated
truncatesc_offline_generated
insert_lots_ssl_generated

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Success ✓.
Regression testing: Success ✓.

The first 10 failing tests are:
logfill_logput_window_generated
sc_timepart
consumer_non_atomic_default_consumer_generated
sc_transactional_rowlocks_generated
truncatesc_offline_generated
insert_lots_ssl_generated
insert_lots
reco-ddlk-sql

ALTER TABLE <table> PARTITIONED BY TIME PERIOD <p> RETENTION <r> START <s> RETROACTIVELY

The command will partition <table into a time partition and distribute existing data from into proper shards.
It will create <r> shards, going back into the past starting from <s>.
It will use the timestamp embedded in the genid to distribute the row into a proper shard.
Comments:
- rows older than the oldest shard are moved into the latter
- rows newer than the are moved into the current shard
- if is in the past, it is possible that the server will rollout the new time partition into present and in the process wipe some data out; there is an option to disable rollout
- to preserve existing data until rollout, use the value of start <s> should be o the next rollout in the future

Signed-off-by: Dorin Hogea <dhogea@bloomberg.net>
Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Error. ⚠.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.

The first 10 failing tests are:
consumer_non_atomic_default_consumer_generated
truncatesc_offline_generated
insert_lots_ssl_generated
insert_lots
reco-ddlk-sql

Copy link

@roborivers roborivers left a comment

Choose a reason for hiding this comment

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

Coding style check: Success ✓.
Cbuild submission: Success ✓.
Regression testing: Success ✓.

The first 10 failing tests are:
maxtable [core dumped]
consumer_non_atomic_default_consumer_generated
insert_lots_ssl_generated
insert_lots
reco-ddlk-sql

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.

2 participants