-
Notifications
You must be signed in to change notification settings - Fork 3
Fix/dynamo remove undefinded value #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/dynamo remove undefinded value #192
Conversation
…ing and add comprehensive tests
…nsure correct mapping of ids to _ids
steve-lemon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@claire-lemon proxy-storage 에서 my_parallel() 이용과 mget() 의 동질성 검증 강화해줘요. |
aiden-lemon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; 확인했습니다!
steve-lemon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| result.failed = (res.failed || []).map(toModel); | ||
| const res = await this.$dynamo.mupdateItem(items);ß | ||
| result.success = (res.success as unknown as T[]) || []; | ||
| result.failed = (res.failed as unknown as T[]) || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE! failed 가 발생하면 안됨! 만일 그렇다면 명시적인 경우에만 retry 로직 필요함. 그 외에는 모두 throw 해줘야 이후 알수 있음
PR Description
개요
fix/dynamo-remove-undefinded-valueDynamoDB 배치 업데이트 시 발생하는 undefined 값 처리 및 ID 매핑 오류를 수정했습니다.
개선 내용
1. Undefined 값 처리 문제
문제 상황
undefined값을 허용하지 않음undefined값이 저장 시 에러 발생activateToken,activateTokenTs등의 필드에undefined포함수정 내용
AbstractService (
abstract-service.ts)removeUndefined()재귀 함수 추가undefined제거undefined필터링onlyValid !== false옵션일 때 자동으로 undefined 제거saveAllUpdates 테스트 추가 (
abstract-service.spec.ts)onlyValid: false→ 에러 발생 검증onlyValid: true→ undefined 필터링 검증2. 배치 모드 ID 매핑 오류
문제 상황
증상
saveAllUpdates({ useBatch: true })사용 시 데이터 저장/조회 실패name,test등의 필드가undefined로 조회됨원인
child-batch-100-50)와 full partition key (TT:test:child-batch-100-50) 혼선DynamoService.mupdateItem()에서 잘못된 partition key 사용instance()호출 시 타입을 지정하지 않으면 dummy storage로 테스트됨수정 내용
DynamoService (
dynamo-service.ts)mupdateItem()에서actualId로직 추가_id)를 우선 사용하도록 수정ProxyStorageService (
proxy-storage-service.ts)idMap도입: short id → full _id 매핑 관계 저장mupdate()결과 반환 시 올바른 full _id로 복원AbstractProxy (
abstract-service.ts)배치 모드에서 전체 모델을 전달하는 이유
BatchWriteItemAPI는UpdateRequest를 지원하지 않음PutRequest를 사용해야 함PutRequest는 항목 전체를 덮어쓰기하므로 전체 모델이 필요테스트 코드 개선
instance()→ dummy storage 사용instance('real')→ 실제 DynamoDB 사용_id검증을 full partition key 형태로 수정성능 테스트
coverage/perf-child-replication-*.json)