Merge pull request #126 from cerc-io/ian/v5

Drop `access_list_elements` table
This commit is contained in:
Ian Norden 2023-02-27 10:31:00 -06:00 committed by GitHub
commit df352ffd1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 0 additions and 76 deletions

View File

@ -1,12 +0,0 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS eth.access_list_elements (
block_number BIGINT NOT NULL,
tx_id VARCHAR(66) NOT NULL,
index INTEGER NOT NULL,
address VARCHAR(66),
storage_keys VARCHAR(66)[],
PRIMARY KEY (tx_id, index, block_number)
);
-- +goose Down
DROP TABLE eth.access_list_elements;

View File

@ -39,11 +39,6 @@ CREATE INDEX storage_header_id_index ON eth.storage_cids USING btree (header_id)
CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed); CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed);
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids(storage_leaf_key, block_number DESC); CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids(storage_leaf_key, block_number DESC);
-- access list indexes
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING btree (block_number);
CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING btree (address);
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
-- log indexes -- log indexes
CREATE INDEX log_block_number_index ON eth.log_cids USING btree (block_number); CREATE INDEX log_block_number_index ON eth.log_cids USING btree (block_number);
CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id); CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id);
@ -65,11 +60,6 @@ DROP INDEX eth.log_cid_block_number_index;
DROP INDEX eth.log_header_id_index; DROP INDEX eth.log_header_id_index;
DROP INDEX eth.log_block_number_index; DROP INDEX eth.log_block_number_index;
-- access list indexes
DROP INDEX eth.access_list_storage_keys_index;
DROP INDEX eth.access_list_element_address_index;
DROP INDEX eth.access_list_block_number_index;
-- storage node indexes -- storage node indexes
DROP INDEX eth.storage_removed_index; DROP INDEX eth.storage_removed_index;
DROP INDEX eth.storage_header_id_index; DROP INDEX eth.storage_header_id_index;

View File

