forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathob_task_info.cpp
More file actions
127 lines (117 loc) · 3.95 KB
/
Copy pathob_task_info.cpp
File metadata and controls
127 lines (117 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#define USING_LOG_PREFIX SQL_EXE
#include "sql/engine/ob_physical_plan_ctx.h"
#include "sql/executor/ob_task_info.h"
#include "sql/executor/ob_task_spliter.h"
using namespace oceanbase::common;
using namespace oceanbase::sql;
namespace oceanbase
{
namespace sql
{
ObTaskInfo::ObTaskInfo(common::ObIAllocator &allocator)
: range_location_(allocator),
task_split_type_(ObTaskSpliter::INVALID_SPLIT),
task_location_(),
pull_slice_id_(OB_INVALID_ID),
force_save_interm_result_(false),
slice_events_(ObModIds::OB_SQL_EXECUTOR_TASK_INFO, OB_MALLOC_NORMAL_BLOCK_SIZE),
location_idx_(OB_INVALID_ID),
location_idx_list_(allocator),
root_op_(NULL),
state_(OB_TASK_STATE_NOT_INIT),
slice_count_pos_(allocator),
background_(false),
retry_times_(0),
ts_task_send_begin_(INT64_MIN),
ts_task_recv_done_(INT64_MIN),
ts_result_send_begin_(INT64_MIN),
ts_result_recv_done_(INT64_MIN),
root_spec_(NULL)
{
}
ObTaskInfo::~ObTaskInfo()
{
slice_events_.reset();
}
int ObTaskInfo::deep_copy_slice_events(ObIAllocator &allocator,
const ObIArray<ObSliceEvent> &slice_events)
{
UNUSED(allocator);
int ret = OB_SUCCESS;
for (int64_t i = 0; OB_SUCC(ret) && i < slice_events.count(); ++i) {
const ObSliceEvent &src_sr = slice_events.at(i);
if (OB_FAIL(slice_events_.push_back(src_sr))) {
LOG_WARN("fail to push back dest slice event", K(ret), K(src_sr));
}
// void *dest_sr_ptr = NULL;
// ObSliceEvent *dest_sr = NULL;
// if (OB_ISNULL(dest_sr_ptr = allocator.alloc(sizeof(ObSliceEvent)))) {
// ret = OB_ALLOCATE_MEMORY_FAILED;
// LOG_WARN("fail to alloc dest slice event", K(ret));
// } else if (OB_ISNULL(dest_sr = new(dest_sr_ptr)ObSliceEvent())) {
// ret = OB_ALLOCATE_MEMORY_FAILED;
// LOG_WARN("fail to new dest slice evetnt", K(ret));
// } else if (OB_FAIL(dest_sr->assign(src_sr))) {
// LOG_WARN("fail to assign dest slice event", K(ret), K(src_sr));
// dest_sr->~ObSliceEvent();
// dest_sr = NULL;
// } else if (OB_FAIL(slice_events_.push_back(dest_sr))) {
// LOG_WARN("fail to push back dest slice event", K(ret), K(*dest_sr));
// dest_sr->~ObSliceEvent();
// dest_sr = NULL;
// }
}
return ret;
}
int ObTaskInfo::ObRangeLocation::assign(const ObTaskInfo::ObRangeLocation &range_loc)
{
int ret = common::OB_SUCCESS;
if (OB_FAIL(part_locs_.assign(range_loc.part_locs_))) {
SQL_EXE_LOG(WARN, "copy part locs failed", K(ret), K(range_loc));
} else {
server_ = range_loc.server_;
}
return ret;
}
int ObGranuleTaskInfo::assign(const ObGranuleTaskInfo &other)
{
int ret = OB_SUCCESS;
if (this != &other) {
if (OB_FAIL(ranges_.assign(other.ranges_))) {
LOG_WARN("assign ranges_ failed", K(ret));
} else if (OB_FAIL(ss_ranges_.assign(other.ss_ranges_))) {
LOG_WARN("assign ss_ranges_ failed", K(ret));
} else {
tablet_loc_ = other.tablet_loc_;
task_id_ = other.task_id_;
}
}
return ret;
}
int ObTaskInfo::ObPartLoc::assign(ObTaskInfo::ObPartLoc &other)
{
int ret = OB_SUCCESS;
if (OB_FAIL(scan_ranges_.assign(other.scan_ranges_))) {
LOG_WARN("fail to assign scan range", K(ret), K(other.scan_ranges_.count()));
} else {
part_key_ref_id_ = other.part_key_ref_id_;
value_ref_id_ = other.value_ref_id_;
renew_time_ = other.renew_time_;
row_store_ = other.row_store_;
datum_store_ = other.datum_store_;
}
return ret;
}
}
}