提交 6ff5f373 编写于 作者: S slguan

add some log for sdb

上级 249f54b1
......@@ -212,15 +212,16 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
tsSdbObj.code = code;
sdbTrace("sdb forward request confirmed, result:%s", tstrerror(code));
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;
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, NULL);
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version);
if (code > 0) {
sdbTrace("forward request is sent, version:%" PRIu64 ", result:%s", pHead->version, tstrerror(code));
sem_wait(&tsSdbObj.sem);
return tsSdbObj.code;
}
......@@ -332,7 +333,7 @@ void sdbIncRef(void *handle, void *pRow) {
SSdbTable *pTable = handle;
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
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),
*pRefCount);
}
......@@ -344,7 +345,7 @@ void sdbDecRef(void *handle, void *pRow) {
SSdbTable *pTable = handle;
int32_t * pRefCount = (int32_t *)(pRow + pTable->refCountPos);
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),
*pRefCount);
}
......@@ -474,14 +475,18 @@ static int sdbWrite(void *param, void *data, int type) {
}
walFsync(tsSdbObj.wal);
sdbForwardToPeer(pHead);
code = sdbForwardToPeer(pHead);
pthread_mutex_unlock(&tsSdbObj.mutex);
// from app, oper is created
if (param != NULL) return code;
// from wal or forward msg, should create oper
if (param != NULL) {
//sdbTrace("request from app is disposed, version:%" PRIu64 " code:%s", pHead->version, tstrerror(code));
return code;
}
// from wal or forward msg, oper not created, should add into hash
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);
}
......
......@@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
print ============== step1
system sh/exec_up.sh -n dnode1 -s start
system sh/exec_up.sh -n dnode1 -s start -t
sql connect
sql show mnodes
......@@ -26,7 +26,7 @@ if $data3_3 != null then
endi
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
sleep 8000
......@@ -49,7 +49,7 @@ if $dnode3Role != null then
endi
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
sleep 8000
......@@ -98,7 +98,7 @@ sleep 3000
system sh/deploy.sh -n dnode2 -i 2
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
sql create dnode $hostname2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册