Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions fundamentals/pycubrid/13_atomic_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
- Top-N rankings query

Adaptation note:
- If ON DUPLICATE KEY UPDATE fails on your server build, switch to a
SELECT-then-INSERT/UPDATE pattern. This script uses ODKU directly because it
is supported on standard CUBRID 11.2 setups.
- If ON DUPLICATE KEY UPDATE fails on your server build, do not fall back to a
bare SELECT-then-INSERT/UPDATE. Two writers can both read the same count and
overwrite an increment, or race to insert the same key. A safe alternative
needs its own transaction, locking, or compare-and-swap design; this recipe
does not include one. This script uses ODKU directly because it is supported
on standard CUBRID 11.2 setups.
"""

from __future__ import annotations
Expand Down
2 changes: 1 addition & 1 deletion fundamentals/pycubrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ constrains installation to its selected published driver version.
| `10_collection_columns.py` | Native collection columns | `SET`, `MULTISET`, `LIST`, typed `Set`/`Multiset`/`Sequence` binding, `decode_collections=True` |
| `11_bulk_etl_pipeline.py` | Chunked ETL pipeline | staging table, `executemany()` chunks, validation, upsert apply |
| `12_pool_retry_worker.py` | Connection pool & retry | minimal pool, exponential backoff, transient error recovery |
| `13_atomic_counters.py` | Atomic counters | `ON DUPLICATE KEY UPDATE`, hot-path metrics, rankings |
| `13_atomic_counters.py` | Atomic counters | `ON DUPLICATE KEY UPDATE` (atomic SQL-side increment; a bare SELECT-then-INSERT/UPDATE is not a concurrency-safe fallback), hot-path metrics, rankings |
| `14_manual_cascade_delete.py` | App-managed cascades | child-first deletes, preview counts, CUBRID no-CASCADE workaround |
| `15_cursor_memory_bound.py` | Bounded fetch with ``fetch_size`` | tracemalloc, fetch_size vs arraysize, peak-memory comparison |
| `16_batch_error_handling.py` | All-or-nothing batch recovery | ``executemany_batch`` error paths, `rollback()` for all-or-nothing semantics |
Expand Down