@ -6,7 +6,6 @@ SELECT create_hypertable('eth.transaction_cids', 'block_number', migrate_data =>
SELECT create_hypertable('eth.receipt_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768); SELECT create_hypertable('eth.receipt_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
SELECT create_hypertable('eth.state_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768); SELECT create_hypertable('eth.state_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
SELECT create_hypertable('eth.storage_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768); SELECT create_hypertable('eth.storage_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
SELECT create_hypertable('eth.access_list_elements', 'block_number', migrate_data => true, chunk_time_interval => 32768);
SELECT create_hypertable('eth.log_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768); SELECT create_hypertable('eth.log_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
-- update version -- update version
@ -20,7 +19,6 @@ INSERT INTO public.db_version (singleton, version) VALUES (true, 'v5.0.0')
-- reversing conversion to hypertable requires migrating all data from every chunk back to a single table -- reversing conversion to hypertable requires migrating all data from every chunk back to a single table
-- create new regular tables -- create new regular tables
CREATE TABLE eth.log_cids_i (LIKE eth.log_cids INCLUDING ALL); CREATE TABLE eth.log_cids_i (LIKE eth.log_cids INCLUDING ALL);
CREATE TABLE eth.access_list_elements_i (LIKE eth.access_list_elements INCLUDING ALL);
CREATE TABLE eth.storage_cids_i (LIKE eth.storage_cids INCLUDING ALL); CREATE TABLE eth.storage_cids_i (LIKE eth.storage_cids INCLUDING ALL);
CREATE TABLE eth.state_cids_i (LIKE eth.state_cids INCLUDING ALL); CREATE TABLE eth.state_cids_i (LIKE eth.state_cids INCLUDING ALL);
CREATE TABLE eth.receipt_cids_i (LIKE eth.receipt_cids INCLUDING ALL); CREATE TABLE eth.receipt_cids_i (LIKE eth.receipt_cids INCLUDING ALL);
@ -31,7 +29,6 @@ CREATE TABLE ipld.blocks_i (LIKE ipld.blocks INCLUDING ALL);
-- migrate data -- migrate data
INSERT INTO eth.log_cids_i (SELECT * FROM eth.log_cids); INSERT INTO eth.log_cids_i (SELECT * FROM eth.log_cids);
INSERT INTO eth.access_list_elements_i (SELECT * FROM eth.access_list_elements);
INSERT INTO eth.storage_cids_i (SELECT * FROM eth.storage_cids); INSERT INTO eth.storage_cids_i (SELECT * FROM eth.storage_cids);
INSERT INTO eth.state_cids_i (SELECT * FROM eth.state_cids); INSERT INTO eth.state_cids_i (SELECT * FROM eth.state_cids);
INSERT INTO eth.receipt_cids_i (SELECT * FROM eth.receipt_cids); INSERT INTO eth.receipt_cids_i (SELECT * FROM eth.receipt_cids);
@ -42,7 +39,6 @@ INSERT INTO ipld.blocks_i (SELECT * FROM ipld.blocks);
-- drop hypertables -- drop hypertables
DROP TABLE eth.log_cids; DROP TABLE eth.log_cids;
DROP TABLE eth.access_list_elements;
DROP TABLE eth.storage_cids; DROP TABLE eth.storage_cids;
DROP TABLE eth.state_cids; DROP TABLE eth.state_cids;
DROP TABLE eth.receipt_cids; DROP TABLE eth.receipt_cids;
@ -53,7 +49,6 @@ DROP TABLE ipld.blocks;
-- rename new tables -- rename new tables
ALTER TABLE eth.log_cids_i RENAME TO log_cids; ALTER TABLE eth.log_cids_i RENAME TO log_cids;
ALTER TABLE eth.access_list_elements_i RENAME TO access_list_elements;
ALTER TABLE eth.storage_cids_i RENAME TO storage_cids; ALTER TABLE eth.storage_cids_i RENAME TO storage_cids;
ALTER TABLE eth.state_cids_i RENAME TO state_cids; ALTER TABLE eth.state_cids_i RENAME TO state_cids;
ALTER TABLE eth.receipt_cids_i RENAME TO receipt_cids; ALTER TABLE eth.receipt_cids_i RENAME TO receipt_cids;

View File

@ -238,19 +238,6 @@ CREATE FUNCTION public.was_state_leaf_removed(key character varying, hash charac
$$; $$;
--
-- Name: access_list_elements; Type: TABLE; Schema: eth; Owner: -
--
CREATE TABLE eth.access_list_elements (
block_number bigint NOT NULL,
tx_id character varying(66) NOT NULL,
index integer NOT NULL,
address character varying(66),
storage_keys character varying(66)[]
);
-- --
-- Name: log_cids; Type: TABLE; Schema: eth; Owner: - -- Name: log_cids; Type: TABLE; Schema: eth; Owner: -
-- --
@ -458,14 +445,6 @@ COMMENT ON COLUMN public.nodes.node_id IS '@name ChainNodeID';
ALTER TABLE ONLY public.goose_db_version ALTER COLUMN id SET DEFAULT nextval('public.goose_db_version_id_seq'::regclass); ALTER TABLE ONLY public.goose_db_version ALTER COLUMN id SET DEFAULT nextval('public.goose_db_version_id_seq'::regclass);
--
-- Name: access_list_elements access_list_elements_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
--
ALTER TABLE ONLY eth.access_list_elements
ADD CONSTRAINT access_list_elements_pkey PRIMARY KEY (tx_id, index, block_number);
-- --
-- Name: header_cids header_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: - -- Name: header_cids header_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
-- --
@ -562,27 +541,6 @@ ALTER TABLE ONLY public.nodes
ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id); ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id);
--
-- Name: access_list_block_number_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING btree (block_number);
--
-- Name: access_list_element_address_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING btree (address);
--
-- Name: access_list_storage_keys_index; Type: INDEX; Schema: eth; Owner: -
--
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
-- --
-- Name: header_block_number_index; Type: INDEX; Schema: eth; Owner: - -- Name: header_block_number_index; Type: INDEX; Schema: eth; Owner: -
-- --
@ -842,13 +800,6 @@ CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
CREATE INDEX blocks_block_number_idx ON ipld.blocks USING btree (block_number DESC); CREATE INDEX blocks_block_number_idx ON ipld.blocks USING btree (block_number DESC);
--
-- Name: access_list_elements ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
--
CREATE TRIGGER ts_insert_blocker BEFORE INSERT ON eth.access_list_elements FOR EACH ROW EXECUTE FUNCTION _timescaledb_internal.insert_blocker();
-- --
-- Name: header_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: - -- Name: header_cids ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
-- --