-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing index creation workflow from "post-snapshot-import" phase of…
… import-schema to default phase. (#1537) Changing index creation workflow from "post-snapshot-import" phase of import-schema to default phase. **Reason:** Based on perf experiments, it was shown that pre-creating indexes and then loading data was faster as compared to loading data and backfilling indexes. The theory here is: - Index creation is serial(parallel indexes cannot be created on YB as of now). Furthermore, as a result, there will be as many full table scans as there are no. of indexes - On the other hand, writing to indexes at the time of INSERT/UPDATE is done in parallel.
- Loading branch information
1 parent
5506673
commit 0701461
Showing
19 changed files
with
237 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import yb | ||
|
||
def main(): | ||
yb.run_checks(migration_completed_checks) | ||
|
||
|
||
#============================================================================= | ||
|
||
EXPECTED_INDEX_COUNT = { | ||
'desc_index_test': 2, | ||
'inunique_index_test': 3, | ||
'mult_index_test': 2, | ||
'outunique_index_test': 2, | ||
'primary_index_test': 1, | ||
'single_index_test': 2 | ||
} | ||
|
||
def migration_completed_checks(tgt): | ||
table_list = tgt.get_table_names("test_mysql_indexes") | ||
print("table_list:", table_list) | ||
assert len(table_list) == 6 | ||
|
||
get_index_cnt = tgt.get_count_index_on_table("test_mysql_indexes") | ||
for table_name, index_count in EXPECTED_INDEX_COUNT.items(): | ||
print(f"table_name: {table_name}, index_count: {get_index_cnt[table_name]}") | ||
assert index_count == get_index_cnt[table_name] | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,25 +12,13 @@ EXPECTED_ROW_COUNT = { | |
'members': 1000 | ||
} | ||
|
||
EXPECTED_INDEX_COUNT = { | ||
'members': 4 | ||
} | ||
|
||
|
||
def migration_completed_checks(tgt): | ||
table_list = tgt.get_table_names("public") | ||
print("table_list:", table_list) | ||
assert len(table_list) == 1 | ||
|
||
got_row_count = tgt.row_count_of_all_tables("public") | ||
for table_name, row_count in EXPECTED_ROW_COUNT.items(): | ||
print(f"table_name: {table_name}, row_count: {got_row_count[table_name]}") | ||
assert row_count == got_row_count[table_name] | ||
|
||
get_index_cnt = tgt.get_count_index_on_table("public") | ||
for table_name, index_count in EXPECTED_INDEX_COUNT.items(): | ||
print(f"table_name: {table_name}, index_count: {get_index_cnt[table_name]}") | ||
assert index_count == get_index_cnt[table_name] | ||
|
||
INSERT_MEMBERS_QUERY = "insert into public.members (first_name, last_name, gender, email, dob) VALUES ('Pepi', 'Elce', 'F', '[email protected]', '1984-03-04');" | ||
violate_unique_index_check_error = tgt.run_query_and_chk_error(INSERT_MEMBERS_QUERY, "23505") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import yb | ||
|
||
def main(): | ||
yb.run_checks(migration_completed_checks) | ||
|
||
|
||
# ============================================================================= | ||
|
||
|
||
EXPECTED_INDEX_COUNT = { | ||
'members': 4 | ||
} | ||
|
||
|
||
def migration_completed_checks(tgt): | ||
table_list = tgt.get_table_names("public") | ||
print("table_list:", table_list) | ||
assert len(table_list) == 1 | ||
|
||
get_index_cnt = tgt.get_count_index_on_table("public") | ||
for table_name, index_count in EXPECTED_INDEX_COUNT.items(): | ||
print(f"table_name: {table_name}, index_count: {get_index_cnt[table_name]}") | ||
assert index_count == get_index_cnt[table_name] | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import yb | ||
|
||
def main(): | ||
yb.run_checks(migration_completed_checks) | ||
|
||
|
||
#============================================================================= | ||
|
||
EXPECTED_INDEX_COUNT = { | ||
'single_index_test': 2, | ||
'mult_index_test': 1, | ||
'outunique_index_test': 2, | ||
'desc_index_test': 2, | ||
'partial_index_test': 2, | ||
'exp_index_test': 2, | ||
'hash_index_test': 2, | ||
'covering_index_test': 1, | ||
'gin_index_test': 1, | ||
} | ||
|
||
def migration_completed_checks(tgt): | ||
table_list = tgt.get_table_names("public") | ||
print("table_list:", table_list) | ||
assert len(table_list) == 9 | ||
|
||
|
||
get_index_cnt = tgt.get_count_index_on_table("public") | ||
for table_name, index_count in EXPECTED_INDEX_COUNT.items(): | ||
print(f"table_name: {table_name}, index_count: {get_index_cnt[table_name]}") | ||
assert index_count == get_index_cnt[table_name] | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import yb | ||
|
||
def main(): | ||
yb.run_checks(migration_completed_checks) | ||
|
||
|
||
#============================================================================= | ||
|
||
EXPECTED_TRIGGER_LIST = ["audit_trigger",] | ||
|
||
def migration_completed_checks(tgt): | ||
table_list = tgt.get_table_names("public") | ||
print("table_list:", table_list) | ||
assert len(table_list) == 5 | ||
|
||
fetched_triggers = tgt.fetch_all_triggers("public") | ||
print(f"fetched triggers list: {fetched_triggers}\n Expected triggers: {EXPECTED_TRIGGER_LIST}") | ||
assert fetched_triggers == EXPECTED_TRIGGER_LIST | ||
|
||
fetched_procedures_functions = tgt.fetch_all_procedures("public") | ||
print(f"count of fecthed procedures/functions - {len(fetched_procedures_functions)}") | ||
assert len(fetched_procedures_functions) == 40 | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.