Database Transaction
データベーストランザクション
データベーストランザクションは、一緒に完了するか、すべてまとめて取り消されるデータベースの手順のグループです。その分離ルールは、同時に行われている作業とどのように相互作用するかを示します。
もう一つの例
銀行振込は、口座Aからお金を取り、口座Bに加え、1つの取引で1つの元帳記録を書きます。もしBが凍結されている場合、3つの変更すべてがロールバックされます。外部へのメールは、取引中ではなくコミット後に送信トレイから送られます。
主な部分
- 01トランザクション境界
- 02不変条件保持文
- 03コミットまたはロールバック
以下の場合に使用します
関連するデータベースの変更が一度に表示される必要がある場合は、最小限の実用的なトランザクションを使用し、そのルールを維持してください。
以下の場合は使用しないでください
ユーザー入力やリモート呼び出しを待っている間、トランザクションを開いたままにしないでください。ローカルトランザクションだけでは別のサービスをカバーできません。
コードで使用する名前
BEGIN + statements + COMMIT/ROLLBACK with explicit isolation 出荷前に
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome:Complete the task with データベーストランザクション (Database Transaction)。 User context:銀行振込は、口座Aからお金を取り、口座Bに加え、1つの取引で1つの元帳記録を書きます。もしBが凍結されている場合、3つの変更すべてがロールバックされます。外部へのメールは、取引中ではなくコミット後に送信トレイから送られます。 Technical concept or control:データベーストランザクション (Database Transaction)。 Why it fits:関連するデータベースの変更が一度に表示される必要がある場合は、最小限の実用的なトランザクションを使用し、そのルールを維持してください。 Do not use it when:ユーザー入力やリモート呼び出しを待っている間、トランザクションを開いたままにしないでください。ローカルトランザクションだけでは別のサービスをカバーできません。 Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary):その情報源にとって公式です。他のプラットフォームやチームはその用語を別の方法で使用する場合があります。 Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
このリクエストを確認する
Review how データベーストランザクション (Database Transaction) is used now. Definition: データベーストランザクションは、一緒に完了するか、すべてまとめて取り消されるデータベースの手順のグループです。その分離ルールは、同時に行われている作業とどのように相互作用するかを示します。 Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.