-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update MSSQL test Docker image #2120
Conversation
The previous version was incompatible with the updated kernel now used by Github Actions runners. See: microsoft/mssql-docker#868 The fix has been backported as far as the 2019 image, but not to the 2017 image. Seeing that the 2017 image didn't match what was being run in production in any case we might as well upgrade. This requires a few small changes: * The `sqlcmd` tool has moved from `/opt/mssql-tools/bin` to `/opt/mssql-tools18/bin`. This is due to the newer image using the `mssql-tools18` apt package. Note that references to the old path are still present in the codebase because _our_ Docker image still installs the `mssql-tools` package. * The `sqlcmd` invocation now requires the `-C` option to automatically trust the server certificate.
Deploying databuilder-docs with Cloudflare Pages
|
The previous code used a single big regex and relied on a precise sequence of IO statistics being returned in a fixed order. In SQL Server 2019 new items were added and the order slightly changed. We rewrite the parsing code to be robust to such changes.
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.
Question about the log tests which might just be my misunderstanding things
( | ||
b"Table '#tmp_1______________________________________________________________________________________________________________0000000014D9'." | ||
b" Scan count 1, logical reads 4, physical reads 0, read-ahead reads 0," | ||
b" lob logical reads 0, lob physical reads 0, lob read-ahead reads 0." | ||
b" Scan count 1, logical reads 4, physical reads 0, page server reads 0," |
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.
Shouldn't the new page server
items also show up in the #tmp_1
entry in the table_io assert?
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.
The way I've got it working at the moment is that it discards any stats it isn't expecting, because it only iterates the keys already in cumulative_stats
:
ehrql/ehrql/utils/mssql_log_utils.py
Lines 92 to 101 in 3995a65
table_io = defaultdict( | |
lambda: { | |
"scans": 0, | |
"logical": 0, | |
"physical": 0, | |
"read_ahead": 0, | |
"lob_logical": 0, | |
"lob_physical": 0, | |
"lob_read_ahead": 0, | |
} |
ehrql/ehrql/utils/mssql_log_utils.py
Lines 122 to 123 in 3995a65
for key in cumulative_stats.keys(): | |
cumulative_stats[key] += stats.get(key, 0) |
I wanted to try to keep the output consistent between dev and prod in this respect.
I agree the tests here aren't as comprehensible as they could be, but they do cover everything and I didn't think it was worth the time making them better for a fairly small feature.
Copying the commit message from the equivalent PR on ehrql: opensafely-core/ehrql#2120 The previous version was incompatible with the updated kernel now used by Github Actions runners. See: microsoft/mssql-docker#868 The fix has been backported as far as the 2019 image, but not to the 2017 image. Seeing that the 2017 image didn't match what was being run in production in any case we might as well upgrade.
Copying the commit message from the equivalent PR on ehrql: opensafely-core/ehrql#2120 The previous version was incompatible with the updated kernel now used by Github Actions runners. See: microsoft/mssql-docker#868 The fix has been backported as far as the 2019 image, but not to the 2017 image. Seeing that the 2017 image didn't match what was being run in production in any case we might as well upgrade. This requires a few small changes: * The `sqlcmd` tool has moved from `/opt/mssql-tools/bin` to `/opt/mssql-tools18/bin`. This is due to the newer image using the `mssql-tools18` apt package. * The `sqlcmd` invocation now requires the `-C` option to automatically trust the server certificate.
The previous version was incompatible with the updated kernel now used by Github Actions runners. See:
microsoft/mssql-docker#868
The fix has been backported as far as the 2019 image, but not to the 2017 image. Seeing that the 2017 image didn't match what was being run in production in any case we might as well upgrade.
This requires a few small changes:
The
sqlcmd
tool has moved from/opt/mssql-tools/bin
to/opt/mssql-tools18/bin
. This is due to the newer image using themssql-tools18
apt package. Note that references to the old path are still present in the codebase because our Docker image still installs themssql-tools
package.The
sqlcmd
invocation now requires the-C
option to automatically trust the server certificate.The precise sequence in which IO statistics are returned has changed and so we update the code which parses these to be insensitive to changes in order.