add some log for sdb
This commit is contained in:
parent
249f54b1e4
commit
6ff5f373e2
|
@ -212,15 +212,16 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
|
||||||
|
|
||||||
static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
|
static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
|
||||||
tsSdbObj.code = code;
|
tsSdbObj.code = code;
|
||||||
sdbTrace("sdb forward request confirmed, result:%s", tstrerror(code));
|
|
||||||
sem_post(&tsSdbObj.sem);
|
sem_post(&tsSdbObj.sem);
|
||||||
|
sdbTrace("forward request confirmed, version:%" PRIu64 ", result:%s", (int64_t)param, tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t sdbForwardToPeer(void *pHead) {
|
static int32_t sdbForwardToPeer(SWalHead *pHead) {
|
||||||
if (tsSdbObj.sync == NULL) return TSDB_CODE_SUCCESS;
|
if (tsSdbObj.sync == NULL) return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, NULL);
|
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version);
|
||||||
if (code > 0) {
|
if (code > 0) {
|
||||||
|
sdbTrace("forward request is sent, version:%" PRIu64 ", result:%s", pHead->version, tstrerror(code));
|
||||||
sem_wait(&tsSdbObj.sem);
|
sem_wait(&tsSdbObj.sem);
|
||||||
return tsSdbObj.code;
|
return tsSdbObj.code;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +333,7 @@ void sdbIncRef(void *handle, void *pRow) {
|
||||||
SSdbTable *pTable = handle;
|
SSdbTable *pTable = handle;
|
||||||
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
||||||
atomic_add_fetch_32(pRefCount, 1);
|
atomic_add_fetch_32(pRefCount, 1);
|
||||||
if (0 && pTable->tableId == SDB_TABLE_CTABLE) {
|
if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) {
|
||||||
sdbTrace("table:%s, add ref to record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow),
|
sdbTrace("table:%s, add ref to record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow),
|
||||||
*pRefCount);
|
*pRefCount);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +345,7 @@ void sdbDecRef(void *handle, void *pRow) {
|
||||||
SSdbTable *pTable = handle;
|
SSdbTable *pTable = handle;
|
||||||
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
||||||
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
||||||
if (0 && pTable->tableId == SDB_TABLE_CTABLE) {
|
if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) {
|
||||||
sdbTrace("table:%s, def ref of record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow),
|
sdbTrace("table:%s, def ref of record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow),
|
||||||
*pRefCount);
|
*pRefCount);
|
||||||
}
|
}
|
||||||
|
@ -474,14 +475,18 @@ static int sdbWrite(void *param, void *data, int type) {
|
||||||
}
|
}
|
||||||
walFsync(tsSdbObj.wal);
|
walFsync(tsSdbObj.wal);
|
||||||
|
|
||||||
sdbForwardToPeer(pHead);
|
code = sdbForwardToPeer(pHead);
|
||||||
pthread_mutex_unlock(&tsSdbObj.mutex);
|
pthread_mutex_unlock(&tsSdbObj.mutex);
|
||||||
|
|
||||||
// from app, oper is created
|
// from app, oper is created
|
||||||
if (param != NULL) return code;
|
if (param != NULL) {
|
||||||
|
//sdbTrace("request from app is disposed, version:%" PRIu64 " code:%s", pHead->version, tstrerror(code));
|
||||||
// from wal or forward msg, should create oper
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
// from wal or forward msg, oper not created, should add into hash
|
||||||
if (tsSdbObj.sync != NULL) {
|
if (tsSdbObj.sync != NULL) {
|
||||||
|
sdbTrace("forward request is received, version:%" PRIu64 " result:%s, confirm it", pHead->version, tstrerror(code));
|
||||||
syncConfirmForward(tsSdbObj.sync, pHead->version, code);
|
syncConfirmForward(tsSdbObj.sync, pHead->version, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
|
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
|
||||||
|
|
||||||
print ============== step1
|
print ============== step1
|
||||||
system sh/exec_up.sh -n dnode1 -s start
|
system sh/exec_up.sh -n dnode1 -s start -t
|
||||||
sql connect
|
sql connect
|
||||||
|
|
||||||
sql show mnodes
|
sql show mnodes
|
||||||
|
@ -26,7 +26,7 @@ if $data3_3 != null then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print ============== step2
|
print ============== step2
|
||||||
system sh/exec_up.sh -n dnode2 -s start
|
system sh/exec_up.sh -n dnode2 -s start -t
|
||||||
sql create dnode $hostname2
|
sql create dnode $hostname2
|
||||||
sleep 8000
|
sleep 8000
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ if $dnode3Role != null then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print ============== step3
|
print ============== step3
|
||||||
system sh/exec_up.sh -n dnode3 -s start
|
system sh/exec_up.sh -n dnode3 -s start -t
|
||||||
sql create dnode $hostname3
|
sql create dnode $hostname3
|
||||||
sleep 8000
|
sleep 8000
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ sleep 3000
|
||||||
|
|
||||||
system sh/deploy.sh -n dnode2 -i 2
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
|
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
|
||||||
system sh/exec_up.sh -n dnode2 -s start
|
system sh/exec_up.sh -n dnode2 -s start -t
|
||||||
|
|
||||||
print ============== step5
|
print ============== step5
|
||||||
sql create dnode $hostname2
|
sql create dnode $hostname2
|
||||||
|
|
Loading…
Reference in New Issue