naver / arcus-spring

ARCUS as a caching provider for the Spring Cache Abstraction
Apache License 2.0
26 stars 16 forks source link

INTERNAL: Add operation status message to log when operation is not successful. #80

Closed uhm0311 closed 5 months ago

uhm0311 commented 5 months ago

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

uhm0311 commented 5 months ago

OperationStatus์˜ StatusCode์— ๋”ฐ๋ผ ๋กœ๊ทธ ๋ ˆ๋ฒจ์„ ๋‹ค๋ฅด๊ฒŒ ์ถœ๋ ฅํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

oliviarla commented 5 months ago

@uhm0311 java client API์˜ add, delete, set, asyncGet, flush์—์„œ ๊ฐ๊ฐ ์„ฑ๊ณตํ•˜์ง€ ์•Š์•˜์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์ƒํƒœ ์ฝ”๋“œ๋ฅผ ๊ฐ„๋‹จํžˆ ์ •๋ฆฌํ•ด์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”?

๋ฐœ์ƒ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ ์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ณด๊ณ  ํŠน์ • ์กฐ๊ฑด์ผ ๋•Œ์—๋งŒ ๋กœ๊น…์„ ๋‚จ๊ธฐ๋Š” ๊ฒƒ์ด ์–ด๋–ค๊ฐ€์š”? ์˜ˆ๋ฅผ ๋“ค์–ด java client์˜ add ๋ฉ”์„œ๋“œ๋Š” StatusCode.ERR_NOT_STORED ์™ธ์— ๋ฐœ์ƒ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ ์ฝ”๋“œ๊ฐ€ ์—†์–ด๋ณด์ด๋Š”๋ฐ, ์‚ฌ์šฉ์ž๊ฐ€ putIfAbsent๋ฅผ ํ˜ธ์ถœํ•˜์˜€๋‹ค๋ฉด ์˜๋„๋ฅผ ์ถฉ๋ถ„ํžˆ ์ดํ•ดํ•˜๊ณ  ์žˆ์„ ๊ฒƒ์ด๊ณ  ๋”ฐ๋ผ์„œ logging ํ•˜์ง€ ์•Š์•„๋„ ๋˜๋Š” ์ •๋ณด๋ผ๋Š” ์ƒ๊ฐ์ด ๋“ญ๋‹ˆ๋‹ค.

๋‹ค์–‘ํ•œ ์ผ€์ด์Šค๋ฅผ ๊ณ ๋ คํ•˜๋‹ค๋ณด๋‹ˆ ํ˜„์žฌ ์ฝ”๋“œ๋Š” ๊ฐ„๋‹จํ•œ ๋กœ๊น… ์ž‘์—…์ž„์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ํ•œ๋ˆˆ์— ๋ณด๊ณ  ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ ํ•˜์œ„ ํ˜ธํ™˜์„ฑ์œผ๋กœ ๋ฐ›์•„๋“ค์ด๋Š” ์ƒํƒœ ์ฝ”๋“œ๊ฐ€ ๋ฒ„์ „๋งˆ๋‹ค ๋‹ค๋ฅด๋‹ค๋ฉด ์–ด์ฉ” ์ˆ˜ ์—†์ด ์ด ํ˜•ํƒœ๋กœ ๊ตฌํ˜„ํ•ด์•ผ ํ•  ๊ฒƒ ๊ฐ™๊ธด ํ•ฉ๋‹ˆ๋‹ค.

uhm0311 commented 5 months ago

์„œ๋ฒ„ ์‘๋‹ต ๋ชจ์Œ

CLIENT_ERROR, SERVER_ERROR์™€ ๊ฐ™์€ ์—๋Ÿฌ๋Š” ์—†๋Š” ๊ฒฝ์šฐ์˜ ์‘๋‹ต์ž…๋‹ˆ๋‹ค.

get

ํ‚ค ์กด์žฌ ์—ฌ๋ถ€์— ๊ด€๊ณ„ ์—†์ด END, ์„ฑ๊ณต

add

STORED, ๊ฐ’ ์ €์žฅ ์™„๋ฃŒ, ์„ฑ๊ณต NOT_STORED, ํ‚ค๊ฐ€ ์ด๋ฏธ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ์‹คํŒจ

delete

DELETED, ๊ฐ’ ์ œ๊ฑฐ ์™„๋ฃŒ, ์„ฑ๊ณต NOT_FOUND, ํ‚ค๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, ์‹คํŒจ

flush

OK, Prefix๊ฐ€ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ, ์„ฑ๊ณต NOT_FOUND, Prefix๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, ์„ฑ๊ณต

๋ฌด์กฐ๊ฑด ๋กœ๊น…ํ•˜๋Š” ์ด์œ 

evict ์‹คํŒจ ์›์ธ์— ๋Œ€ํ•œ ๋ฌธ์˜๊ฐ€ ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋กœ๊ทธ๋ฅผ ํ†ตํ•ด NOT_FOUND์ด๋ฉด ์บ์‹œ ํ‚ค๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๋ฆฌ๊ธฐ ์œ„ํ•จ์ž…๋‹ˆ๋‹ค.

jhpark816 commented 5 months ago

@oliviarla @brido4125 ์ด ์ž‘์—…์ด ์šฐ์„ ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜์–ด์•ผ ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

uhm0311 commented 5 months ago

@brido4125

Mockito์™€ ๊ฐ™์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์˜ ๋ฒ„์ „ ๋ฌธ์ œ์ธ์ง€๋Š” ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ TestLogger ํด๋ž˜์Šค ์—†์ด๋Š” ๋กœ๊ทธ ๋ฉ”์„ธ์ง€๋ฅผ ๊ฒ€์ฆํ•  ์ข‹์€ ๋ฐฉ๋ฒ•์ด ์—†์–ด์„œ ๋กœ๊ทธ ๋ฉ”์„ธ์ง€๋ฅผ ์ถœ๋ ฅํ•˜์ง€ ์•Š๊ณ  ๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅํ•ด๋‘๋Š” TestLogger ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

oliviarla commented 5 months ago

์ €๋Š” ๋‹จ์ˆœํ•œ ๋กœ๊น… ๊ธฐ๋Šฅ์— ํ…Œ์ŠคํŠธ์ฝ”๋“œ๊นŒ์ง€ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ์˜๋ฏธ๊ฐ€ ์žˆ๋Š”์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ๋Š”๋ฐ, @uhm0311 ๋‹˜์€ ํ…Œ์ŠคํŠธ์ฝ”๋“œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค๊ณ  ๋ณด์‹œ๋‚˜์š”?

jhpark816 commented 5 months ago

@oliviarla ๋‚ด ๋ฆฌ๋ทฐ ์˜๊ฒฌ์„ ๋ณด๊ณ  ๋‹ค๋ฅธ ์˜๊ฒฌ์ด ์žˆ๋‹ค๋ฉด ์•Œ๋ ค์ฃผ์„ธ์š”.

uhm0311 commented 5 months ago

@jhpark816

๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

jhpark816 commented 5 months ago

@oliviarla @brido4125 ๋ฆฌ๋ทฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.