-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Migrate TaskInstance to UUID v7 primary key
#43243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
While working on this apache#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
|
A neat trick to avoid the need for pgcrypto extension: https://brandur.org/fragments/secure-bytes-without-pgcrypto Though Oh, Pg 12 is officially all we support anyway, so I think using the |
While working on this apache#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
While working on this #43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
While working on this apache#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
While working on this apache#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
6b121ca to
a25a775
Compare
Issues identifiedAfter updating the primary key on the
|
672047f to
3c61ba7
Compare
5e3682a to
92fc37b
Compare
|
I do think long-term/by release of 3.0 TaskInstanceHistory should also have a uuid. |
ashb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, our use of session.merge() in Airflow is v. bad :(
Agree. This is one of the reasons I wanted to avoid all those db-schema changes for the initial proposal of multi-team and proposed the team-id prefix, becaue I was afraid we are going to have similar ripple-effects that will result in rewriting big part of our database code. Which seem that it was a pretty justified worry. |
|
BTW. One of the ways it could be helped - we could potentially generate the unique id by hashing the remaining fields - with appropriate hashing algorithm, we could have very low probability of collision (and maybe we could implement a mechanism to detect collisions and implement handling of those collision in similar ways they are handled in hash maps) - that would be another way how we could approach it (and there the merge code could be simpler and still use session.merge() But this one also comes with it's own set of difficulties and collision handling is likely going to be complex. But I thought it's worth menioning it here as an option. |
|
One problem with generating the unique hash with other fields, is that it will be even more difficult to add new fields, so probably getting rid of session.merge() everywhere and replacing it with our own way of merging objects and database entries by retrieving the unique id based on the unique fields from the DB before merging is likely a long-term better approach. |
|
@potiuk Yeah, I considered hashing but it is bad for Databases for indexing and, as a result, querying since it won't have temporal properties apart from Collision Handling complexity. UUID v7 is explicitly designed to support distributed databases with high insert rates due to its temporal ordering.
|
Indeed |
Yep. that settles it as well. We would have to implement our hashing in similar way (if possible at all) |
apache#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses.
#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses.
While working on this apache#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source.
* Migrate `TaskInstance` to UUID v7 primary key closes apache#43161 part of [AIP-72](https://github.com/orgs/apache/projects/405). As part of the ongoing work for [AIP-72: Task Execution Interface](https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-72+Task+Execution+Interface+aka+Task+SDK), we are migrating the task_instance table to use a UUID primary key. This change is being made to simplify task instance identification, especially when communicating between the executor and workers. Currently, the primary key of task_instance is a composite key consisting of `dag_id, task_id, run_id, and map_index` as shown below. This migration introduces a **UUID v7** column (`id`) as the new primary key. https://github.com/apache/airflow/blob/b4269f33c7151e6d61e07333003ec1e219285b07/airflow/models/taskinstance.py#L1815-L1819 The UUID v7 format was chosen because of its improved temporal sorting capabilities. For existing records, UUID v7 will be generated using either the queued_dttm, start_date, or the current timestamp. <img width="792" alt="image" src="https://github.com/user-attachments/assets/ba68c9ae-4f9d-4cd2-8504-1b671d23ef6c"> (From [this blog post](https://www.toomanyafterthoughts.com/uuids-are-bad-for-database-index-performance-uuid7).) 1. **Migrated Primary Key to UUID v7** - Replaced the composite primary key (`dag_id`, `task_id`, `run_id`, `map_index`) with a UUID v7 `id` field, ensuring temporal sorting and simplified task instance identification. 2. **Database-Specific UUID v7 Functions** - Added UUID v7 functions for each database: - **PostgreSQL**: Uses `pgcrypto` for generation with fallback. - **MySQL**: Custom deterministic UUID v7 function. - **SQLite**: Utilizes `uuid6` Python package. 3. **Updated Constraints and Indexes** - Added `UniqueConstraint` on (`dag_id`, `task_id`, `run_id`, `map_index`) for compatibility. - Modified foreign key constraints for the new primary key, handling downgrades to restore previous constraints. 4. **Model and API Adjustments** - Updated `TaskInstance` model to use UUID v7 as the primary key via [`uuid6`](https://pypi.org/project/uuid6/) library, that has uuid7 ! 😄 . - Adjusted REST API, views, and queries to support UUID-based lookups. - Modified tests for compatibility with the new primary key.
apache#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses.
While working on this apache/airflow#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source. GitOrigin-RevId: ae90a8f49194ff112dee752a4c99677ee01cf46b
apache/airflow#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses. GitOrigin-RevId: 8b0ac8d5302623d5ec0e19d108f337f8916c1109
While working on this apache/airflow#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source. GitOrigin-RevId: ae90a8f49194ff112dee752a4c99677ee01cf46b
apache/airflow#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses. GitOrigin-RevId: 8b0ac8d5302623d5ec0e19d108f337f8916c1109
While working on this apache/airflow#43243, I was following https://github.com/apache/airflow/blob/main/contributing-docs/13_metadata_database_updates.rst and I ran into an error with pre-commit hook. When running the revision command as follows: ``` root@f1f78138ad78:/opt/airflow/airflow# alembic revision -m "New revision" Generating /opt/airflow/airflow/migrations/versions/01b38be821e9_new_revision.py ... done ``` It creates a file as follows: ```python """New revision Revision ID: cd7be1ae8b80 Revises: 05234396c6fc Create Date: 2024-10-22 01:44:17.873864 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = 'cd7be1ae8b80' down_revision = '05234396c6fc' branch_labels = None depends_on = None ``` Notice single quotes in `revision` & `down_revision`. Now if I just run that single pre-commit hook (`update-migration-references`), it fails ``` ❯ pre-commit run "update-migration-references" --all-files Update migration ref doc.................................................Failed - hook id: update-migration-references - exit code: 1 Using 'uv' to install Airflow Using airflow version from current sources Updating migration reference for airflow Making sure airflow version updated Making sure there's no mismatching revision numbers Traceback (most recent call last): File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 246, in <module> correct_mismatching_revision_nums(revisions=revisions) File "/opt/airflow/scripts/in_container/run_migration_reference.py", line 230, in correct_mismatching_revision_nums new_content = content.replace(revision_id_match.group(1), revision_match.group(1), 1) AttributeError: 'NoneType' object has no attribute 'group' Error 1 returned If you see strange stacktraces above, run `breeze ci-image build --python 3.9` and try again. ``` That isn't a problem generally as `ruff` will fail before and convert it into double quotes. But rather than doing that, we fix it at source. GitOrigin-RevId: ae90a8f49194ff112dee752a4c99677ee01cf46b
apache/airflow#43243 added Task Instance "id" as primary key. This PR passes the same API to API responses. GitOrigin-RevId: 8b0ac8d5302623d5ec0e19d108f337f8916c1109
closes #43161 part of AIP-72.
As part of the ongoing work for AIP-72: Task Execution Interface, we are migrating the task_instance table to use a UUID primary key. This change is being made to simplify task instance identification, especially when communicating between the executor and workers.
Currently, the primary key of task_instance is a composite key consisting of
dag_id, task_id, run_id, and map_indexas shown below. This migration introduces a UUID v7 column (id) as the new primary key.airflow/airflow/models/taskinstance.py
Lines 1815 to 1819 in b4269f3
Why UUID v7?
The UUID v7 format was chosen because of its improved temporal sorting capabilities. For existing records, UUID v7 will be generated using either the queued_dttm, start_date, or the current timestamp.
(From this blog post.)
Changes
Migrated Primary Key to UUID v7
dag_id,task_id,run_id,map_index) with a UUID v7idfield, ensuring temporal sorting and simplified task instance identification.Database-Specific UUID v7 Functions for DB Migrations
pgcryptofor generation with fallback.uuid6Python package.Updated Constraints and Indexes
UniqueConstrainton (dag_id,task_id,run_id,map_index) for compatibility.Model and API Adjustments
TaskInstancemodel to use UUID v7 as the primary key viauuid6library, that has uuid7 ! 😄 .Issues identified
After updating the primary key on the
TaskInstancemodel to a UUID7idfield (from the composite primary key of["dag_id", "task_id", "run_id", "map_index"]), I have now run into issues in testing and session management:session.merge()CompatibilityThe
session.merge()function operates strictly on primary keys as mentioned in this SQLAlchemy docs, which means it no longer recognizes the unique constraint on["dag_id", "task_id", "run_id", "map_index"]to identify existingTaskInstancerecords. This leads to issues in cases wheresession.merge()was previously used to either update or insert TaskInstance records, as it now fails to locate the intended record by the unique constraint.Example:
airflow/tests/models/test_dag.py
Lines 2013 to 2026 in b2ecb6c
A possible workaround would be to follow
session.merge()calls withrefresh_from_db()to ensure the instance has the latest state:session.get()usage withTaskInstanceKeySimilarly,
session.get()and other primary key-based session operations now rely solely on theidUUID rather than the composite fields. This results in errors when accessing or sorting records based on the previous composite fields, assession.get()cannot match identifiers toTaskInstancerecords by the unique constraint.Current code in main:
airflow/tests/models/test_cleartasks.py
Line 742 in 78ff0a9
I have been changing those references from
TaskInstanceKeyin Database calls withti.id, example:airflow/tests/models/test_cleartasks.py
Line 742 in cca7ce0
Airflow REST API calls which filters TIs
Similar to (2) above, some of our REST API call filters TI records based on current primary key as below:
airflow/airflow/api_connexion/endpoints/task_instance_endpoint.py
Lines 536 to 537 in 78ff0a9
I am changing that to
session.scalars(select(TI).where(...))..one_or_none()queries. For example, the above code is changed to the following in this PR.airflow/airflow/api_connexion/endpoints/task_instance_endpoint.py
Lines 536 to 540 in 3c61ba7
TODOs
pgcryptoTaskInstancemodel file to addidFuture Work
task_instance_historytable requires similar updates for UUID v7 compatibility. (Evaluate if the TI History table requires similar updates (TI pk) for UUID v7 compatibility #43437)try_numberin theUniqueConstraintimproves index efficiency. (Determine if including try_number in the UniqueConstraint improves index efficiency #43439)