Database Transaction
데이터베이스 트랜잭션
데이터베이스 트랜잭션은 함께 완료되거나 모두 취소되는 데이터베이스 단계들의 집합입니다. 그 격리 규칙은 동시에 일어나는 작업과 어떻게 상호작용하는지를 말합니다.
다른 예시
은행 이체는 A 계좌에서 돈을 빼서 B 계좌에 추가하고, 한 개의 거래 기록을 하나의 트랜잭션 안에 작성합니다. B 계좌가 동결되면 세 가지 변경 사항 모두 롤백됩니다. 외부 이메일은 트랜잭션 중이 아니라 커밋 후 발신함에서 전송됩니다.
주요 부분
- 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 계좌에 추가하고, 한 개의 거래 기록을 하나의 트랜잭션 안에 작성합니다. B 계좌가 동결되면 세 가지 변경 사항 모두 롤백됩니다. 외부 이메일은 트랜잭션 중이 아니라 커밋 후 발신함에서 전송됩니다. 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.