Compare commits

..
8 Commits
Author SHA1 Message Date
Ian Norden 36de257357 Merge pull request #46 from vulcanize/release-v3.0.5
drop un-unique indexes
2022-01-25 12:33:34 -06:00
i-norden 0710ed1bb1 drop un-unique indexes 2022-01-25 12:31:59 -06:00
Ian Norden c4254bdff1 Merge pull request #45 from vulcanize/release-v3.0.3
prep for integrated node of v3
2022-01-25 09:29:26 -06:00
i-norden 1088313ab7 prep for integrated node of v3 2022-01-25 08:29:25 -06:00
Ian Norden ffdf0a0d4d Merge pull request #43 from vulcanize/release-v3.0.2
v3.0.2
2022-01-19 15:31:13 -06:00
i-norden edabfcc9c9 migration for applying log_cids.leaf_mh_key FK constraint to check that repair process was completed 2022-01-19 15:21:29 -06:00
Ian Norden 6612edabbe Merge pull request #41 from vulcanize/release-v3.0.1
disable and renable indexes correctly
2022-01-10 21:52:25 -06:00
i-norden ae1a6e9d31 disable and renable indexes correctly 2022-01-10 21:51:04 -06:00
14 changed files with 136 additions and 29 deletions
-2
View File
@@ -57,13 +57,11 @@ rollback_to: $(GOOSE) checkmigration checkdbvars
.PHONY: `rollback_pre_batch_set` .PHONY: `rollback_pre_batch_set`
rollback_pre_batch_set: $(GOOSE) checkdbvars rollback_pre_batch_set: $(GOOSE) checkdbvars
$(GOOSE) -dir db/pre_batch_processing_migrations postgres "$(CONNECT_STRING)" down $(GOOSE) -dir db/pre_batch_processing_migrations postgres "$(CONNECT_STRING)" down
pg_dump -O -s $(CONNECT_STRING) > schema.sql
## Rollback post_batch_set ## Rollback post_batch_set
.PHONY: rollback_post_batch_set .PHONY: rollback_post_batch_set
rollback_post_batch_set: $(GOOSE) checkdbvars rollback_post_batch_set: $(GOOSE) checkdbvars
$(GOOSE) -dir db/post_batch_processing_migrations postgres "$(CONNECT_STRING)" down $(GOOSE) -dir db/post_batch_processing_migrations postgres "$(CONNECT_STRING)" down
pg_dump -O -s $(CONNECT_STRING) > schema.sql
## Apply the next up migration ## Apply the next up migration
.PHONY: migrate_up_by_one .PHONY: migrate_up_by_one
@@ -1,15 +1,15 @@
-- +goose Up -- +goose Up
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key); CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number); CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash); CREATE INDEX header_block_hash_index ON eth.header_cids USING btree (block_hash);
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id); CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash); CREATE INDEX tx_tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id); CREATE INDEX log_cids_index ON eth.log_cids USING btree (rct_id, index);
-- +goose Down -- +goose Down
DROP INDEX eth.log_tx_hash_index; DROP INDEX eth.log_cids_index;
DROP INDEX eth.transaction_hash_index; DROP INDEX eth.tx_tx_hash_index;
DROP INDEX eth.tx_header_hash_index; DROP INDEX eth.tx_header_id_index;
DROP INDEX eth.header_hash_index; DROP INDEX eth.header_block_hash_index;
DROP INDEX eth.block_number_index; DROP INDEX eth.block_number_index;
DROP INDEX eth.log_mh_index_index; DROP INDEX eth.log_mh_index;
@@ -0,0 +1,9 @@
-- +goose Up
ALTER TABLE eth.log_cids
ADD CONSTRAINT fk_log_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
-- +goose Down
ALTER TABLE eth.log_cids
DROP CONSTRAINT fk_log_leaf_mh_key;
@@ -1,15 +0,0 @@
-- +goose Up
DROP INDEX eth.log_tx_hash_index;
DROP INDEX eth.transaction_hash_index;
DROP INDEX eth.tx_header_hash_index;
DROP INDEX eth.header_hash_index;
DROP INDEX eth.block_number_index;
DROP INDEX eth.log_mh_index_index;
-- +goose Down
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash);
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id);
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash);
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id);
@@ -0,0 +1,53 @@
-- +goose Up
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.log_cids'
);
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.transaction_cids'
);
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.header_cids'
);
ALTER TABLE eth.log_cids
DROP CONSTRAINT fk_log_leaf_mh_key;
-- +goose Down
ALTER TABLE eth.log_cids
ADD CONSTRAINT fk_log_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.header_cids'
);
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.transaction_cids'
);
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.log_cids'
);
@@ -0,0 +1,53 @@
-- +goose Up
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.header_cids'
);
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.transaction_cids'
);
UPDATE pg_index
SET indisready=true
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.log_cids'
);
DROP INDEX eth.tx_header_id_index;
DROP INDEX eth.block_number_index;
DROP INDEX eth.log_mh_index;
-- +goose Down
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.log_cids'
);
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.transaction_cids'
);
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='eth.header_cids'
);
@@ -0,0 +1,9 @@
-- +goose Up
DROP INDEX eth.log_cids_index;
DROP INDEX eth.tx_tx_hash_index;
DROP INDEX eth.header_block_hash_index;
-- +goose Down
CREATE INDEX header_block_hash_index ON eth.header_cids USING btree (block_hash);
CREATE INDEX tx_tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
CREATE INDEX log_cids_index ON eth.log_cids USING btree (rct_id, index);
@@ -46,8 +46,8 @@ CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys); CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
-- log indexes -- log indexes
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid); CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid);
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX log_address_index ON eth.log_cids USING btree (address); CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
CREATE INDEX log_topic0_index ON eth.log_cids USING btree (topic0); CREATE INDEX log_topic0_index ON eth.log_cids USING btree (topic0);
CREATE INDEX log_topic1_index ON eth.log_cids USING btree (topic1); CREATE INDEX log_topic1_index ON eth.log_cids USING btree (topic1);
@@ -61,8 +61,8 @@ DROP INDEX eth.log_topic2_index;
DROP INDEX eth.log_topic1_index; DROP INDEX eth.log_topic1_index;
DROP INDEX eth.log_topic0_index; DROP INDEX eth.log_topic0_index;
DROP INDEX eth.log_address_index; DROP INDEX eth.log_address_index;
DROP INDEX eth.log_cid_index;
DROP INDEX eth.log_mh_index; DROP INDEX eth.log_mh_index;
DROP INDEX eth.log_cid_index;
-- access list indexes -- access list indexes
DROP INDEX eth.access_list_storage_keys_index; DROP INDEX eth.access_list_storage_keys_index;