Skip to content

Commit

Permalink
refactor: Improve table data copy and deletion process
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Dec 20, 2024
1 parent 151a274 commit 86aabc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ ORDER BY
timestamp
) COMMENT 'Contains MEV relay validator registrations data.';

-- Copy data from current table to temporary table
INSERT INTO tmp.mev_relay_validator_registration_local SELECT * FROM default.mev_relay_validator_registration_local;

-- Drop distributed table
DROP TABLE default.mev_relay_validator_registration ON CLUSTER '{cluster}';

-- Copy data from current table to temporary table
INSERT INTO tmp.mev_relay_validator_registration_local SELECT * FROM default.mev_relay_validator_registration_local;

-- Rename current table to old
RENAME TABLE default.mev_relay_validator_registration_local TO tmp.mev_relay_validator_registration_local_old ON CLUSTER '{cluster}';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ ORDER BY
timestamp
) COMMENT 'Contains MEV relay validator registrations data.';

-- Delete the old distributed table
DROP TABLE IF EXISTS default.mev_relay_validator_registration ON CLUSTER '{cluster}';

-- Copy data from old table to new table. This doesn't seem to work on all shards even with ON CLUSTER. Needs to be done manually.
INSERT INTO tmp.mev_relay_validator_registration_local SELECT * FROM default.mev_relay_validator_registration_local;

Expand Down

0 comments on commit 86aabc6

Please sign in to comment.