inflearn logo
강의

Khóa học

Chia sẻ kiến thức

Cách giải quyết các vấn đề đồng thời bằng hệ thống kiểm kê

OptimisticLock 관련 질문이 있습니다.

442

ecomin

18 câu hỏi đã được viết

0

안녕하세요 좋은 수업 올려주셔서 감사합니다.

현재 Test를 돌리게 되면 99 에서 무한 루프에 빠지게 됩니다.
version 이 업데이터 되지 않고 실행이되어 여러 질문 게시판에 올려진 문제중 하나인 core 갯수 문제인지 했느데 그것 또한 되지 않아 말씀 질문 드립니다.

https://github.com/Eco-Min/-concurrency_issue.git

 

2022-10-04 01:28:05.898 DEBUG 7468 --- [ Test worker] org.hibernate.SQL : insert into stock (product_id, quantity, version) values (?, ?, ?)

Hibernate: insert into stock (product_id, quantity, version) values (?, ?, ?)

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [100]

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [0]

2022-10-04 01:28:05.996 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

Hibernate: select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

2022-10-04 01:28:05.997 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.021 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : update stock set product_id=?, quantity=?, version=? where id=? and version=?

Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [99]

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [1]

2022-10-04 01:28:06.023 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]

2022-10-04 01:28:06.023 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [0]

2022-10-04 01:28:06.026 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : select version as version_ from stock where id =?

Hibernate: select version as version_ from stock where id =?

2022-10-04 01:28:06.026 DEBUG 7468 --- [pool-1-thread-1] org.hibernate.SQL : select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

Hibernate: select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

2022-10-04 01:28:06.027 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.027 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.030 DEBUG 7468 --- [pool-1-thread-1] org.hibernate.SQL : update stock set product_id=?, quantity=?, version=? where id=? and version=?

Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [99]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [1]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]

2022-10-04 01:28:06.032 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [0]

 

java spring 동시성

Câu trả lời 1

1

ecomin

죄송합니다 원인은 찾게 되었습니다.

facade 에 @Transaction 을 걸어 놨었네요 죄송합니다

0

169developer9973

다행입니다!

궁금한거 생기면 다시 질문주세요 :)

레디선 테스트코드에서 채널이름은 없어도 되는건가요?

0

136

2

낙관적 락을 사용할 떄 차이점

0

220

2

동시성 검증 코드에 관한 문의

0

180

2

단일연산

0

153

2

낙관적락vs. 레디스락

0

193

2

안녕하세요. 레디슨 질문있습니다..!!

0

150

2

@Lock(OPTIMISTIC)이 필요한 이유

0

179

2

get_lock 의 timeout이 3000초 이던데 너무 긴거 아닌가요?

0

206

2

DataSource Hikari 사용 이유

0

236

2

saveAndFlush 사용 이유 문의

0

201

3

비관적 락 VS 네임드 락

0

256

3

application.yaml 에 redis 정보

0

167

2

왜 클래스 이름에 Facade 가 붙나요?

0

249

2

@Transactional 으로 인한 동시성 문제 발생 원인이 궁금합니다.

0

291

2

@modifying 이용한 동시성 제어

0

249

2

DB락과 분산락

0

354

2

NamedLock 테스트 실패

0

249

2

테스트에서 트랜잭션 어노테이션 질문 있습니다.

0

241

2

optimistic Lock 재시도 질문입니다.

0

303

2

낙관적 락 테스트 실패

0

329

2

오류?

0

1762

4

LettureLockStockFacadeTest에서 오류가 발생합니다.

1

329

2

Pessimistic Lock 전체 테스트 오류 문의

0

464

3

비관적 락 vs 레디스(Lettuce)락 비교 관련 질문

0

538

2