Phase 2b: 11개 모듈 전량 실동작 (333 서비스, 전서버 부팅)

- 10개 모듈 추가/확장(au py rc st lg cl mm vl mg cm), 각 30 서비스 = 330 + tmsrv
- build.sh 자동발견으로 11 모듈서버 + dbio 라이브러리 23 + 배치 22 빌드
- schema.d 11파일 → 75 테이블, 모듈별 disjoint
- 부팅 리소스 규명: fs.mqueue.queues_max=8192(330큐>256), NDRX_MSGSIZEMAX 16000·
  MSGMAX 50(큐당 5.6MB→0.8MB), msgqueue ulimit 2GB → 전 12서버 runok
- 검증: xadmin psc 333 AVAIL, 매입체인 XA 커밋, prepared_xacts=0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
forge-bot 2026-07-19 09:58:39 +00:00
parent 8219b85f14
commit bec83c721e
73 changed files with 10705 additions and 35 deletions

111
db/schema.d/20-au.sql Normal file
View file

@ -0,0 +1,111 @@
-- au 모듈 (승인/한도) 스키마 - 승인 원장 / 카드 한도 / 부정거래 / 예비승인 / 집계
-- Loaded into PostgreSQL on first boot (docker-entrypoint-initdb.d). Prefix 20.
-- ---------------------------------------------------------------------------
-- 승인 원장 (authorization)
-- status: A=승인, D=거절, C=취소, R=역전, H=보류, M=매입확정(capture),
-- S=정산반영, V=무효(void)
-- ---------------------------------------------------------------------------
CREATE SEQUENCE IF NOT EXISTS au_auth_seq;
CREATE TABLE IF NOT EXISTS au_authorization (
auth_id BIGINT PRIMARY KEY,
card_no TEXT NOT NULL,
merchant_id TEXT NOT NULL DEFAULT '',
amount BIGINT NOT NULL,
approval_code TEXT NOT NULL DEFAULT '',
auth_type TEXT NOT NULL DEFAULT 'AUTH', -- AUTH/STANDIN/INSTALL/PREAUTH
status TEXT NOT NULL,
decline_reason TEXT NOT NULL DEFAULT '',
biz_date DATE NOT NULL,
captured_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 카드 한도 (card_limit)
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS card_limit (
card_no TEXT PRIMARY KEY,
daily_limit BIGINT NOT NULL DEFAULT 1000000,
used_amount BIGINT NOT NULL DEFAULT 0,
temp_limit BIGINT NOT NULL DEFAULT 0,
status TEXT NOT NULL DEFAULT 'ACTIVE',
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 부정거래 로그 (fraud_log)
-- ---------------------------------------------------------------------------
CREATE SEQUENCE IF NOT EXISTS au_fraud_seq;
CREATE TABLE IF NOT EXISTS au_fraud_log (
fraud_id BIGINT PRIMARY KEY,
auth_id BIGINT NOT NULL DEFAULT 0,
card_no TEXT NOT NULL,
score BIGINT NOT NULL,
reason TEXT NOT NULL DEFAULT '',
biz_date DATE NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 블랙리스트 (au_blacklist)
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS au_blacklist (
card_no TEXT PRIMARY KEY,
reason TEXT NOT NULL DEFAULT '',
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 예비승인 (au_preauth) - status: P=예비, C=확정, X=취소
-- ---------------------------------------------------------------------------
CREATE SEQUENCE IF NOT EXISTS au_preauth_seq;
CREATE TABLE IF NOT EXISTS au_preauth (
preauth_id BIGINT PRIMARY KEY,
card_no TEXT NOT NULL,
merchant_id TEXT NOT NULL DEFAULT '',
amount BIGINT NOT NULL,
status TEXT NOT NULL DEFAULT 'P',
biz_date DATE NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 승인 취소 (au_cancel) - FULL / PARTIAL / VOID
-- ---------------------------------------------------------------------------
CREATE SEQUENCE IF NOT EXISTS au_cancel_seq;
CREATE TABLE IF NOT EXISTS au_cancel (
cancel_id BIGINT PRIMARY KEY,
auth_id BIGINT NOT NULL,
cancel_type TEXT NOT NULL,
amount BIGINT NOT NULL,
reason TEXT NOT NULL DEFAULT '',
biz_date DATE NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- ---------------------------------------------------------------------------
-- 가맹점 일별 승인 집계 (au_summary) - 배치/서비스가 채움
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS au_summary (
merchant_id TEXT NOT NULL,
biz_date DATE NOT NULL,
auth_count BIGINT NOT NULL DEFAULT 0,
approve_count BIGINT NOT NULL DEFAULT 0,
decline_count BIGINT NOT NULL DEFAULT 0,
auth_amount BIGINT NOT NULL DEFAULT 0,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (merchant_id, biz_date)
);
-- Seed card limits + a blacklist entry so AUTH/LIMIT services have counterparties.
INSERT INTO card_limit (card_no, daily_limit, used_amount) VALUES
('4000123412341234', 1000000, 0),
('5100123412341234', 2000000, 0),
('3400123412341234', 5000000, 0)
ON CONFLICT (card_no) DO NOTHING;
INSERT INTO au_blacklist (card_no, reason) VALUES
('4000999999999999', 'REPORTED_STOLEN')
ON CONFLICT (card_no) DO NOTHING;