Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f06e25fe
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f06e25fe
编写于
11月 29, 2019
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/mergeimport
上级
92e5e239
a5a1b0ee
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
353 addition
and
248 deletion
+353
-248
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+1
-1
src/client/src/tscJoinProcess.c
src/client/src/tscJoinProcess.c
+8
-4
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+2
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+2
-2
src/inc/tutil.h
src/inc/tutil.h
+5
-3
src/modules/http/inc/httpHandle.h
src/modules/http/inc/httpHandle.h
+3
-1
src/modules/http/src/httpAuth.c
src/modules/http/src/httpAuth.c
+2
-0
src/modules/http/src/httpSession.c
src/modules/http/src/httpSession.c
+33
-15
src/modules/http/src/httpSql.c
src/modules/http/src/httpSql.c
+1
-3
src/os/darwin/inc/os.h
src/os/darwin/inc/os.h
+1
-1
src/os/linux/inc/os.h
src/os/linux/inc/os.h
+2
-1
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+4
-4
src/system/detail/inc/vnodeRead.h
src/system/detail/inc/vnodeRead.h
+28
-29
src/system/detail/src/vnodeCommit.c
src/system/detail/src/vnodeCommit.c
+2
-2
src/system/detail/src/vnodeFile.c
src/system/detail/src/vnodeFile.c
+9
-1
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+236
-169
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+14
-11
未找到文件。
src/client/src/tscFunctionImpl.c
浏览文件 @
f06e25fe
...
...
@@ -3191,7 +3191,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
} else { \
*(type *)(ctx)->aOutputBuf = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64Key)); \
*(type *)(&(ctx)->param[1].i64Key) = *(type *)(d); \
*(int64_t *)(ctx)->ptsOutputBuf =
*(int64_t *)((ctx)->ptsList + (TSDB_KEYSIZE)*index);
\
*(int64_t *)(ctx)->ptsOutputBuf =
(ctx)->ptsList[index];
\
} \
} while (0);
...
...
src/client/src/tscJoinProcess.c
浏览文件 @
f06e25fe
...
...
@@ -1203,16 +1203,20 @@ bool tsBufNextPos(STSBuf* pTSBuf) {
if
(
pCur
->
vnodeIndex
==
-
1
)
{
if
(
pCur
->
order
==
TSQL_SO_ASC
)
{
tsBufGetBlock
(
pTSBuf
,
0
,
0
);
// list is empty
if
(
pTSBuf
->
block
.
numOfElem
==
0
)
{
if
(
pTSBuf
->
block
.
numOfElem
==
0
)
{
// the whole list is empty, return
tsBufResetPos
(
pTSBuf
);
return
false
;
}
else
{
return
true
;
}
}
else
{
}
else
{
// get the last timestamp record in the last block of the last vnode
assert
(
pTSBuf
->
numOfVnodes
>
0
);
int32_t
vnodeIndex
=
pTSBuf
->
numOfVnodes
-
1
;
pCur
->
vnodeIndex
=
vnodeIndex
;
int32_t
vnodeId
=
pTSBuf
->
pData
[
pCur
->
vnodeIndex
].
info
.
vnode
;
STSVnodeBlockInfo
*
pBlockInfo
=
tsBufGetVnodeBlockInfo
(
pTSBuf
,
vnodeId
);
int32_t
blockIndex
=
pBlockInfo
->
numOfBlocks
-
1
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
f06e25fe
...
...
@@ -155,7 +155,8 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload,
int64_t
iv
;
int32_t
numType
;
char
*
endptr
=
NULL
;
errno
=
0
;
// clear the previous existed error information
switch
(
pSchema
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
{
// bool
if
((
pToken
->
type
==
TK_BOOL
||
pToken
->
type
==
TK_STRING
)
&&
(
pToken
->
n
!=
0
))
{
...
...
src/client/src/tscSql.c
浏览文件 @
f06e25fe
...
...
@@ -64,8 +64,8 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
#ifdef CLUSTER
if
(
ip
&&
ip
[
0
])
{
strcpy
(
tscMgmtIpList
.
ipstr
[
0
],
ip
);
tscMgmtIpList
.
ip
[
0
]
=
inet_addr
(
ip
);
strcpy
(
tscMgmtIpList
.
ipstr
[
1
],
ip
);
tscMgmtIpList
.
ip
[
1
]
=
inet_addr
(
ip
);
}
#else
if
(
ip
&&
ip
[
0
])
{
...
...
src/inc/tutil.h
浏览文件 @
f06e25fe
...
...
@@ -26,12 +26,14 @@ extern "C" {
#include "tsdb.h"
#ifndef STDERR_FILENO
#define VALIDFD(x) ((x) > 2)
#else
#define VALIDFD(x) ((x) > STDERR_FILENO)
#define STDERR_FILENO (2)
#endif
#define FD_VALID(x) ((x) > STDERR_FILENO)
#define FD_INITIALIZER ((int32_t)-1)
#define WCHAR wchar_t
#define tfree(x) \
{ \
if (x) { \
...
...
src/modules/http/inc/httpHandle.h
浏览文件 @
f06e25fe
...
...
@@ -68,6 +68,8 @@
#define HTTP_COMPRESS_IDENTITY 0
#define HTTP_COMPRESS_GZIP 2
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN * 2 + 1)
typedef
enum
{
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_HANDLING
,
...
...
@@ -83,7 +85,7 @@ typedef struct {
int
expire
;
int
access
;
void
*
taos
;
char
id
[
TSDB_USER_LEN
];
char
id
[
HTTP_SESSION_ID_LEN
+
1
];
}
HttpSession
;
typedef
enum
{
...
...
src/modules/http/src/httpAuth.c
浏览文件 @
f06e25fe
...
...
@@ -50,6 +50,7 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) {
return
false
;
}
strncpy
(
pContext
->
user
,
base64
,
(
size_t
)
user_len
);
pContext
->
user
[
user_len
]
=
0
;
char
*
password
=
user
+
1
;
int
pass_len
=
(
int
)((
base64
+
outlen
)
-
password
);
...
...
@@ -60,6 +61,7 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) {
return
false
;
}
strncpy
(
pContext
->
pass
,
password
,
(
size_t
)
pass_len
);
pContext
->
pass
[
pass_len
]
=
0
;
free
(
base64
);
httpTrace
(
"context:%p, fd:%d, ip:%s, basic token parsed success, user:%s"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
...
...
src/modules/http/src/httpSession.c
浏览文件 @
f06e25fe
...
...
@@ -41,8 +41,8 @@ void httpCreateSession(HttpContext *pContext, void *taos) {
pthread_mutex_lock
(
&
server
->
serverMutex
);
if
(
pContext
->
session
!=
NULL
&&
pContext
->
session
==
pContext
->
session
->
signature
)
{
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, set exist session:%p:%
s:%
p expired"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
id
,
pContext
->
session
->
taos
);
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, set exist session:%p:%p expired"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
taos
);
pContext
->
session
->
expire
=
0
;
pContext
->
session
->
access
--
;
}
...
...
@@ -51,7 +51,7 @@ void httpCreateSession(HttpContext *pContext, void *taos) {
session
.
taos
=
taos
;
session
.
expire
=
(
int
)
taosGetTimestampSec
()
+
server
->
sessionExpire
;
session
.
access
=
1
;
s
trcpy
(
session
.
id
,
pContext
->
user
);
s
nprintf
(
session
.
id
,
HTTP_SESSION_ID_LEN
,
"%s.%s"
,
pContext
->
user
,
pContext
->
pass
);
pContext
->
session
=
(
HttpSession
*
)
taosAddStrHash
(
server
->
pSessionHash
,
session
.
id
,
(
char
*
)(
&
session
));
if
(
pContext
->
session
==
NULL
)
{
httpError
(
"context:%p, fd:%d, ip:%s, user:%s, error:%s"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
...
...
@@ -62,20 +62,23 @@ void httpCreateSession(HttpContext *pContext, void *taos) {
}
pContext
->
session
->
signature
=
pContext
->
session
;
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, create a new session:%p:%
s:%
p"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
id
,
pContext
->
session
->
taos
);
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, create a new session:%p:%p"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
taos
);
pthread_mutex_unlock
(
&
server
->
serverMutex
);
}
void
httpFetchSession
(
HttpContext
*
pContext
)
{
void
httpFetchSession
Imp
(
HttpContext
*
pContext
)
{
HttpServer
*
server
=
pContext
->
pThread
->
pServer
;
pthread_mutex_lock
(
&
server
->
serverMutex
);
pContext
->
session
=
(
HttpSession
*
)
taosGetStrHashData
(
server
->
pSessionHash
,
pContext
->
user
);
char
sessionId
[
HTTP_SESSION_ID_LEN
];
snprintf
(
sessionId
,
HTTP_SESSION_ID_LEN
,
"%s.%s"
,
pContext
->
user
,
pContext
->
pass
);
pContext
->
session
=
(
HttpSession
*
)
taosGetStrHashData
(
server
->
pSessionHash
,
sessionId
);
if
(
pContext
->
session
!=
NULL
&&
pContext
->
session
==
pContext
->
session
->
signature
)
{
pContext
->
session
->
access
++
;
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, find an exist session:%p:%
s:%
p, access:%d, expire:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
id
,
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, find an exist session:%p:%p, access:%d, expire:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
,
pContext
->
session
->
taos
,
pContext
->
session
->
access
,
pContext
->
session
->
expire
);
pContext
->
session
->
expire
=
(
int
)
taosGetTimestampSec
()
+
server
->
sessionExpire
;
}
else
{
...
...
@@ -86,6 +89,20 @@ void httpFetchSession(HttpContext *pContext) {
pthread_mutex_unlock
(
&
server
->
serverMutex
);
}
void
httpFetchSession
(
HttpContext
*
pContext
)
{
if
(
pContext
->
session
==
NULL
)
{
httpFetchSessionImp
(
pContext
);
}
else
{
char
sessionId
[
HTTP_SESSION_ID_LEN
];
snprintf
(
sessionId
,
HTTP_SESSION_ID_LEN
,
"%s.%s"
,
pContext
->
user
,
pContext
->
pass
);
if
(
strcmp
(
pContext
->
session
->
id
,
sessionId
)
!=
0
)
{
httpError
(
"context:%p, fd:%d, ip:%s, user:%s, password may be changed"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
);
httpRestoreSession
(
pContext
);
httpFetchSessionImp
(
pContext
);
}
}
}
void
httpRestoreSession
(
HttpContext
*
pContext
)
{
HttpServer
*
server
=
pContext
->
pThread
->
pServer
;
...
...
@@ -97,15 +114,16 @@ void httpRestoreSession(HttpContext *pContext) {
return
;
}
session
->
access
--
;
httpTrace
(
"context:%p, ip:%s, user:%s, restore session:%p:%
s:%
p, access:%d, expire:%d"
,
pContext
,
pContext
->
ipstr
,
pContext
->
user
,
session
,
session
->
id
,
session
->
taos
,
httpTrace
(
"context:%p, ip:%s, user:%s, restore session:%p:%p, access:%d, expire:%d"
,
pContext
,
pContext
->
ipstr
,
pContext
->
user
,
session
,
session
->
taos
,
session
->
access
,
pContext
->
session
->
expire
);
pContext
->
session
=
NULL
;
pthread_mutex_unlock
(
&
server
->
serverMutex
);
}
void
httpResetSession
(
char
*
session
)
{
HttpSession
*
pSession
=
(
HttpSession
*
)
session
;
httpTrace
(
"close session:%p:%
s:%p"
,
pSession
,
pSession
->
id
,
pSession
->
taos
);
httpTrace
(
"close session:%p:%
p"
,
pSession
,
pSession
->
taos
);
if
(
pSession
->
taos
!=
NULL
)
{
taos_close
(
pSession
->
taos
);
pSession
->
taos
=
NULL
;
...
...
@@ -144,12 +162,12 @@ int httpSessionExpired(char *session) {
return
0
;
// un-expired, so return false
}
if
(
pSession
->
access
>
0
)
{
httpTrace
(
"session:%p:%
s:%p is expired, but still access:%d"
,
pSession
,
pSession
->
id
,
pSession
->
taos
,
httpTrace
(
"session:%p:%
p is expired, but still access:%d"
,
pSession
,
pSession
->
taos
,
pSession
->
access
);
return
0
;
// still used, so return false
}
httpTrace
(
"need close session:%p:%
s:%
p for it expired, cur:%d, expire:%d, invertal:%d"
,
pSession
,
pSession
->
id
,
pSession
->
taos
,
cur
,
pSession
->
expire
,
cur
-
pSession
->
expire
);
httpTrace
(
"need close session:%p:%p for it expired, cur:%d, expire:%d, invertal:%d"
,
pSession
,
pSession
->
taos
,
cur
,
pSession
->
expire
,
cur
-
pSession
->
expire
);
}
return
1
;
...
...
src/modules/http/src/httpSql.c
浏览文件 @
f06e25fe
...
...
@@ -378,9 +378,7 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int code) {
}
void
httpProcessRequest
(
HttpContext
*
pContext
)
{
if
(
pContext
->
session
==
NULL
)
{
httpFetchSession
(
pContext
);
}
httpFetchSession
(
pContext
);
if
(
pContext
->
session
==
NULL
||
pContext
->
session
!=
pContext
->
session
->
signature
||
pContext
->
reqType
==
HTTP_REQTYPE_LOGIN
)
{
...
...
src/os/darwin/inc/os.h
浏览文件 @
f06e25fe
...
...
@@ -47,7 +47,7 @@
#define taosCloseSocket(x) \
{ \
if (
VALIDF
D(x)) { \
if (
FD_VALI
D(x)) { \
close(x); \
x = -1; \
} \
...
...
src/os/linux/inc/os.h
浏览文件 @
f06e25fe
...
...
@@ -75,11 +75,12 @@ extern "C" {
#define taosCloseSocket(x) \
{ \
if (
VALIDFD(x)) {
\
if (
FD_VALID(x)) {
\
close(x); \
x = -1; \
} \
}
#define taosWriteSocket(fd, buf, len) write(fd, buf, len)
#define taosReadSocket(fd, buf, len) read(fd, buf, len)
...
...
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
f06e25fe
...
...
@@ -111,7 +111,7 @@ typedef enum {
#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN)
typedef
int
(
*
__block_search_fn_t
)(
char
*
data
,
int
num
,
int64_t
key
,
int
order
);
typedef
int32_t
(
*
__read_data_fn_t
)(
int
fd
,
SQInfo
*
pQInfo
,
SQueryFileInfo
*
pQueryFile
,
char
*
buf
,
uint64_t
offset
,
typedef
int32_t
(
*
__read_data_fn_t
)(
int
fd
,
SQInfo
*
pQInfo
,
SQueryFile
s
Info
*
pQueryFile
,
char
*
buf
,
uint64_t
offset
,
int32_t
size
);
static
FORCE_INLINE
SMeterObj
*
getMeterObj
(
void
*
hashHandle
,
int32_t
sid
)
{
...
...
@@ -191,10 +191,10 @@ int64_t getQueryStartPositionInCache(SQueryRuntimeEnv* pRuntimeEnv, int32_t* slo
int64_t
getNextAccessedKeyInData
(
SQuery
*
pQuery
,
int64_t
*
pPrimaryCol
,
SBlockInfo
*
pBlockInfo
,
int32_t
blockStatus
);
uint32_t
getDataBlocksForMeters
(
SMeterQuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
,
char
*
pHeaderData
,
int32_t
numOfMeters
,
SQueryFileInfo
*
pQueryFileInfo
,
SMeterDataInfo
**
pMeterDataInfo
);
int32_t
LoadDatablockOnDemand
(
SCompBlock
*
pBlock
,
SField
**
pFields
,
int8_t
*
blkStatus
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
numOfMeters
,
const
char
*
filePath
,
SMeterDataInfo
**
pMeterDataInfo
);
int32_t
LoadDatablockOnDemand
(
SCompBlock
*
pBlock
,
SField
**
pFields
,
u
int8_t
*
blkStatus
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
fileIdx
,
int32_t
slotIdx
,
__block_search_fn_t
searchFn
,
bool
onDemand
);
char
*
vnodeGetHeaderFileData
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
fileIndex
);
char
*
vnodeGetHeaderFileData
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
vnodeId
,
int32_t
fileIndex
);
/**
* Create SMeterQueryInfo.
...
...
src/system/detail/inc/vnodeRead.h
浏览文件 @
f06e25fe
...
...
@@ -47,29 +47,14 @@ typedef struct SQueryLoadCompBlockInfo {
int32_t
fileId
;
int32_t
fileListIndex
;
}
SQueryLoadCompBlockInfo
;
/*
* the header file info for one vnode
*/
typedef
struct
SQueryFileInfo
{
int32_t
fileID
;
/* file id */
char
headerFilePath
[
256
];
/* full file name */
char
dataFilePath
[
256
];
char
lastFilePath
[
256
];
int32_t
defaultMappingSize
;
/* default mapping size */
int32_t
headerFd
;
/* file handler */
char
*
pHeaderFileData
;
/* mmap header files */
size_t
headFileSize
;
int32_t
dataFd
;
char
*
pDataFileData
;
size_t
dataFileSize
;
uint64_t
dtFileMappingOffset
;
int32_t
lastFd
;
size_t
lastFileSize
;
uint64_t
lastFileMappingOffset
;
}
SQueryFileInfo
;
typedef
struct
SHeaderFileInfo
{
int32_t
fileID
;
// file id
size_t
headFileSize
;
// header file size
}
SHeaderFileInfo
;
typedef
struct
SQueryCostSummary
{
double
cacheTimeUs
;
...
...
@@ -106,6 +91,27 @@ typedef struct SOutputRes {
SResultInfo
*
resultInfo
;
}
SOutputRes
;
/*
* header files info, avoid to iterate the directory, the data is acquired
* during in query preparation function
*/
typedef
struct
SQueryFilesInfo
{
SHeaderFileInfo
*
pFileInfo
;
uint32_t
numOfFiles
;
// the total available number of files for this virtual node during query execution
int32_t
current
;
// the memory mapped header file, NOTE: only one header file can be mmap.
int32_t
vnodeId
;
int32_t
headerFd
;
// header file fd
char
*
pHeaderFileData
;
// mmap header files
int32_t
dataFd
;
int32_t
lastFd
;
char
headerFilePath
[
PATH_MAX
];
// current opened header file name
char
dataFilePath
[
PATH_MAX
];
// current opened data file name
char
lastFilePath
[
PATH_MAX
];
// current opened last file path
char
dbFilePathPrefix
[
PATH_MAX
];
}
SQueryFilesInfo
;
typedef
struct
RuntimeEnvironment
{
SPositionInfo
startPos
;
/* the start position, used for secondary/third iteration */
SPositionInfo
endPos
;
/* the last access position in query, served as the start pos of reversed order query */
...
...
@@ -122,17 +128,10 @@ typedef struct RuntimeEnvironment {
SQLFunctionCtx
*
pCtx
;
SQueryLoadBlockInfo
loadBlockInfo
;
/* record current block load information */
SQueryLoadCompBlockInfo
loadCompBlockInfo
;
/* record current compblock information in SQuery */
/*
* header files info, avoid to iterate the directory, the data is acquired
* during in query preparation function
*/
SQueryFileInfo
*
pVnodeFiles
;
uint32_t
numOfFiles
;
// the total available number of files for this virtual node during query execution
int32_t
mmapedHFileIndex
;
// the mmaped header file, NOTE: only one header file can be mmap.
SQueryFilesInfo
vnodeFileInfo
;
int16_t
numOfRowsPerPage
;
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int16_t
scanFlag
;
// denotes reversed scan of data or not
int16_t
scanFlag
;
// denotes reversed scan of data or not
SInterpolationInfo
interpoInfo
;
SData
**
pInterpoBuf
;
SOutputRes
*
pResult
;
// reference to SQuerySupporter->pResult
...
...
src/system/detail/src/vnodeCommit.c
浏览文件 @
f06e25fe
...
...
@@ -81,7 +81,7 @@ int vnodeRenewCommitLog(int vnode) {
pthread_mutex_lock
(
&
(
pVnode
->
logMutex
));
if
(
VALIDF
D
(
pVnode
->
logFd
))
{
if
(
FD_VALI
D
(
pVnode
->
logFd
))
{
munmap
(
pVnode
->
pMem
,
pVnode
->
mappingSize
);
close
(
pVnode
->
logFd
);
rename
(
fileName
,
oldName
);
...
...
@@ -243,7 +243,7 @@ int vnodeInitCommit(int vnode) {
void
vnodeCleanUpCommit
(
int
vnode
)
{
SVnodeObj
*
pVnode
=
vnodeList
+
vnode
;
if
(
VALIDF
D
(
pVnode
->
logFd
))
close
(
pVnode
->
logFd
);
if
(
FD_VALI
D
(
pVnode
->
logFd
))
close
(
pVnode
->
logFd
);
if
(
pVnode
->
cfg
.
commitLog
&&
(
pVnode
->
logFd
>
0
&&
remove
(
pVnode
->
logFn
)
<
0
))
{
dError
(
"vid:%d, failed to remove:%s"
,
vnode
,
pVnode
->
logFn
);
...
...
src/system/detail/src/vnodeFile.c
浏览文件 @
f06e25fe
...
...
@@ -1830,7 +1830,15 @@ int vnodeInitFile(int vnode) {
pVnode
->
fmagic
=
(
uint64_t
*
)
calloc
(
pVnode
->
maxFiles
+
1
,
sizeof
(
uint64_t
));
int
fileId
=
pVnode
->
fileId
;
for
(
int
i
=
0
;
i
<
pVnode
->
numOfFiles
;
++
i
)
{
/*
* The actual files will far exceed the files that need to exist
*/
if
(
pVnode
->
numOfFiles
>
pVnode
->
maxFiles
)
{
dError
(
"vid:%d numOfFiles:%d should not larger than maxFiles:%d"
,
vnode
,
pVnode
->
numOfFiles
,
pVnode
->
maxFiles
);
}
int
numOfFiles
=
MIN
(
pVnode
->
numOfFiles
,
pVnode
->
maxFiles
);
for
(
int
i
=
0
;
i
<
numOfFiles
;
++
i
)
{
if
(
vnodeUpdateFileMagic
(
vnode
,
fileId
)
<
0
)
{
if
(
pVnode
->
cfg
.
replications
>
1
)
{
pVnode
->
badFileId
=
fileId
;
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
f06e25fe
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
f06e25fe
...
...
@@ -266,7 +266,9 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
__block_search_fn_t
searchFn
=
vnodeSearchKeyFunc
[
pTempMeter
->
searchAlgorithm
];
int32_t
vnodeId
=
pTempMeter
->
vnode
;
dTrace
(
"QInfo:%p start to check data blocks in %d files"
,
pQInfo
,
pRuntimeEnv
->
numOfFiles
);
SQueryFilesInfo
*
pVnodeFileInfo
=
&
pRuntimeEnv
->
vnodeFileInfo
;
dTrace
(
"QInfo:%p start to check data blocks in %d files"
,
pQInfo
,
pVnodeFileInfo
->
numOfFiles
);
int32_t
fid
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
-
1
:
INT32_MAX
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
...
...
@@ -289,9 +291,9 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
pQuery
->
fileId
=
fid
;
pSummary
->
numOfFiles
++
;
SQueryFileInfo
*
pQueryFileInfo
=
&
pRuntimeEnv
->
pVnodeFiles
[
fileIdx
]
;
char
*
pHeaderData
=
vnodeGetHeaderFileData
(
pRuntimeEnv
,
fileIdx
);
if
(
pHeaderData
==
NULL
)
{
// failed to mmap header file into buffer, ignore current file, try next
char
*
pHeaderFileData
=
vnodeGetHeaderFileData
(
pRuntimeEnv
,
vnodeId
,
fileIdx
)
;
if
(
pHeaderFileData
==
NULL
)
{
// failed to mmap header file into buffer, ignore current file, try next
fid
+=
step
;
continue
;
}
...
...
@@ -307,20 +309,21 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
return
NULL
;
}
dTrace
(
"QInfo:%p file:%s, %d meters qualified"
,
pQInfo
,
p
Query
FileInfo
->
dataFilePath
,
numOfQualifiedMeters
);
dTrace
(
"QInfo:%p file:%s, %d meters qualified"
,
pQInfo
,
p
Vnode
FileInfo
->
dataFilePath
,
numOfQualifiedMeters
);
// none of meters in query set have pHeaderData in this file, try next file
// none of meters in query set have pHeader
File
Data in this file, try next file
if
(
numOfQualifiedMeters
==
0
)
{
fid
+=
step
;
tfree
(
pReqMeterDataInfo
);
continue
;
}
uint32_t
numOfBlocks
=
getDataBlocksForMeters
(
pSupporter
,
pQuery
,
pHeader
Data
,
numOfQualifiedMeters
,
pQueryFileInfo
,
pReqMeterDataInfo
);
uint32_t
numOfBlocks
=
getDataBlocksForMeters
(
pSupporter
,
pQuery
,
pHeader
FileData
,
numOfQualifiedMeters
,
pVnodeFileInfo
->
headerFilePath
,
pReqMeterDataInfo
);
dTrace
(
"QInfo:%p file:%s, %d meters contains %d blocks to be checked"
,
pQInfo
,
p
Query
FileInfo
->
dataFilePath
,
dTrace
(
"QInfo:%p file:%s, %d meters contains %d blocks to be checked"
,
pQInfo
,
p
Vnode
FileInfo
->
dataFilePath
,
numOfQualifiedMeters
,
numOfBlocks
);
if
(
numOfBlocks
==
0
)
{
fid
+=
step
;
tfree
(
pReqMeterDataInfo
);
...
...
@@ -345,7 +348,7 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
totalBlocks
+=
numOfBlocks
;
// sequentially scan the pHeaderData file
// sequentially scan the pHeader
File
Data file
int32_t
j
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
0
:
numOfBlocks
-
1
;
for
(;
j
<
numOfBlocks
&&
j
>=
0
;
j
+=
step
)
{
...
...
@@ -427,7 +430,7 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
}
int64_t
time
=
taosGetTimestampUs
()
-
st
;
dTrace
(
"QInfo:%p complete check %d files, %d blocks, elapsed time:%.3fms"
,
pQInfo
,
p
RuntimeEnv
->
numOfFiles
,
dTrace
(
"QInfo:%p complete check %d files, %d blocks, elapsed time:%.3fms"
,
pQInfo
,
p
VnodeFileInfo
->
numOfFiles
,
totalBlocks
,
time
/
1000
.
0
);
pSummary
->
fileTimeUs
+=
time
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录