Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
caoersss
oceanbase
提交
58698cf4
O
oceanbase
项目概览
caoersss
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58698cf4
编写于
3月 15, 2022
作者:
D
dz0
提交者:
LINGuanRen
3月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tableapi whitescan
上级
d475941c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
55 addition
and
29 deletion
+55
-29
src/observer/table/ob_htable_filter_operator.cpp
src/observer/table/ob_htable_filter_operator.cpp
+2
-1
src/observer/table/ob_htable_filter_operator.h
src/observer/table/ob_htable_filter_operator.h
+2
-1
src/observer/table/ob_table_api_row_iterator.cpp
src/observer/table/ob_table_api_row_iterator.cpp
+2
-2
src/observer/table/ob_table_api_row_iterator.h
src/observer/table/ob_table_api_row_iterator.h
+2
-2
src/observer/table/ob_table_query_sync_processor.cpp
src/observer/table/ob_table_query_sync_processor.cpp
+24
-8
src/observer/table/ob_table_rpc_processor.cpp
src/observer/table/ob_table_rpc_processor.cpp
+16
-12
src/observer/table/ob_table_service.cpp
src/observer/table/ob_table_service.cpp
+4
-1
src/share/table/ob_table_rpc_struct.h
src/share/table/ob_table_rpc_struct.h
+3
-2
未找到文件。
src/observer/table/ob_htable_filter_operator.cpp
浏览文件 @
58698cf4
...
...
@@ -94,7 +94,8 @@ bool ObHTableColumnTracker::is_done(int64_t timestamp) const
ObHTableExplicitColumnTracker
::
ObHTableExplicitColumnTracker
()
:
columns_
(),
curr_column_idx_
(
0
),
curr_column_
(
NULL
)
curr_column_
(
NULL
),
current_count_
(
0
)
{}
int
ObHTableExplicitColumnTracker
::
init
(
const
table
::
ObHTableFilter
&
htable_filter
,
common
::
ObQueryFlag
::
ScanOrder
&
scan_order
)
...
...
src/observer/table/ob_htable_filter_operator.h
浏览文件 @
58698cf4
...
...
@@ -66,7 +66,8 @@ public:
ObHTableColumnTracker
()
:
max_versions_
(
1
),
min_versions_
(
0
),
oldest_stamp_
(
0
)
oldest_stamp_
(
0
),
tracker_scan_order_
(
common
::
ObQueryFlag
::
ScanOrder
::
ImplementedOrder
)
{}
virtual
~
ObHTableColumnTracker
()
{}
virtual
int
init
(
const
table
::
ObHTableFilter
&
htable_filter
,
common
::
ObQueryFlag
::
ScanOrder
&
scan_order
)
=
0
;
...
...
src/observer/table/ob_table_api_row_iterator.cpp
浏览文件 @
58698cf4
...
...
@@ -936,7 +936,7 @@ int ObTableApiUpdateRowIterator::cons_new_row(const ObTableOperation &table_oper
int
ObTableApiUpdateRowIterator
::
obj_increment
(
const
common
::
ObObj
&
delta
,
const
common
::
ObObj
&
src
,
const
sql
::
ObExprResType
target_type
,
const
sql
::
ObExprResType
&
target_type
,
common
::
ObObj
&
target
)
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -988,7 +988,7 @@ int ObTableApiUpdateRowIterator::obj_increment(
int
ObTableApiUpdateRowIterator
::
obj_append
(
const
common
::
ObObj
&
delta
,
const
common
::
ObObj
&
src
,
const
sql
::
ObExprResType
target_type
,
const
sql
::
ObExprResType
&
target_type
,
common
::
ObObj
&
target
)
{
int
ret
=
OB_SUCCESS
;
...
...
src/observer/table/ob_table_api_row_iterator.h
浏览文件 @
58698cf4
...
...
@@ -135,12 +135,12 @@ private:
int
obj_increment
(
const
common
::
ObObj
&
delta
,
const
common
::
ObObj
&
src
,
const
sql
::
ObExprResType
target_type
,
const
sql
::
ObExprResType
&
target_type
,
common
::
ObObj
&
target
);
int
obj_append
(
const
common
::
ObObj
&
delta
,
const
common
::
ObObj
&
src
,
const
sql
::
ObExprResType
target_type
,
const
sql
::
ObExprResType
&
target_type
,
common
::
ObObj
&
target
);
int
int_add_int_with_check
(
int64_t
old_int
,
...
...
src/observer/table/ob_table_query_sync_processor.cpp
浏览文件 @
58698cf4
...
...
@@ -113,22 +113,32 @@ ObQuerySyncMgr::ObQuerySyncMgr() : session_id_(0)
ObQuerySyncMgr
&
ObQuerySyncMgr
::
get_instance
()
{
int
ret
=
OB_SUCCESS
;
ObQuerySyncMgr
*
instance
=
NULL
;
while
(
OB_UNLIKELY
(
once_
<
2
))
{
if
(
ATOMIC_BCAS
(
&
once_
,
0
,
1
))
{
instance
=
OB_NEW
(
ObQuerySyncMgr
,
ObModIds
::
TABLE_PROC
);
if
(
OB_
LIKELY
(
OB_NOT_NULL
(
instance
)
))
{
if
(
common
::
OB_SUCCESS
!=
instance
->
init
(
))
{
if
(
OB_
NOT_NULL
(
instance
))
{
if
(
OB_FAIL
(
instance
->
init
()
))
{
LOG_WARN
(
"failed to init ObQuerySyncMgr instance"
);
OB_DELETE
(
ObQuerySyncMgr
,
ObModIds
::
TABLE_PROC
,
instance
);
instance
=
NULL
;
ATOMIC_BCAS
(
&
once_
,
1
,
0
);
if
(
OB_UNLIKELY
(
!
ATOMIC_BCAS
(
&
once_
,
1
,
0
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"unexpected error, once_ should be 1"
,
K
(
ret
));
}
}
else
{
instance_
=
instance
;
(
void
)
ATOMIC_BCAS
(
&
once_
,
1
,
2
);
if
(
OB_UNLIKELY
(
!
ATOMIC_BCAS
(
&
once_
,
1
,
2
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"unexpected error, once_ should be 1"
,
K
(
ret
));
}
}
}
else
{
(
void
)
ATOMIC_BCAS
(
&
once_
,
1
,
0
);
if
(
OB_UNLIKELY
(
!
ATOMIC_BCAS
(
&
once_
,
1
,
0
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"unexpected error, once_ should be 1"
,
K
(
ret
));
}
}
}
}
...
...
@@ -268,7 +278,8 @@ ObTableQuerySyncP::ObTableQuerySyncP(const ObGlobalContext &gctx)
result_row_count_
(
0
),
query_session_id_
(
0
),
allocator_
(
ObModIds
::
TABLE_PROC
),
query_session_
(
nullptr
)
query_session_
(
nullptr
),
timeout_ts_
(
0
)
{}
int
ObTableQuerySyncP
::
deserialize
()
...
...
@@ -562,19 +573,24 @@ int ObTableQuerySyncP::try_process()
int
ObTableQuerySyncP
::
destory_query_session
(
bool
need_rollback_trans
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_FAIL
(
end_trans
(
need_rollback_trans
,
req_
,
timeout_ts_
)))
{
LOG_WARN
(
"failed to end trans"
,
K
(
ret
),
K
(
need_rollback_trans
));
}
int
tmp_ret
=
ret
;
ObQuerySyncMgr
::
get_instance
().
get_locker
(
query_session_id_
).
lock
();
if
(
OB_ISNULL
(
query_session_
)
||
OB_ISNULL
(
table_service_ctx_
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"Unexpected null value"
,
K
(
ret
),
K
(
query_session_
),
K
(
table_service_ctx_
));
LOG_WARN
(
"Unexpected null value"
,
K
(
ret
),
K
P_
(
query_session
),
KP_
(
table_service_ctx
));
}
else
if
(
OB_FAIL
(
ObQuerySyncMgr
::
get_instance
().
get_query_session_map
()
->
erase_refactored
(
query_session_id_
)))
{
LOG_WARN
(
"fail to erase query session from query sync mgr"
,
K
(
ret
));
}
else
{
table_service_ctx_
->
destroy_result_iterator
(
part_service_
);
end_trans
(
need_rollback_trans
,
req_
,
timeout_ts_
);
OB_DELETE
(
ObTableQuerySyncSession
,
ObModIds
::
TABLE_PROC
,
query_session_
);
LOG_DEBUG
(
"destory query session success"
,
K
(
ret
),
K
(
query_session_id_
),
K
(
need_rollback_trans
));
}
ObQuerySyncMgr
::
get_instance
().
get_locker
(
query_session_id_
).
unlock
();
ret
=
(
OB_SUCCESS
==
ret
)
?
tmp_ret
:
ret
;
return
ret
;
}
...
...
src/observer/table/ob_table_rpc_processor.cpp
浏览文件 @
58698cf4
...
...
@@ -550,7 +550,7 @@ int ObTableApiProcessorBase::end_trans(bool is_rollback, rpc::ObRequest *req, in
if
(
trans_state_ptr_
->
is_start_participant_executed
()
&&
trans_state_ptr_
->
is_start_participant_success
())
{
if
(
OB_SUCCESS
!=
(
end_ret
=
part_service_
->
end_participant
(
is_rollback
,
*
trans_desc_ptr_
,
participants_ptr_
->
get_partitions
())))
{
ret
=
(
OB_SUCCESS
==
ret
)
?
end_ret
:
ret
;
ret
=
end_
ret
;
LOG_WARN
(
"fail to end participant"
,
K
(
ret
),
K
(
end_ret
),
K
(
is_rollback
));
}
...
...
@@ -705,7 +705,7 @@ static int set_audit_name(const char *info_name, char *&audit_name, int64_t &aud
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
SERVER_LOG
(
WARN
,
"fail to alloc memory"
,
K
(
ret
),
K
(
buf_size
));
}
else
{
str
cpy
(
buf
,
info_nam
e
);
str
ncpy
(
buf
,
info_name
,
buf_siz
e
);
audit_name
=
buf
;
audit_name_length
=
name_length
;
}
...
...
@@ -773,17 +773,18 @@ void ObTableApiProcessorBase::end_audit()
// append request string to query_sql
if
(
NULL
!=
request_string_
&&
request_string_len_
>
0
)
{
static
const
char
request_print_prefix
[]
=
",
\n
request: "
;
const
int64_t
buf_size
=
audit_record_
.
sql_len_
+
sizeof
(
request_print_prefix
)
+
request_string_len_
;
const
int64_t
request_print_prefix_size
=
sizeof
(
request_print_prefix
);
const
int64_t
buf_size
=
audit_record_
.
sql_len_
+
request_print_prefix_size
+
request_string_len_
;
char
*
buf
=
reinterpret_cast
<
char
*>
(
audit_allocator_
.
alloc
(
buf_size
));
if
(
NULL
==
buf
)
{
SERVER_LOG
(
WARN
,
"fail to alloc audit memory"
,
K
(
buf_size
),
K
(
audit_record_
.
sql_
),
K
(
request_string_
));
}
else
{
memset
(
buf
,
0
,
buf_size
);
if
(
OB_NOT_NULL
(
audit_record_
.
sql_
))
{
str
cat
(
buf
,
audit_record_
.
sql
_
);
str
ncat
(
buf
,
audit_record_
.
sql_
,
audit_record_
.
sql_len
_
);
}
str
cat
(
buf
,
request_print_prefix
);
str
cat
(
buf
,
request_string
_
);
str
ncat
(
buf
,
request_print_prefix
,
request_print_prefix_size
);
str
ncat
(
buf
,
request_string_
,
request_string_len
_
);
audit_record_
.
sql_
=
buf
;
audit_record_
.
sql_len_
=
buf_size
;
}
...
...
@@ -1594,12 +1595,15 @@ int ObHTableIncrementExecutor::add_to_results(table::ObTableQueryResult &results
objs
[
1
]
=
cq
;
objs
[
2
]
=
ts
;
int64_t
timestamp
=
0
;
objs
[
2
].
get_int
(
timestamp
);
objs
[
2
].
set_int
(
-
timestamp
);
// negate_htable_timestamp
objs
[
3
]
=
value
;
common
::
ObNewRow
row
(
objs
,
4
);
if
(
OB_FAIL
(
results
.
add_row
(
row
)))
{
// deep copy
LOG_WARN
(
"failed to add row to results"
,
K
(
ret
),
K
(
row
));
if
(
OB_FAIL
(
objs
[
2
].
get_int
(
timestamp
)))
{
LOG_WARN
(
"failed to get int from object"
,
K
(
ret
));
}
else
{
objs
[
2
].
set_int
(
-
timestamp
);
// negate_htable_timestamp
objs
[
3
]
=
value
;
common
::
ObNewRow
row
(
objs
,
4
);
if
(
OB_FAIL
(
results
.
add_row
(
row
)))
{
// deep copy
LOG_WARN
(
"failed to add row to results"
,
K
(
ret
),
K
(
row
));
}
}
}
return
ret
;
...
...
src/observer/table/ob_table_service.cpp
浏览文件 @
58698cf4
...
...
@@ -2117,7 +2117,10 @@ int ObTableService::execute_query(ObTableServiceQueryCtx &ctx, const ObTableQuer
}
else
{
if
(
query
.
get_htable_filter
().
is_valid
())
{
ctx
.
htable_result_iterator_
->
set_scan_result
(
ctx
.
scan_result_
);
if
(
p_hcolumn_desc
->
get_time_to_live
()
>
0
)
{
if
(
OB_ISNULL
(
p_hcolumn_desc
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected null p_hcolumn_desc"
,
K
(
ret
));
}
else
if
(
p_hcolumn_desc
->
get_time_to_live
()
>
0
)
{
ctx
.
htable_result_iterator_
->
set_ttl
(
p_hcolumn_desc
->
get_time_to_live
());
}
}
else
{
...
...
src/share/table/ob_table_rpc_struct.h
浏览文件 @
58698cf4
...
...
@@ -87,7 +87,7 @@ class ObTableOperationRequest final
OB_UNIS_VERSION
(
1
);
public:
ObTableOperationRequest
()
:
credential_
(),
table_name_
(),
table_id_
(
common
::
OB_INVALID_ID
),
partition_id_
(
common
::
OB_INVALID_ID
),
entity_type_
(),
table_operation_
(),
partition_id_
(
common
::
OB_INVALID_ID
),
entity_type_
(
ObTableEntityType
::
ET_DYNAMIC
),
table_operation_
(),
consistency_level_
(),
returning_rowkey_
(
false
),
returning_affected_entity_
(
false
),
returning_affected_rows_
(
false
),
binlog_row_image_type_
(
ObBinlogRowImageType
::
FULL
)
...
...
@@ -137,7 +137,7 @@ class ObTableBatchOperationRequest final
OB_UNIS_VERSION
(
1
);
public:
ObTableBatchOperationRequest
()
:
credential_
(),
table_name_
(),
table_id_
(
common
::
OB_INVALID_ID
),
partition_id_
(
common
::
OB_INVALID_ID
),
entity_type_
(),
batch_operation_
(),
partition_id_
(
common
::
OB_INVALID_ID
),
entity_type_
(
ObTableEntityType
::
ET_DYNAMIC
),
batch_operation_
(),
consistency_level_
(),
returning_rowkey_
(
false
),
returning_affected_entity_
(
false
),
returning_affected_rows_
(
false
),
binlog_row_image_type_
(
ObBinlogRowImageType
::
FULL
)
...
...
@@ -223,6 +223,7 @@ public:
ObTableQueryAndMutateRequest
()
:
table_id_
(
common
::
OB_INVALID_ID
),
partition_id_
(
common
::
OB_INVALID_ID
),
entity_type_
(
ObTableEntityType
::
ET_DYNAMIC
),
binlog_row_image_type_
(
ObBinlogRowImageType
::
FULL
)
{}
TO_STRING_KV
(
"credential"
,
common
::
ObHexStringWrap
(
credential_
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录