Skip to content
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

TDL-24162 Log based inclusivity updates #90

Merged
merged 8 commits into from
Oct 16, 2023

Conversation

bhtowles
Copy link
Contributor

Uncomment all record count assertions, fix with pk count where needed, new method

Description of change

(write a short description here or paste a link to JIRA)

QA steps

  • automated tests passing
  • manual qa steps passing (list below)

Risks

Rollback steps

  • revert this branch

@bhtowles bhtowles added the testing QA work. No src code changes. label Sep 28, 2023
@bhtowles
Copy link
Contributor Author

Why do we still have test_sync_fully.py in the repo? Can I delete it?

tests/test_sync_logical_pks.py Outdated Show resolved Hide resolved
tests/test_log_based_interruped_replication.py Outdated Show resolved Hide resolved
tests/base.py Outdated Show resolved Hide resolved
tests/base.py Outdated Show resolved Hide resolved
tests/base.py Outdated Show resolved Hide resolved
Copy link

@HarrisonMarcRose HarrisonMarcRose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of questions

tests/base.py Outdated Show resolved Hide resolved
Comment on lines +315 to +316
expected_count['log_based_interruptible_dbo_int_and_bool_data'] = 2
expected_count['log_based_interruptible_dbo_int_data'] = 14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what changed to make this expectation to change? What am I missing?

tests/test_sync_logical_pks.py Outdated Show resolved Hide resolved
tests/test_sync_full.py Show resolved Hide resolved
tests/test_sync_logical_pks.py Outdated Show resolved Hide resolved
tests/test_sync_logical_pks.py Outdated Show resolved Hide resolved
tests/base.py Outdated
Comment on lines 223 to 230
stream_pks = {tuple(m.get('data', {}).get(pk) for pk in primary_keys)
for m in recs['messages']
if m['action'] == 'upsert'}

# remove any failed get() entries from the set to correct pk count
stream_pks.difference(set(tuple(None for pk in primary_keys)))

pk_count_by_stream[strm] = len(stream_pks)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar test code to before

primary_keys = ["pk1", "pk2"]

recs = {
    "messages": [
        {
            "action": "upsert",
            "data":{"pk1": "a", "pk2": "2",}
        },
        {
            "action": "upsert",
            "data":{"pk1": "a", "pk2": "2",}
        },
        {
            "action": "upsert",
            "data":{"pk1": "a", "pk2": "2",}
        },
        {
            "action": "upsert",
            "data":{"pk1": "a", "pk2": "3",}
        },
        {
            "action": "upsert",
            "data":{"pk1": "a",}
        },
        {
            "action": "upsert",
            "data":{"pk1": "a", "pk2": None,}
        },
    ]
}

stream_pks = {tuple(m.get('data', {}).get(pk) for pk in primary_keys)
              for m in recs['messages']
              if m['action'] == 'upsert'}

print(f"before difference: {stream_pks}")
stream_pks.difference(set(tuple(None for pk in primary_keys)))
print(f"after difference: {stream_pks}")

print(f"Got {len(stream_pks)} unique pks")

Results:

before difference: {('a', None), ('a', '3'), ('a', '2')}
after difference: {('a', None), ('a', '3'), ('a', '2')}
Got 3 unique pks

set().difference() doesn't modify the set its called on

  • But I'm not sure I understand # remove any failed get() entries from the set to correct pk count anyway
  • Seems like the test needs to fail if any PK returns null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to filter out any bad upserts, we carded out an upstream verification but I do like just failing the test if we find a bad upsert here. Commit incomming.

Copy link
Contributor

@luandy64 luandy64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left comments, but they're all for formatting things I don't care to follow up on

Comment on lines +8 to +10
from database import create_database, create_table, create_view, delete_by_pk, \
drop_all_user_databases, enable_database_tracking, insert, mssql_cursor_context_manager, \
update_by_pk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was only alphabetized? I don't see any additions or deletions?

@@ -5,9 +5,9 @@

from tap_tester import menagerie, runner, LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this wasn't alphabetized too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I tend to only alphabetize things when the list gets long enough that looking for an item isn't trivial. If it spans two lines or has a bunch of small values in random order for example.

'selected-by-default': True,
'inclusion': 'automatic'}},
{'info': {
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this was left condensed?

Comment on lines +148 to +151
{'pk': {
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'automatic'}},
{'data': {
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or why these are condensed too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All line length

Comment on lines +194 to +197
{'pk': {
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'automatic'}},
{'data': {
'sql-datatype': 'int', 'selected-by-default': True, 'inclusion': 'available'}}],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we like it condensed, so maybe that first one is the sore thumb and needs to change

else:
# the row wasn't deleted so we can either not pass the column or it can be None
# row wasn't deleted so dont pass the column or let it be None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# row wasn't deleted so dont pass the column or let it be None
# row wasn't deleted so don't pass the column or let it be None

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@bhtowles bhtowles merged commit a4c579f into master Oct 16, 2023
2 checks passed
@bhtowles bhtowles deleted the qa/TDL-24162-log-based-inclusivity branch October 16, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing QA work. No src code changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants