Skip to content

Readment Updates - 3 - #6

Merged
Sumit Sarabhai (sumitmsft) merged 1 commit into
mainfrom
sumitsar/ReadmeUpdates
Feb 11, 2025
Merged

Sumit Sarabhai (sumitmsft) merged 1 commit into
mainfrom
sumitsar/ReadmeUpdates

Conversation

@sumitmsft

Copy link
Copy Markdown
Contributor

Added some more information to the Readme heading.

Gaurav Sharma (bewithgaurav) added a commit that referenced this pull request Nov 12, 2025
- Moved typedef ColumnProcessor, struct ColumnInfoExt, and all 10 inline processor functions from ddbc_bindings.cpp to ddbc_bindings.h
- Added new 'INTERNAL: Performance Optimization Helpers' section in header
- Added forward declarations for ColumnBuffers struct and FetchLobColumnData function
- Enables true cross-compilation-unit inlining for performance optimization
- Follows C++ best practices for inline function placement

Addresses review comments #4, #5, #6 from subrata-ms
Gaurav Sharma (bewithgaurav) added a commit that referenced this pull request Nov 12, 2025
…der file

- Moved DateTimeOffset struct definition to header (required by ColumnBuffers)
- Moved ColumnBuffers struct definition to header (required by inline functions)
- Moved typedef ColumnProcessor, struct ColumnInfoExt, and all 10 inline processor functions to header
- Added new 'INTERNAL: Performance Optimization Helpers' section in header
- Added forward declaration for FetchLobColumnData function
- Enables true cross-compilation-unit inlining for performance optimization
- Follows C++ best practices for inline function placement

Addresses review comments #4, #5, #6 from subrata-ms
Build verified successful (universal2 binary for macOS arm64 + x86_64)
Gaurav Sharma (bewithgaurav) added a commit that referenced this pull request Nov 12, 2025
- Moved NULL checks from inside processor functions to centralized location in main fetch loop
- All types (simple and complex) now follow same NULL-checking pattern
- Benefits:
  * Eliminates redundant branch checks (7 NULL checks per row removed)
  * Improves CPU branch prediction with single NULL check per column
  * Simplifies processor functions - they now assume non-NULL data
  * Better code consistency and maintainability

Modified files:
- ddbc_bindings.cpp: Restructured cell processing loop (lines 3257-3295)
  * Added centralized NULL/NO_TOTAL check before processor dispatch
  * NULL values now handled once per column instead of inside each processor

- ddbc_bindings.h: Updated all 10 processor functions
  * ProcessInteger, ProcessSmallInt, ProcessBigInt, ProcessTinyInt, ProcessBit
  * ProcessReal, ProcessDouble
  * ProcessChar, ProcessWChar, ProcessBinary
  * Removed redundant NULL checks from all processors
  * Added comments documenting NULL check removal (OPTIMIZATION #6)

No functional changes - NULL handling behavior unchanged, just moved to more efficient location.
gargsaumya added a commit that referenced this pull request Apr 15, 2026
New tests:
- test_executemany_large_batch_mixed_types: 10k rows, mixed types via executemany
- test_null_heavy_large_result_set: 50k rows with 6/8 cols NULL, verify None propagation
- test_cursor_reuse_high_iteration: single cursor reused 5000 times, memory leak check
- test_fetchone_loop_vs_fetchall_parity: 100k row bit-identical comparison of both fetch paths
- test_concurrent_read_write_no_corruption: 5 writers + 5 readers on shared table for 10s

Bug fixes:
- test_concurrent_fetch_data_integrity_no_corruption: verification block was inside
  thread.join() loop instead of after it (race condition + premature fail)
- test_pool_exhaustion_recovery: pool max_size was silently overridden by run_parallel();
  added pool_max_size param to MultiThreadedQueryRunner; fixed multi-statement query
- test numbering: docstring sequence skipped #4 (renumbered #5-#7 -> #4-#6)

Also registers 'slow' mark in pytest.ini to suppress PytestUnknownMarkWarning
gargsaumya added a commit that referenced this pull request Apr 15, 2026
New tests:
- test_executemany_large_batch_mixed_types: 10k rows, mixed types via executemany
- test_null_heavy_large_result_set: 50k rows with 6/8 cols NULL, verify None propagation
- test_cursor_reuse_high_iteration: single cursor reused 5000 times, memory leak check
- test_fetchone_loop_vs_fetchall_parity: 100k row bit-identical comparison of both fetch paths
- test_concurrent_read_write_no_corruption: 5 writers + 5 readers on shared table for 10s

Bug fixes:
- test_concurrent_fetch_data_integrity_no_corruption: verification block was inside
  thread.join() loop instead of after it (race condition + premature fail)
- test_pool_exhaustion_recovery: pool max_size was silently overridden by run_parallel();
  added pool_max_size param to MultiThreadedQueryRunner; fixed multi-statement query
- test numbering: docstring sequence skipped #4 (renumbered #5-#7 -> #4-#6)

Also registers 'slow' mark in pytest.ini to suppress PytestUnknownMarkWarning
gargsaumya added a commit that referenced this pull request Apr 23, 2026
…sts (#523)

New tests:
- test_executemany_large_batch_mixed_types: 10k rows, mixed types via
executemany
- test_null_heavy_large_result_set: 50k rows with 6/8 cols NULL, verify
None propagation
- test_cursor_reuse_high_iteration: single cursor reused 5000 times,
memory leak check
- test_fetchone_loop_vs_fetchall_parity: 100k row bit-identical
comparison of both fetch paths
- test_concurrent_read_write_no_corruption: 5 writers + 5 readers on
shared table for 10s

Bug fixes:
- test_concurrent_fetch_data_integrity_no_corruption: verification block
was inside thread.join() loop instead of after it (race condition +
premature fail)
- test_pool_exhaustion_recovery: pool max_size was silently overridden
by run_parallel(); added pool_max_size param to
MultiThreadedQueryRunner; fixed multi-statement query
- test numbering: docstring sequence skipped #4 (renumbered #5-#7 ->
#4-#6)

Also registers 'slow' mark in pytest.ini to suppress
PytestUnknownMarkWarning

### Work Item / Issue Reference  
<!-- 
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below 
For external contributors: Insert Github Issue number below
Only one reference is required - either GitHub issue OR ADO Work Item.
-->

<!-- mssql-python maintainers: ADO Work Item -->
> AB#<WORK_ITEM_ID>

<!-- External contributors: GitHub Issue -->
> GitHub Issue: #<ISSUE_NUMBER>

-------------------------------------------------------------------
### Summary   
<!-- Insert your summary of changes below. Minimum 10 characters
required. -->
This pull request adds several new high-scale stress tests and improves
the configurability and coverage of both single-threaded and
multi-threaded stress testing. The main updates include three new
single-threaded stress tests for executemany with mixed types,
NULL-heavy result sets, and high-iteration cursor re-use, plus a
fetchone vs fetchall parity test. Multi-threaded stress tests now
support explicit pool size configuration and improved pool exhaustion
testing. Test documentation and marker registration have also been
updated.

**Single-threaded stress test enhancements:**

* Added `test_executemany_large_batch_mixed_types` to stress-test
`executemany()` with 10,000 mixed-type rows, verifying parameter
serialization and correctness.
* Added `test_null_heavy_large_result_set` to fetch 50,000 rows with 6/8
columns as NULL, ensuring correct NULL handling at scale.
* Added `test_cursor_reuse_high_iteration` to re-use a single cursor for
5,000 execute/fetch cycles, checking for memory leaks and state reset.
* Added `test_fetchone_loop_vs_fetchall_parity` to verify bit-identical
results between fetchone() and fetchall() for 100,000 rows.
* Updated test docstrings and numbering for clarity and completeness.
[[1]](diffhunk://#diff-443e544600e5ca6d41ed9581de5c97b50cac49ad4b912fa9c96373883fa5badcR10-R14)
[[2]](diffhunk://#diff-443e544600e5ca6d41ed9581de5c97b50cac49ad4b912fa9c96373883fa5badcL265-R270)
[[3]](diffhunk://#diff-443e544600e5ca6d41ed9581de5c97b50cac49ad4b912fa9c96373883fa5badcL359-R364)
[[4]](diffhunk://#diff-443e544600e5ca6d41ed9581de5c97b50cac49ad4b912fa9c96373883fa5badcL461-R466)

**Multi-threaded stress test improvements:**

* The `MultiThreadedQueryRunner` now accepts a `pool_max_size`
parameter, allowing explicit control of the connection pool size in
tests.
[[1]](diffhunk://#diff-c682540720fa9ea7be607c26d2b18c03c94e122f9eed7bc4501348aad24c937aR116-R123)
[[2]](diffhunk://#diff-c682540720fa9ea7be607c26d2b18c03c94e122f9eed7bc4501348aad24c937aL250-R254)
* The pool exhaustion test (`test_pool_exhaustion_recovery`) now uses
the explicit pool size parameter and improved query logic for more
accurate stress simulation and reporting.
[[1]](diffhunk://#diff-c682540720fa9ea7be607c26d2b18c03c94e122f9eed7bc4501348aad24c937aL729-R741)
[[2]](diffhunk://#diff-c682540720fa9ea7be607c26d2b18c03c94e122f9eed7bc4501348aad24c937aL752-R755)
* Test documentation updated to clarify coverage of pool exhaustion and
concurrent mixed read/write.

**Test marker and config updates:**

* Registered a new `slow` pytest marker for extra-slow tests,
complementing the existing `stress` marker.

These changes expand test coverage for edge-case and high-load
scenarios, improve test documentation, and make stress tests more
configurable and robust.

<!-- 
### PR Title Guide

> For feature requests
FEAT: (short-description)

> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description) 

> For Fix requests
FIX: (short-description)

> For doc update requests 
DOC: (short-description)

> For Formatting, indentation, or styling update
STYLE: (short-description)

> For Refactor, without any feature changes
REFACTOR: (short-description)

> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description) 

### Contribution Guidelines

External contributors:
- Create a GitHub issue first:
https://github.com/microsoft/mssql-python/issues/new
- Link the GitHub issue in the "GitHub Issue" section above
- Follow the PR title format and provide a meaningful summary

mssql-python maintainers:
- Create an ADO Work Item following internal processes
- Link the ADO Work Item in the "ADO Work Item" section above  
- Follow the PR title format and provide a meaningful summary
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant