전체 글
-
Transaction 격리 레벨 / 전파 모델JAVA 2023. 8. 6. 17:30
격리 수준에따라 발생할 수 있는 문제점 Dirty Read 특정 트랜잭션이 데이터를 변경하고 아직 COMMIT 하지 않은 상태에서 다른 트랜잭셔인 변경 내용을 조회할 수 있는 문제 Non-Repeatable Read 같은 트랜잭션 내에서 같은 데이터를 반복적으로 조회했을 때 읽어온 데이터가 다른 문제 Phantom Read Non-Repeatable Read의 한 종류로 조회해온 결과의 행이 새로 생기거나 없어지는 문제 Transaction Isolation Level 트랜잭션 격리수준은 동시에 여러 트랜잭션이 진행될 때 현재 트랜잭션의 작업을 다른 트랜잭션에게 어떻게 적용 시킬지를 결정한다. 트랜잭션 격리 수준은 아래와같이 크게 4개로 나뉜다. 아래로 갈 수록 트랜잭션간 고립 정도가 높아지며, 성능이 ..
-
위상 정렬 알고리즘알고리즘 2023. 8. 2. 11:32
위상 정렬 알고리즘 위상 정렬(Topology Sort)은 순서가 있는 작업을 차례대로 수행해야 할 때 사용하는 알고리즘이다. 위상 정렬을 하기 위해서는 사이클이 없는 방향 그래프 DAG(Directed Acyclic Graph)이여야 한다. 위상정렬은 큐와 각 노드의 진입차수(Indegree)를 이용하여 구현할 수 있다. 1. 각 Node 별로 Indegree를 구해준다. 2. Indegree가 0인 Node를 Queue에 넣어준다. 3. Queue에서 Node를 가져와 해당 Node에서 방문 가능한 Node의 Indegree를 감소시킨다. 4. 감소된 Node의 Indegree가 0 이라면 Queue에 넣어준다. 5. Queue가 빌때까지 3,4 작업을 반복한다. 위와같은 순서로 동작한다면 Queue..