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
44
app/src/py/dbio/py_account_dbio.pgc
Normal file
44
app/src/py/dbio/py_account_dbio.pgc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* py_account_dbio.pgc - 지급계좌(py_account) DB 접근 (libpydbio.a).
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <userlog.h>
|
||||
#include "py_dbio.h"
|
||||
|
||||
int pydb_account_check(const char *acct, char *status_out, long *balance_out)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_bal;
|
||||
char h_acct[32], h_status[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_acct, acct, sizeof(h_acct) - 1); h_acct[sizeof(h_acct)-1] = 0;
|
||||
|
||||
EXEC SQL SELECT status, balance INTO :h_status, :h_bal
|
||||
FROM py_account WHERE account_no = :h_acct;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("pydb_account_check FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
strncpy(status_out, h_status, 7); status_out[7] = 0;
|
||||
*balance_out = h_bal;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pydb_account_add(const char *acct, long delta)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_delta = delta;
|
||||
char h_acct[32];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_acct, acct, sizeof(h_acct) - 1); h_acct[sizeof(h_acct)-1] = 0;
|
||||
|
||||
EXEC SQL UPDATE py_account SET balance = balance + :h_delta, updated_at = now()
|
||||
WHERE account_no = :h_acct;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("pydb_account_add FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
26
app/src/py/dbio/py_dbio.h
Normal file
26
app/src/py/dbio/py_dbio.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* py_dbio.h - py 모듈 (지급) DB 접근 계층 (libpydbio.a).
|
||||
* ECPG (EXEC SQL) functions compiled into a static library and linked into
|
||||
* py_svr and the py 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 = ok, -1 = SQL error (caller may also inspect sqlca).
|
||||
*/
|
||||
#ifndef PY_DBIO_H
|
||||
#define PY_DBIO_H
|
||||
|
||||
/* payout */
|
||||
long pydb_next_payout_id(void);
|
||||
int pydb_insert_payout(long payout_id, const char *merch, const char *acct, long amount,
|
||||
long fee, long net, const char *status, const char *channel,
|
||||
const char *bizdate);
|
||||
int pydb_update_status(long payout_id, const char *status);
|
||||
int pydb_get_status(long payout_id, char *out /* >= 2 bytes */);
|
||||
int pydb_set_file(long payout_id, long file_id, const char *status);
|
||||
int pydb_upsert_summary(const char *merch, const char *bizdate, long cnt, long amount);
|
||||
long pydb_insert_adjust(long payout_id, long delta, const char *reason, const char *bizdate);
|
||||
|
||||
/* account */
|
||||
int pydb_account_check(const char *acct, char *status_out /* >= 8 */, long *balance_out);
|
||||
int pydb_account_add(const char *acct, long delta);
|
||||
|
||||
#endif /* PY_DBIO_H */
|
||||
144
app/src/py/dbio/py_payout_dbio.pgc
Normal file
144
app/src/py/dbio/py_payout_dbio.pgc
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* py_payout_dbio.pgc - 지급(payout)/조정/집계 DB 접근 (libpydbio.a).
|
||||
* ECPG functions; run on the caller's XA branch. No EXEC SQL CONNECT.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <userlog.h>
|
||||
#include "py_dbio.h"
|
||||
|
||||
long pydb_next_payout_id(void)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL SELECT nextval('py_payout_seq') INTO :h_id;
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("pydb_next_payout_id FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_id;
|
||||
}
|
||||
|
||||
int pydb_insert_payout(long payout_id, const char *merch, const char *acct, long amount,
|
||||
long fee, long net, const char *status, const char *channel,
|
||||
const char *bizdate)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id = payout_id, h_amount = amount, h_fee = fee, h_net = net;
|
||||
char h_merch[64], h_acct[32], h_status[8], h_channel[16], h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_merch, merch, sizeof(h_merch) - 1); h_merch[sizeof(h_merch)-1] = 0;
|
||||
strncpy(h_acct, acct, sizeof(h_acct) - 1); h_acct[sizeof(h_acct)-1] = 0;
|
||||
strncpy(h_status, status, sizeof(h_status) - 1); h_status[sizeof(h_status)-1] = 0;
|
||||
strncpy(h_channel, channel, sizeof(h_channel) - 1); h_channel[sizeof(h_channel)-1] = 0;
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1); h_bizdate[sizeof(h_bizdate)-1] = 0;
|
||||
|
||||
EXEC SQL INSERT INTO py_payout
|
||||
(payout_id, merchant_id, account_no, amount, fee, net, status, channel, biz_date)
|
||||
VALUES (:h_id, :h_merch, :h_acct, :h_amount, :h_fee, :h_net, :h_status, :h_channel, :h_bizdate);
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("pydb_insert_payout FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pydb_update_status(long payout_id, const char *status)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id = payout_id;
|
||||
char h_status[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_status, status, sizeof(h_status) - 1); h_status[sizeof(h_status)-1] = 0;
|
||||
|
||||
EXEC SQL UPDATE py_payout SET status = :h_status, updated_at = now()
|
||||
WHERE payout_id = :h_id;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("pydb_update_status FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pydb_get_status(long payout_id, char *out)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id = payout_id;
|
||||
char h_status[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
EXEC SQL SELECT status INTO :h_status FROM py_payout WHERE payout_id = :h_id;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("pydb_get_status FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
out[0] = h_status[0];
|
||||
out[1] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pydb_set_file(long payout_id, long file_id, const char *status)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id = payout_id, h_file = file_id;
|
||||
char h_status[8];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_status, status, sizeof(h_status) - 1); h_status[sizeof(h_status)-1] = 0;
|
||||
|
||||
EXEC SQL UPDATE py_payout SET file_id = :h_file, status = :h_status, updated_at = now()
|
||||
WHERE payout_id = :h_id;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) {
|
||||
userlog("pydb_set_file FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pydb_upsert_summary(const char *merch, const char *bizdate, long cnt, long amount)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cnt = cnt, h_amt = amount;
|
||||
char h_merch[64], h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_merch, merch, sizeof(h_merch) - 1); h_merch[sizeof(h_merch)-1] = 0;
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1); h_bizdate[sizeof(h_bizdate)-1] = 0;
|
||||
|
||||
EXEC SQL INSERT INTO py_summary (merchant_id, biz_date, payout_count, payout_amount)
|
||||
VALUES (:h_merch, :h_bizdate, :h_cnt, :h_amt)
|
||||
ON CONFLICT (merchant_id, biz_date) DO UPDATE
|
||||
SET payout_count = py_summary.payout_count + EXCLUDED.payout_count,
|
||||
payout_amount = py_summary.payout_amount + EXCLUDED.payout_amount,
|
||||
updated_at = now();
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("pydb_upsert_summary FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long pydb_insert_adjust(long payout_id, long delta, const char *reason, const char *bizdate)
|
||||
{
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_id, h_pay = payout_id, h_delta = delta;
|
||||
char h_reason[128], h_bizdate[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
strncpy(h_reason, reason, sizeof(h_reason) - 1); h_reason[sizeof(h_reason)-1] = 0;
|
||||
strncpy(h_bizdate, bizdate, sizeof(h_bizdate) - 1); h_bizdate[sizeof(h_bizdate)-1] = 0;
|
||||
|
||||
EXEC SQL SELECT nextval('py_adjust_seq') INTO :h_id;
|
||||
if (sqlca.sqlcode < 0) return -1;
|
||||
|
||||
EXEC SQL INSERT INTO py_adjust (adj_id, payout_id, delta, reason, biz_date)
|
||||
VALUES (:h_id, :h_pay, :h_delta, :h_reason, :h_bizdate);
|
||||
if (sqlca.sqlcode < 0) {
|
||||
userlog("pydb_insert_adjust FAIL [%d] %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
return -1;
|
||||
}
|
||||
return h_id;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue