minor changes

This commit is contained in:
Shengliang Guan 2022-01-07 23:03:06 -08:00
parent a973ad3ff4
commit c2eadc2706
3 changed files with 11 additions and 6 deletions

View File

@ -32,6 +32,8 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SVnode SVnode;
typedef struct SVnodeCfg {
int32_t vgId;
/** vnode buffer pool options */
struct {
/** write buffer size */

View File

@ -412,7 +412,10 @@ static void *dnodeOpenVnodeFunc(void *param) {
pMgmt->openVnodes, pMgmt->totalVnodes);
dndReportStartup(pDnode, "open-vnodes", stepDesc);
SVnode *pImpl = vnodeOpen(pCfg->path, NULL);
SVnodeCfg vnodeCfg = {0};
vnodeCfg.vgId = pCfg->vgId;
SVnode *pImpl = vnodeOpen(pCfg->path, &vnodeCfg);
if (pImpl == NULL) {
dError("vgId:%d, failed to open vnode by thread:%d", pCfg->vgId, pThread->threadIndex);
pThread->failed++;
@ -550,6 +553,7 @@ static SCreateVnodeMsg *dndParseCreateVnodeReq(SRpcMsg *rpcMsg) {
}
static void dndGenerateVnodeCfg(SCreateVnodeMsg *pCreate, SVnodeCfg *pCfg) {
pCfg->vgId = pCreate->vgId;
pCfg->wsize = pCreate->cacheBlockSize;
pCfg->ssize = pCreate->cacheBlockSize;
pCfg->wsize = pCreate->cacheBlockSize;
@ -610,7 +614,7 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) {
return 0;
}
SVnode *pImpl = vnodeOpen(wrapperCfg.path, NULL /*pCfg*/);
SVnode *pImpl = vnodeOpen(wrapperCfg.path, &vnodeCfg);
if (pImpl == NULL) {
return -1;
}

View File

@ -20,13 +20,12 @@ static void vnodeFree(SVnode *pVnode);
static int vnodeOpenImpl(SVnode *pVnode);
static void vnodeCloseImpl(SVnode *pVnode);
SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfgInput) {
SVnode *pVnode = NULL;
// Set default options
if (pVnodeCfg == NULL) {
pVnodeCfg = &defaultVnodeOptions;
}
SVnodeCfg *pVnodeCfg = &defaultVnodeOptions;
pVnodeCfg->vgId = pVnodeCfg->vgId;
// Validate options
if (vnodeValidateOptions(pVnodeCfg) < 0) {