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:
parent
8219b85f14
commit
bec83c721e
73 changed files with 10705 additions and 35 deletions
92
app/src/vl/dbio/vl_check_dbio.pgc
Normal file
92
app/src/vl/dbio/vl_check_dbio.pgc
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* vl_check_dbio.pgc - 의심거래 적재 + 검증 로그 기록 (libvldbio.a).
|
||||
* ECPG functions; run on the caller's XA branch. No EXEC SQL CONNECT.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <userlog.h>
|
||||
#include "vl_dbio.h"
|
||||
|
||||
long vldb_next_suspect_id(void)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL SELECT nextval('vl_suspect_seq') INTO :h_id;
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("vldb_next_suspect_id FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_id;
|
||||
}
|
||||
|
||||
long vldb_insert_suspect(long purchase_id, const char *rule_code,
|
||||
const char *severity, const char *detail,
|
||||
const char *bizdate)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id, h_pid = purchase_id;
|
||||
char h_rule[32], h_sev[8], h_detail[128], h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_rule, rule_code, sizeof(h_rule) - 1); h_rule[sizeof(h_rule)-1] = 0;
|
||||
strncpy(h_sev, severity, sizeof(h_sev) - 1); h_sev[sizeof(h_sev)-1] = 0;
|
||||
strncpy(h_detail, detail, sizeof(h_detail) - 1); h_detail[sizeof(h_detail)-1] = 0;
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1);h_bizdate[sizeof(h_bizdate)-1]= 0;
|
||||
|
||||
EXEC SQL SELECT nextval('vl_suspect_seq') INTO :h_id;
|
||||
if (sqlca.sqlcode < 0) return -1;
|
||||
|
||||
EXEC SQL INSERT INTO vl_suspect
|
||||
(suspect_id, purchase_id, rule_code, severity, detail, biz_date)
|
||||
VALUES (:h_id, :h_pid, :h_rule, :h_sev, :h_detail, :h_bizdate);
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("vldb_insert_suspect FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_id;
|
||||
}
|
||||
|
||||
long vldb_insert_check_log(const char *check_type, long target_id,
|
||||
long result_code, const char *detail,
|
||||
const char *bizdate)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id, h_target = target_id, h_rc = result_code;
|
||||
char h_type[32], h_detail[128], h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_type, check_type, sizeof(h_type) - 1); h_type[sizeof(h_type)-1] = 0;
|
||||
strncpy(h_detail, detail, sizeof(h_detail) - 1);h_detail[sizeof(h_detail)-1] = 0;
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1);h_bizdate[sizeof(h_bizdate)-1]= 0;
|
||||
|
||||
EXEC SQL SELECT nextval('vl_checklog_seq') INTO :h_id;
|
||||
if (sqlca.sqlcode < 0) return -1;
|
||||
|
||||
EXEC SQL INSERT INTO vl_check_log
|
||||
(log_id, check_type, target_id, result_code, detail, biz_date)
|
||||
VALUES (:h_id, :h_type, :h_target, :h_rc, :h_detail, :h_bizdate);
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("vldb_insert_check_log FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_id;
|
||||
}
|
||||
|
||||
long vldb_suspect_count(const char *bizdate)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cnt;
|
||||
char h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1); h_bizdate[sizeof(h_bizdate)-1] = 0;
|
||||
|
||||
EXEC SQL SELECT count(*) INTO :h_cnt FROM vl_suspect
|
||||
WHERE biz_date = :h_bizdate AND status = 'OPEN';
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("vldb_suspect_count FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_cnt;
|
||||
}
|
||||
27
app/src/vl/dbio/vl_dbio.h
Normal file
27
app/src/vl/dbio/vl_dbio.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* vl_dbio.h - vl 모듈 (정합성검증/validation) DB 접근 계층 (libvldbio.a).
|
||||
* ECPG (EXEC SQL) functions compiled into a static library and linked into
|
||||
* vl_svr and the vl batches. They run on the caller's XA branch/connection
|
||||
* (no EXEC SQL CONNECT); sqlca is the shared per-thread ECPG SQLCA.
|
||||
* Return convention: 0/>=0 = ok, -1 = SQL error (caller may also inspect sqlca).
|
||||
*/
|
||||
#ifndef VL_DBIO_H
|
||||
#define VL_DBIO_H
|
||||
|
||||
/* 의심거래/검증로그 (vl_check_dbio) */
|
||||
long vldb_next_suspect_id(void);
|
||||
long vldb_insert_suspect(long purchase_id, const char *rule_code,
|
||||
const char *severity, const char *detail,
|
||||
const char *bizdate);
|
||||
long vldb_insert_check_log(const char *check_type, long target_id,
|
||||
long result_code, const char *detail,
|
||||
const char *bizdate);
|
||||
long vldb_suspect_count(const char *bizdate);
|
||||
|
||||
/* 검증규칙 (vl_rule_dbio) */
|
||||
int vldb_get_rule(const char *rule_code, long *threshold_out,
|
||||
char *severity_out /* >= 8 */);
|
||||
int vldb_upsert_rule(const char *rule_code, const char *rule_name,
|
||||
long threshold, const char *severity);
|
||||
|
||||
#endif /* VL_DBIO_H */
|
||||
51
app/src/vl/dbio/vl_rule_dbio.pgc
Normal file
51
app/src/vl/dbio/vl_rule_dbio.pgc
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* vl_rule_dbio.pgc - 검증 규칙 조회 + 등록 (libvldbio.a).
|
||||
* ECPG functions; run on the caller's XA branch. No EXEC SQL CONNECT.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <userlog.h>
|
||||
#include "vl_dbio.h"
|
||||
|
||||
int vldb_get_rule(const char *rule_code, long *threshold_out, char *severity_out)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_thr;
|
||||
char h_rule[32], h_sev[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_rule, rule_code, sizeof(h_rule) - 1); h_rule[sizeof(h_rule)-1] = 0;
|
||||
|
||||
EXEC SQL SELECT threshold, severity INTO :h_thr, :h_sev
|
||||
FROM vl_rule WHERE rule_code = :h_rule AND status = 'ACTIVE';
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("vldb_get_rule FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
*threshold_out = h_thr;
|
||||
strncpy(severity_out, h_sev, 7); severity_out[7] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vldb_upsert_rule(const char *rule_code, const char *rule_name,
|
||||
long threshold, const char *severity)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_thr = threshold;
|
||||
char h_rule[32], h_name[64], h_sev[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_rule, rule_code, sizeof(h_rule) - 1); h_rule[sizeof(h_rule)-1] = 0;
|
||||
strncpy(h_name, rule_name, sizeof(h_name) - 1); h_name[sizeof(h_name)-1] = 0;
|
||||
strncpy(h_sev, severity, sizeof(h_sev) - 1); h_sev[sizeof(h_sev)-1] = 0;
|
||||
|
||||
EXEC SQL INSERT INTO vl_rule (rule_code, rule_name, threshold, severity)
|
||||
VALUES (:h_rule, :h_name, :h_thr, :h_sev)
|
||||
ON CONFLICT (rule_code) DO UPDATE
|
||||
SET rule_name = EXCLUDED.rule_name, threshold = EXCLUDED.threshold,
|
||||
severity = EXCLUDED.severity, updated_at = now();
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("vldb_upsert_rule FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue