From 86a5c381264767f8db6a9c0a6a8837c924349d41 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Thu, 18 Nov 2021 14:23:12 +0100 Subject: [PATCH 1/2] services/horizon: Update 51_remove_ht_unused_indexes.sql to drop index IF EXISTS --- services/horizon/internal/db2/schema/bindata.go | 6 +++--- .../db2/schema/migrations/51_remove_ht_unused_indexes.sql | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/services/horizon/internal/db2/schema/bindata.go b/services/horizon/internal/db2/schema/bindata.go index 3d4172341e..dff4af6a87 100644 --- a/services/horizon/internal/db2/schema/bindata.go +++ b/services/horizon/internal/db2/schema/bindata.go @@ -46,7 +46,7 @@ // migrations/49_add_brin_index_trade_aggregations.sql (206B) // migrations/4_add_protocol_version.sql (188B) // migrations/50_liquidity_pools.sql (3.876kB) -// migrations/51_remove_ht_unused_indexes.sql (301B) +// migrations/51_remove_ht_unused_indexes.sql (321B) // migrations/5_create_trades_table.sql (1.1kB) // migrations/6_create_assets_table.sql (366B) // migrations/7_modify_trades_table.sql (2.303kB) @@ -1041,7 +1041,7 @@ func migrations50_liquidity_poolsSql() (*asset, error) { return a, nil } -var _migrations51_remove_ht_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\xce\x4d\x6a\xc3\x30\x10\x05\xe0\xbd\x4e\xf1\x96\x35\xad\x4e\xe0\x55\xa9\x45\x6b\x30\x72\xf1\x0f\xed\xce\xc8\xf2\x24\xd1\x22\x52\xa2\x1f\x82\x6f\x1f\x08\x26\x31\xf1\x26\xbb\x61\x66\xde\xc7\xe3\x1c\xef\x47\xb3\xf7\x2a\x12\xfa\x13\x63\x9c\x23\xd9\x14\x68\x82\xb1\x93\xd1\x14\x58\xd1\xd4\xbf\x28\x65\x21\xfe\x31\xce\x83\xd2\xda\x25\x1b\xf3\xa7\xf5\x8e\xe8\x71\xba\x29\x77\xb5\x70\x17\xcb\xbe\x1a\xf1\xd9\x89\x0d\x83\x5a\xe2\x60\x42\x74\x7e\x1e\xa2\x57\x36\x28\x1d\x8d\xb3\x01\x7d\x5b\xca\x6f\x8c\xd1\x13\xe1\x6d\x79\xfe\xc0\x32\x0c\x81\xce\x89\xac\xa6\x2c\xdf\xc0\xab\x22\xaf\xe1\xab\x40\x86\xbf\x1f\xd1\x08\xac\x8d\xb2\x85\xac\x3b\xc8\xbe\xaa\x72\x76\x0d\x00\x00\xff\xff\xeb\xea\xf1\x6a\x2d\x01\x00\x00") +var _migrations51_remove_ht_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x8f\xbd\x4e\x80\x30\x14\x85\xf7\x3e\xc5\x19\x25\xda\x27\x60\x32\x52\xb5\x09\x29\x86\x42\x64\x23\xa5\x5c\xb5\x83\xad\xf6\x27\x86\xb7\x37\x31\xc4\xa0\x38\xb8\xdd\xe1\xbb\xdf\x39\x87\x73\x5c\xbe\xba\xe7\x68\x32\x61\x7c\x63\x8c\x73\x14\x5f\x12\xad\x70\x7e\x75\x96\x12\x6b\xfa\xee\x01\x52\x35\x62\xc2\xb2\xcd\xc6\xda\x50\x7c\x86\xbc\x85\x98\xa4\x1e\x74\xfd\x0b\x78\x22\xfa\x0b\xfa\x32\x7f\x27\x35\xe1\xc3\xb3\x9b\x5e\x5c\x0f\xe2\xac\xee\x14\x5e\x5c\xca\x21\x6e\x73\x8e\xc6\x27\x63\xb3\x0b\x3e\x61\xd4\x52\xdd\x61\xc9\x91\x08\x17\x3b\x7c\x85\xfd\x98\x13\xbd\x17\xf2\x96\xaa\xfa\x24\x3e\x56\xfa\x97\xfc\xf0\x50\xe1\xf1\x5e\xf4\x02\x3f\x66\x69\xa8\x6e\x80\x1a\xdb\xb6\x66\x9f\x01\x00\x00\xff\xff\x8a\x4c\xae\xe3\x41\x01\x00\x00") func migrations51_remove_ht_unused_indexesSqlBytes() ([]byte, error) { return bindataRead( @@ -1057,7 +1057,7 @@ func migrations51_remove_ht_unused_indexesSql() (*asset, error) { } info := bindataFileInfo{name: "migrations/51_remove_ht_unused_indexes.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x22, 0xf0, 0x9a, 0xf7, 0x3a, 0xb0, 0xf0, 0x65, 0x46, 0x6, 0xf, 0x48, 0x94, 0x15, 0xe2, 0x2e, 0x54, 0x37, 0x42, 0xfe, 0xbe, 0x72, 0x52, 0xc9, 0x8e, 0xc8, 0xfc, 0x83, 0x1, 0x10, 0x8d, 0x87}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbf, 0xb9, 0x14, 0x5, 0x65, 0x25, 0xc5, 0x24, 0x49, 0xc7, 0xa2, 0x12, 0x97, 0x9e, 0x15, 0x8f, 0xf2, 0xc8, 0x46, 0x99, 0x46, 0x79, 0x5, 0x93, 0xaf, 0x70, 0xab, 0x39, 0x66, 0x34, 0x51, 0x7f}} return a, nil } diff --git a/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql b/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql index 9cdf12cbfe..aa20691f3e 100644 --- a/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql +++ b/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql @@ -1,8 +1,8 @@ -- +migrate Up -- unused indices -DROP INDEX by_account; -DROP INDEX by_fee_account; +DROP INDEX by_account IF EXISTS; +DROP INDEX by_fee_account IF EXISTS; -- +migrate Down From de3911e7f38609989cf36f1d8e5d2a68d0829e1c Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Thu, 18 Nov 2021 14:39:19 +0100 Subject: [PATCH 2/2] fixes --- services/horizon/internal/db2/schema/bindata.go | 4 ++-- .../db2/schema/migrations/51_remove_ht_unused_indexes.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/horizon/internal/db2/schema/bindata.go b/services/horizon/internal/db2/schema/bindata.go index dff4af6a87..a009368f8a 100644 --- a/services/horizon/internal/db2/schema/bindata.go +++ b/services/horizon/internal/db2/schema/bindata.go @@ -1041,7 +1041,7 @@ func migrations50_liquidity_poolsSql() (*asset, error) { return a, nil } -var _migrations51_remove_ht_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x8f\xbd\x4e\x80\x30\x14\x85\xf7\x3e\xc5\x19\x25\xda\x27\x60\x32\x52\xb5\x09\x29\x86\x42\x64\x23\xa5\x5c\xb5\x83\xad\xf6\x27\x86\xb7\x37\x31\xc4\xa0\x38\xb8\xdd\xe1\xbb\xdf\x39\x87\x73\x5c\xbe\xba\xe7\x68\x32\x61\x7c\x63\x8c\x73\x14\x5f\x12\xad\x70\x7e\x75\x96\x12\x6b\xfa\xee\x01\x52\x35\x62\xc2\xb2\xcd\xc6\xda\x50\x7c\x86\xbc\x85\x98\xa4\x1e\x74\xfd\x0b\x78\x22\xfa\x0b\xfa\x32\x7f\x27\x35\xe1\xc3\xb3\x9b\x5e\x5c\x0f\xe2\xac\xee\x14\x5e\x5c\xca\x21\x6e\x73\x8e\xc6\x27\x63\xb3\x0b\x3e\x61\xd4\x52\xdd\x61\xc9\x91\x08\x17\x3b\x7c\x85\xfd\x98\x13\xbd\x17\xf2\x96\xaa\xfa\x24\x3e\x56\xfa\x97\xfc\xf0\x50\xe1\xf1\x5e\xf4\x02\x3f\x66\x69\xa8\x6e\x80\x1a\xdb\xb6\x66\x9f\x01\x00\x00\xff\xff\x8a\x4c\xae\xe3\x41\x01\x00\x00") +var _migrations51_remove_ht_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\xce\xbf\x4a\xc7\x30\x14\xc5\xf1\x3d\x4f\x71\x46\x8b\xe6\x09\x3a\x89\x8d\x1a\x28\xa9\x34\x2d\x76\x2b\x69\x7a\xd5\x0c\x26\x9a\x3f\x48\xdf\x5e\x90\x62\x0b\x22\xfc\xb6\x0c\xdf\xf3\xc9\xe5\x1c\xd7\xef\xee\x35\x9a\x4c\x18\x3f\x18\xe3\x1c\xc5\x97\x44\x2b\x9c\x5f\x9d\xa5\xc4\x9a\xbe\x7b\x82\x54\x8d\x98\x20\xef\x21\x26\xa9\x07\x8d\x65\x9b\x8d\xb5\xa1\xf8\x5c\xff\x1b\xbc\x10\x1d\xd1\x8f\xfc\xfb\x53\x13\xbe\x3c\xbb\xeb\xc5\xed\x20\xf6\xe5\x01\xa2\x53\x78\x73\x29\x87\xb8\xcd\x39\x1a\x9f\x8c\xcd\x2e\xf8\x84\x51\x4b\xf5\x80\x25\x47\x22\x5c\xed\xf1\x0d\xf6\xc7\x9c\xe8\xb3\x90\xb7\x54\xd5\x7f\xe0\xd3\x21\x97\xe1\xa7\x41\x85\xe7\x47\xd1\x0b\x9c\x0d\xa9\xa1\xba\x01\x6a\x6c\xdb\x9a\x7d\x07\x00\x00\xff\xff\x08\x04\xf4\x75\x41\x01\x00\x00") func migrations51_remove_ht_unused_indexesSqlBytes() ([]byte, error) { return bindataRead( @@ -1057,7 +1057,7 @@ func migrations51_remove_ht_unused_indexesSql() (*asset, error) { } info := bindataFileInfo{name: "migrations/51_remove_ht_unused_indexes.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbf, 0xb9, 0x14, 0x5, 0x65, 0x25, 0xc5, 0x24, 0x49, 0xc7, 0xa2, 0x12, 0x97, 0x9e, 0x15, 0x8f, 0xf2, 0xc8, 0x46, 0x99, 0x46, 0x79, 0x5, 0x93, 0xaf, 0x70, 0xab, 0x39, 0x66, 0x34, 0x51, 0x7f}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe6, 0x27, 0xd4, 0x40, 0x1, 0x69, 0x1, 0x90, 0xeb, 0x92, 0x8a, 0x93, 0xd6, 0xa3, 0x5c, 0x67, 0x1, 0x4f, 0x15, 0xf9, 0x98, 0xcc, 0x62, 0xd6, 0xa7, 0x2e, 0x2a, 0xae, 0x88, 0xd3, 0x31, 0x79}} return a, nil } diff --git a/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql b/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql index aa20691f3e..69e5b3bcfc 100644 --- a/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql +++ b/services/horizon/internal/db2/schema/migrations/51_remove_ht_unused_indexes.sql @@ -1,8 +1,8 @@ -- +migrate Up -- unused indices -DROP INDEX by_account IF EXISTS; -DROP INDEX by_fee_account IF EXISTS; +DROP INDEX IF EXISTS by_account; +DROP INDEX IF EXISTS by_fee_account; -- +migrate Down