forked from oceanbase/seekdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathob_dfo.cpp
More file actions
972 lines (894 loc) · 36.4 KB
/
Copy pathob_dfo.cpp
File metadata and controls
972 lines (894 loc) · 36.4 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
/*
* Copyright (c) 2025 OceanBase.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define USING_LOG_PREFIX SQL_ENG
#include "ob_dfo.h"
#include "sql/engine/px/ob_px_sqc_handler.h"
#include "sql/engine/px/ob_px_sqc_handler.h"
#include "sql/engine/px/exchange/ob_px_transmit_op.h"
using namespace oceanbase::common;
using namespace oceanbase::sql;
using namespace oceanbase::sql::dtl;
OB_SERIALIZE_MEMBER(ObP2PDhMapInfo,
p2p_sequence_ids_,
target_addrs_);
OB_SERIALIZE_MEMBER(ObQCMonitoringInfo, cur_sql_, qc_tid_);
OB_SERIALIZE_MEMBER(ObPxSqcMeta,
execution_id_,
qc_id_,
dfo_id_,
sqc_id_,
transmit_channel_,
qc_ch_info_,
sqc_ch_info_,
exec_addr_,
qc_addr_,
max_task_count_,
min_task_count_,
px_int_id_,
receive_channel_,
is_fulltree_,
is_rpc_worker_,
qc_server_id_,
parent_dfo_id_,
px_sequence_id_,
total_task_count_,
total_part_count_,
transmit_use_interm_result_,
recieve_use_interm_result_,
serial_receive_channels_,
rescan_batch_params_,
partition_pruning_table_locations_,
ignore_vtable_error_,
temp_table_ctx_,
access_table_location_keys_,
adjoining_root_dfo_,
is_single_tsc_leaf_dfo_,
access_external_table_files_,
p2p_dh_map_info_,
sqc_count_,
monitoring_info_,
branch_id_base_,
partition_random_affinitize_,
locations_order_);
OB_SERIALIZE_MEMBER(ObPxTask,
qc_id_,
dfo_id_,
sqc_id_,
task_id_,
sqc_ch_info_,
task_ch_info_,
qc_addr_,
sqc_addr_,
exec_addr_,
execution_id_,
px_int_id_,
is_fulltree_,
branch_id_);
OB_SERIALIZE_MEMBER(ObPxRpcInitTaskResponse,
task_co_id_);
OB_SERIALIZE_MEMBER(ObPxRpcInitSqcResponse,
rc_,
reserved_thread_count_,
partitions_info_,
sqc_order_gi_tasks_);
OB_SERIALIZE_MEMBER(ObSqcTableLocationKey,
table_location_key_,
ref_table_id_,
tablet_id_,
is_dml_,
is_loc_uncertain_);
OB_SERIALIZE_MEMBER(ObPxCleanDtlIntermResInfo, ch_total_info_, sqc_id_, task_count_);
OB_SERIALIZE_MEMBER(ObPxCleanDtlIntermResArgs, info_, batch_size_);
int ObQCMonitoringInfo::init(const ObDfo &dfo) {
int ret = OB_SUCCESS;
qc_tid_ = GETTID();
cur_sql_ = dfo.query_sql();
if (cur_sql_.length() > OB_TINY_SQL_LENGTH) {
cur_sql_.assign(cur_sql_.ptr(), OB_TINY_SQL_LENGTH);
}
return ret;
}
int ObQCMonitoringInfo::assign(const ObQCMonitoringInfo &other) {
int ret = OB_SUCCESS;
cur_sql_ = other.cur_sql_;
qc_tid_ = other.qc_tid_;
return ret;
}
void ObQCMonitoringInfo::reset() {
cur_sql_.reset();
}
int ObPxSqcMeta::assign(const ObPxSqcMeta &other)
{
int ret = OB_SUCCESS;
// Note: Non-generic function, cannot be used to save already initialized ObPxSqcMeta
// Only used for assign execution address
if (NULL != qc_channel_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("should only add a new sqc. you are adding an inited one", K(ret));
} else if (OB_FAIL(access_table_locations_.assign(other.access_table_locations_))) {
LOG_WARN("fail assign tscs locations", K(ret));
} else if (OB_FAIL(extra_access_table_locations_.assign(other.extra_access_table_locations_))) {
LOG_WARN("fail assign tscs locations", K(ret));
} else if (OB_FAIL(transmit_channel_.assign(other.transmit_channel_))) {
LOG_WARN("fail assign data channel", K(ret));
} else if (OB_FAIL(receive_channel_.assign(other.receive_channel_))) {
LOG_WARN("fail assign data channel", K(ret));
} else if (OB_FAIL(serial_receive_channels_.assign(other.serial_receive_channels_))) {
LOG_WARN("fail assign serial_receive_channels_", K(ret));
} else if (OB_FAIL(rescan_batch_params_.assign(other.rescan_batch_params_))) {
LOG_WARN("fail to assign batch rescan params", K(ret));
} else if (OB_FAIL(partition_pruning_table_locations_.assign(other.partition_pruning_table_locations_))) {
LOG_WARN("fail to assign table location", K(ret));
} else if (OB_FAIL(temp_table_ctx_.assign(other.temp_table_ctx_))) {
LOG_WARN("failed to assgin to interm result ids.", K(ret));
} else if (OB_FAIL(access_table_location_keys_.assign(other.access_table_location_keys_))) {
LOG_WARN("failed to assgin to table location keys.", K(ret));
} else if (OB_FAIL(access_table_location_indexes_.assign(other.access_table_location_indexes_))) {
LOG_WARN("failed to assgin to table location keys.", K(ret));
} else if (OB_FAIL(p2p_dh_map_info_.assign(other.p2p_dh_map_info_))) {
LOG_WARN("fail to assign p2p dh map info", K(ret));
} else if (OB_FAIL(monitoring_info_.assign(other.monitoring_info_))) {
LOG_WARN("fail to assign qc monitoring info", K(ret));
} else if (OB_FAIL(locations_order_.assign(other.locations_order_))) {
LOG_WARN("fail to assign qc locations order", K(ret));
} else {
execution_id_ = other.execution_id_;
qc_id_ = other.qc_id_;
dfo_id_ = other.dfo_id_;
sqc_id_ = other.sqc_id_;
branch_id_base_ = other.branch_id_base_;
thread_inited_ = other.thread_inited_;
thread_finish_ = other.thread_finish_;
exec_addr_ = other.exec_addr_;
qc_ch_info_ = other.qc_ch_info_;
sqc_ch_info_ = other.sqc_ch_info_;
exec_addr_ = other.exec_addr_;
qc_addr_ = other.qc_addr_;
task_count_ = other.task_count_;
max_task_count_ = other.max_task_count_;
min_task_count_ = other.min_task_count_;
qc_channel_ = NULL;
px_int_id_ = other.px_int_id_;
is_fulltree_ = other.is_fulltree_;
is_rpc_worker_ = other.is_rpc_worker_;
qc_server_id_ = other.qc_server_id_;
parent_dfo_id_ = other.parent_dfo_id_;
total_task_count_ = other.total_task_count_;
total_part_count_ = other.total_part_count_;
px_sequence_id_ = other.px_sequence_id_;
transmit_use_interm_result_ = other.transmit_use_interm_result_;
recieve_use_interm_result_ = other.recieve_use_interm_result_;
ignore_vtable_error_ = other.ignore_vtable_error_;
server_not_alive_ = other.server_not_alive_;
adjoining_root_dfo_ = other.adjoining_root_dfo_;
is_single_tsc_leaf_dfo_ = other.is_single_tsc_leaf_dfo_;
interrupt_by_dm_ = other.interrupt_by_dm_;
sqc_count_ = other.sqc_count_;
partition_random_affinitize_ = other.partition_random_affinitize_;
}
access_external_table_files_.reuse();
for (int i = 0; OB_SUCC(ret) && i < other.access_external_table_files_.count(); i++) {
const ObExternalFileInfo &other_file = other.access_external_table_files_.at(i);
ObExternalFileInfo temp_file;
if (OB_FAIL(temp_file.deep_copy(allocator_, other_file))) {
LOG_WARN("fail to deep copy ObExternalFileInfo", K(ret));
} else if (OB_FAIL(access_external_table_files_.push_back(temp_file))) {
LOG_WARN("fail to push back", K(ret));
}
}
return ret;
}
int ObPxSqcMeta::add_serial_recieve_channel(const ObPxReceiveDataChannelMsg &channel)
{
int ret = OB_SUCCESS;
if (OB_FAIL(serial_receive_channels_.push_back(channel))) {
LOG_WARN("fail to push back msg", K(ret));
}
return ret;
}
int ObDfo::get_sqc(int64_t idx, ObPxSqcMeta *&sqc)
{
int ret = OB_SUCCESS;
if (idx < 0 || idx >= sqcs_.count()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid idx", K(idx), K(sqcs_.count()), K(ret));
} else {
sqc = &sqcs_.at(idx);
if (OB_ISNULL(sqc)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("NULL ptr", K(sqc), K(ret));
} else if (idx != sqc->get_sqc_id()) {
// According to design expectations, the order of sqc added to sqcs_ and id should be consistent
ret = OB_ERR_UNEXPECTED;
LOG_WARN("idx and sqc id mismatch", K(idx), "id", sqc->get_sqc_id(), K(ret));
}
}
return ret;
}
int ObDfo::add_sqc(const ObPxSqcMeta &sqc)
{
int ret = OB_SUCCESS;
if (OB_FAIL(sqcs_.push_back(sqc))) {
LOG_WARN("fail add sqc to dfo", K(sqc), K(ret));
}
return ret;
}
int ObDfo::check_dfo_pair(ObDfo &parent, ObDfo &child, int64_t &child_dfo_idx)
{
int ret = OB_SUCCESS;
child_dfo_idx = -1;
ObIArray<ObDfo*> &child_dfos = parent.get_child_dfos();
for (int64_t i = 0; i < child_dfos.count() && OB_SUCC(ret); ++i) {
if (&child == child_dfos.at(i)) {
child_dfo_idx = i;
break;
}
}
if (-1 == child_dfo_idx) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: child dfo not found",
K(child.get_dfo_id()),
K(parent.get_dfo_id()));
}
return ret;
}
int ObDfo::fill_channel_info_by_sqc(
ObDtlExecServer &ch_servers,
ObPxSqcMeta &sqc)
{
int ret = OB_SUCCESS;
ch_servers.total_task_cnt_ = 0;
OZ(ch_servers.prefix_task_counts_.push_back(ch_servers.total_task_cnt_));
OZ(ch_servers.add_exec_addr(sqc.get_exec_addr()));
ch_servers.total_task_cnt_ = sqc.get_task_count();
return ret;
}
int ObDfo::fill_channel_info_by_sqc(
ObDtlExecServer &ch_servers,
common::ObIArray<ObPxSqcMeta> &sqcs)
{
int ret = OB_SUCCESS;
ch_servers.total_task_cnt_ = 0;
for (int64_t i = 0; i < sqcs.count() && OB_SUCC(ret); ++i) {
ObPxSqcMeta &sqc = sqcs.at(i);
OZ(ch_servers.prefix_task_counts_.push_back(ch_servers.total_task_cnt_));
OZ(ch_servers.add_exec_addr(sqc.get_exec_addr()));
ch_servers.total_task_cnt_ += sqc.get_task_count();
}
return ret;
}
int ObDfo::calc_total_task_count()
{
int ret = OB_SUCCESS;
if (sqcs_.count() <= 0) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("should at least have one sqc", "count", sqcs_.count(), K(ret));
}
int64_t total_task_cnt = 0;
for (int64_t i = 0; i < sqcs_.count() && OB_SUCC(ret); ++i) {
total_task_cnt += sqcs_.at(i).get_task_count();
}
total_task_cnt_ = total_task_cnt;
return ret;
}
int ObDfo::prepare_channel_info()
{
int ret = OB_SUCCESS;
if (sqcs_.count() <= 0) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("should at least have one sqc", "count", sqcs_.count(), K(ret));
} else if (OB_FAIL(calc_total_task_count())) {
LOG_WARN("failed to calc total task count", K(ret));
}
return ret;
}
int ObDfo::get_task_receive_chs(int64_t child_dfo_id, ObPxTaskChSets &ch_sets) const
{
return get_task_receive_chs(child_dfo_id,
ch_sets,
[](const ObPxTaskChSet &){return true;});
}
int ObDfo::get_task_receive_chs(int64_t child_dfo_id,
ObPxTaskChSets &ch_sets,
TaskFilterFunc filter) const
{
int ret = OB_SUCCESS;
LOG_TRACE("use receive_ch_sets_map_", KP(this), K_(dfo_id), K(lbt()));
ch_sets.reuse();
if (child_dfo_id < 0 || child_dfo_id >= MAX_DFO_ID) {
ret = OB_INVALID_ARGUMENT;
} else if (NULL == receive_ch_sets_map_.at(child_dfo_id)) {
ret = OB_ENTRY_NOT_EXIST;
LOG_WARN("can't find any entry for child dfo id", K(child_dfo_id), K(ret));
} else {
ObPxTaskChSets &receive_ch_sets = *receive_ch_sets_map_.at(child_dfo_id);
for (int64_t i = 0; i < receive_ch_sets.count() && OB_SUCC(ret); ++i) {
if (filter(receive_ch_sets.at(i))) {
if (OB_FAIL(ch_sets.push_back(receive_ch_sets.at(i)))) {
LOG_WARN("fail push back info", K(ret));
}
}
}
if (OB_SUCC(ret)) {
if (receive_ch_sets.count() <= 0) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("array size unexpected.should not be zero",
K(child_dfo_id), "ch_sets", receive_ch_sets.count(), K(ret));
}
}
}
return ret;
}
// child dfo saves the sqc information of child and parent, parent can directly get it from child
int ObDfo::get_dfo_ch_info(int64_t sqc_idx, ObDtlChTotalInfo *&ch_info)
{
int ret = OB_SUCCESS;
ch_info = nullptr;
if (1 == dfo_ch_infos_.count()) {
// only m * n
ch_info = &dfo_ch_infos_.at(0);
} else {
if (0 >= dfo_ch_infos_.count() || sqc_idx >= dfo_ch_infos_.count()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: receive ch info is error", K(ret), K(sqc_idx),
K(dfo_ch_infos_.count()));
} else {
ch_info = &dfo_ch_infos_.at(sqc_idx);
}
}
return ret;
}
////// ObPxRpcInitSqcArgs ////////
int ObPxRpcInitSqcArgs::serialize_common_parts_1(char *buf, const int64_t buf_len, int64_t &pos) const
{
int ret = OB_SUCCESS;
ObPhyOpSeriCtx seri_ctx;
seri_ctx.exec_ctx_ = exec_ctx_;
ObSqcSerializeCache &ser_cache = const_cast<ObSqcSerializeCache &>(ser_cache_);
if (ser_cache.cache_serialized_) {
if (pos + ser_cache.len1_ > buf_len) {
ret = OB_ERR_UNEXPECTED;
} else {
MEMCPY(buf + pos, ser_cache.buf1_, ser_cache.len1_);
pos += ser_cache.len1_;
}
} else {
int64_t old_pos = pos;
LST_DO_CODE(OB_UNIS_ENCODE, *ser_phy_plan_);
LST_DO_CODE(OB_UNIS_ENCODE, *exec_ctx_);
if (OB_SUCC(ret) && ser_cache.enable_serialize_cache_) {
ser_cache.len1_ = pos - old_pos;
ser_cache.buf1_ = ser_cache.allocator_.alloc(ser_cache.len1_);
if (OB_ISNULL(ser_cache.buf1_)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
} else {
MEMCPY(ser_cache.buf1_, buf + old_pos, ser_cache.len1_);
}
}
}
return ret;
}
int ObPxRpcInitSqcArgs::serialize_common_parts_2(
char *buf, const int64_t buf_len, int64_t &pos) const
{
int ret = OB_SUCCESS;
ObPhyOpSeriCtx seri_ctx;
seri_ctx.exec_ctx_ = exec_ctx_;
ObSqcSerializeCache &ser_cache = const_cast<ObSqcSerializeCache &>(ser_cache_);
if (ser_cache.cache_serialized_) {
if (pos + ser_cache.len2_ > buf_len) {
ret = OB_ERR_UNEXPECTED;
} else {
MEMCPY(buf + pos, ser_cache.buf2_, ser_cache.len2_);
pos += ser_cache.len2_;
}
} else if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: op root is null", K(ret));
} else {
int64_t old_pos = pos;
// Serialize the core part of Task to remote: sub plan tree
const ObExprFrameInfo *frame_info = NULL;
if (OB_UNLIKELY(!IS_PX_TRANSMIT(op_spec_root_->type_))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected spec type", K(ret), K(op_spec_root_->type_));
} else {
frame_info = static_cast<ObPxTransmitSpec *>(op_spec_root_)->dfo_expr_frame_info_;
}
frame_info = NULL == frame_info ? &ser_phy_plan_->get_expr_frame_info() : frame_info;
if (OB_FAIL(ret)) {
} else if (OB_FAIL(ObPxTreeSerializer::serialize_expr_frame_info<true>(
buf, buf_len, pos, *exec_ctx_, *frame_info))) {
LOG_WARN("failed to serialize rt expr", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_tree(
buf, buf_len, pos, *op_spec_root_, false /* is_fulltree */, sqc_.get_exec_addr(), &seri_ctx))) {
LOG_WARN("fail serialize root_op", K(ret), K(buf_len), K(pos));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_op_input(
buf, buf_len, pos, *op_spec_root_, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
}
if (OB_SUCC(ret) && ser_cache.enable_serialize_cache_) {
ser_cache.len2_ = pos - old_pos;
ser_cache.buf2_ = ser_cache.allocator_.alloc(ser_cache.len2_);
if (OB_ISNULL(ser_cache.buf2_)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
} else {
MEMCPY(ser_cache.buf2_, buf + old_pos, ser_cache.len2_);
}
}
}
return ret;
}
OB_DEF_SERIALIZE(ObPxRpcInitSqcArgs)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(op_spec_root_) || OB_ISNULL(exec_ctx_) || OB_ISNULL(ser_phy_plan_)) {
ret = OB_NOT_INIT;
LOG_WARN("task not init", K(op_spec_root_), K_(exec_ctx), K_(ser_phy_plan));
}
if (OB_SUCC(ret) && OB_FAIL(serialize_common_parts_1(buf, buf_len, pos))) {
LOG_WARN("fail serialize common parts 1", K(ret));
}
LST_DO_CODE(OB_UNIS_ENCODE, sqc_);
if (OB_SUCC(ret) && OB_FAIL(serialize_common_parts_2(buf, buf_len, pos))) {
LOG_WARN("fail serialize common parts 2", K(ret));
}
// can reuse cache from now on
(const_cast<ObSqcSerializeCache &>(ser_cache_)).cache_serialized_ = ser_cache_.enable_serialize_cache_;
LST_DO_CODE(OB_UNIS_ENCODE, qc_order_gi_tasks_);
if (OB_SUCC(ret) && sqc_.is_fulltree()) {
ret = exec_ctx_->serialize_group_pwj_map(buf, buf_len, pos);
}
LOG_TRACE("serialize sqc", K_(sqc));
LOG_DEBUG("end trace sqc args", K(pos), K(buf_len), K(this->get_serialize_size()));
return ret;
}
OB_DEF_DESERIALIZE(ObPxRpcInitSqcArgs)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(sqc_handler_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Sqc handler cann't be null", K(ret));
} else if (OB_FAIL(sqc_handler_->copy_sqc_init_arg(pos, buf, data_len))) {
LOG_WARN("Failed to assign sqc", K(ret));
}
return ret;
}
OB_DEF_SERIALIZE_SIZE(ObPxRpcInitSqcArgs)
{
int ret = OB_SUCCESS;
int64_t len = 0;
if (OB_ISNULL(exec_ctx_) || OB_ISNULL(ser_phy_plan_) || OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("task not init", K_(exec_ctx), K_(ser_phy_plan), K(ret));
} else {
ObPhyOpSeriCtx seri_ctx;
seri_ctx.exec_ctx_ = exec_ctx_;
ObSqcSerializeCache &ser_cache = const_cast<ObSqcSerializeCache &>(ser_cache_);
if (ser_cache.cache_serialized_) {
len += ser_cache.slen_;
} else {
LST_DO_CODE(OB_UNIS_ADD_LEN, *ser_phy_plan_);
LST_DO_CODE(OB_UNIS_ADD_LEN, *exec_ctx_);
if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("unexpected status: op root is null", K(ret));
} else {
const ObExprFrameInfo *frame_info = static_cast<ObPxTransmitSpec *>(op_spec_root_)->dfo_expr_frame_info_;
frame_info = NULL == frame_info ? &ser_phy_plan_->get_expr_frame_info() : frame_info;
len += ObPxTreeSerializer::get_serialize_expr_frame_info_size<true>(*exec_ctx_, *frame_info);
len += ObPxTreeSerializer::get_tree_serialize_size(*op_spec_root_, false /* is_fulltree */, &seri_ctx);
len += ObPxTreeSerializer::get_serialize_op_input_size(
*op_spec_root_, exec_ctx_->get_kit_store());
}
LOG_TRACE("trace get ser rpc init sqc args size", K(len));
ser_cache.slen_ = len;
}
// always serialize
LST_DO_CODE(OB_UNIS_ADD_LEN, sqc_);
LST_DO_CODE(OB_UNIS_ADD_LEN, qc_order_gi_tasks_);
}
if (OB_SUCC(ret) && sqc_.is_fulltree()) {
len += exec_ctx_->get_group_pwj_map_serialize_size();
}
return len;
}
void ObPxRpcInitSqcArgs::set_serialize_param(ObExecContext &exec_ctx,
ObOpSpec &op_spec_root,
const ObPhysicalPlan &ser_phy_plan)
{
exec_ctx_ = &exec_ctx;
op_spec_root_ = &op_spec_root;
ser_phy_plan_ = &ser_phy_plan;
}
void ObPxRpcInitSqcArgs::set_deserialize_param(ObExecContext &exec_ctx,
ObPhysicalPlan &des_phy_plan,
ObIAllocator *des_allocator)
{
exec_ctx_ = &exec_ctx;
des_phy_plan_ = &des_phy_plan;
des_allocator_ = des_allocator;
}
int ObPxRpcInitSqcArgs::do_deserialize(int64_t &pos, const char *net_buf, int64_t data_len)
{
int ret = OB_SUCCESS;
/**
* Do not need to record the buf allocated by des allocator, because sqc handler will
* definitely perform a reset duringrecycle, thus releasing this memory.
*/
char *buf = nullptr;
if (OB_ISNULL(exec_ctx_) || OB_ISNULL(des_phy_plan_) || OB_ISNULL(des_allocator_)
|| OB_ISNULL(net_buf) || (data_len <= 0)) {
ret = OB_NOT_INIT;
LOG_WARN("task not init", K(ret), K_(exec_ctx), K_(des_phy_plan), K_(des_allocator),
K(net_buf), K(data_len));
} else if (OB_ISNULL(buf = (char *)des_allocator_->alloc(sizeof(char) * data_len))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("Failed to allocate memory", K(ret));
} else if (OB_UNLIKELY(NULL != op_spec_root_)) {
op_spec_root_ = nullptr;
}
if (OB_SUCC(ret)) {
MEMCPY(buf, net_buf, data_len);
LST_DO_CODE(OB_UNIS_DECODE, *des_phy_plan_);
LST_DO_CODE(OB_UNIS_DECODE, *exec_ctx_);
if (OB_SUCC(ret) && OB_ISNULL(exec_ctx_->get_my_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is NULL", K(ret));
}
if (OB_SUCC(ret)) {
// Compact mode may not set while rpc argument deserialize, set it manually.
// See:
lib::CompatModeGuard g(ORACLE_MODE == exec_ctx_->get_my_session()->get_compatibility_mode()
? lib::Worker::CompatMode::ORACLE
: lib::Worker::CompatMode::MYSQL);
LST_DO_CODE(OB_UNIS_DECODE, sqc_);
LOG_TRACE("deserialize sqc", K_(sqc));
if (OB_SUCC(ret)) {
const ObExprFrameInfo *frame_info = &des_phy_plan_->get_expr_frame_info();
if (OB_FAIL(ObPxTreeSerializer::deserialize_expr_frame_info<true>(
buf, data_len, pos, *exec_ctx_, *frame_info))) {
LOG_WARN("failed to serialize rt expr", K(ret), K(sqc_));
} else if (OB_FAIL(ObPxTreeSerializer::deserialize_tree(
buf, data_len, pos, *des_phy_plan_, op_spec_root_, scan_spec_ops_))) {
LOG_WARN("fail deserialize tree", K(ret), K(sqc_));
} else if (OB_FAIL(op_spec_root_->create_op_input(*exec_ctx_))) {
LOG_WARN("create operator from spec failed", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::deserialize_op_input(buf, data_len, pos, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
} else {
des_phy_plan_->set_root_op_spec(op_spec_root_);
exec_ctx_->reference_my_plan(des_phy_plan_);
#ifndef NDEBUG
const ObIArray<ObExpr> &exprs = frame_info->rt_exprs_;
const ObIArray<ObFrameInfo> &datum_frame = frame_info->datum_frame_;
int64_t batch_size = std::max<int64_t>(des_phy_plan_->get_batch_size(), 1);
for (int64_t i = 0; OB_SUCC(ret) && i < exprs.count(); i++) {
const ObExpr &expr = exprs.at(i);
for (int64_t j = 0; j < datum_frame.count() && OB_SUCC(ret); j++) {
const ObFrameInfo &frame_info = datum_frame.at(j);
if (expr.frame_idx_ == frame_info.frame_idx_) {
int64_t max_offset = ObStaticEngineExprCG::frame_max_offset(expr, batch_size, frame_info.use_rich_format_);
if (OB_UNLIKELY(max_offset > frame_info.frame_size_)) {
ret = OB_SIZE_OVERFLOW;
LOG_WARN("unexpected frame size", K(ret), K(frame_info), K(batch_size),
K(max_offset), K(expr), K(expr.batch_result_), K(expr.offset_off_), K(expr.cont_buf_off_), K(expr.null_bitmap_off_));
}
}
}
}
#endif
}
}
}
}
if (OB_SUCC(ret)) {
// if version of qc is old, qc_order_gi_tasks_ will not be serialized and the value will be false.
qc_order_gi_tasks_ = false;
LST_DO_CODE(OB_UNIS_DECODE, qc_order_gi_tasks_);
if (OB_SUCC(ret) && sqc_.is_fulltree() && pos < data_len) {
ret = exec_ctx_->deserialize_group_pwj_map(buf, data_len, pos);
}
LOG_TRACE("deserialize qc order gi tasks", K(qc_order_gi_tasks_), K(sqc_), K(this));
}
return ret;
}
////// ObPxRpcInitTaskArgs ////////
OB_DEF_SERIALIZE(ObPxRpcInitTaskArgs)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(op_spec_root_) || OB_ISNULL(exec_ctx_) || OB_ISNULL(ser_phy_plan_)) {
ret = OB_NOT_INIT;
LOG_WARN("task not init", K_(exec_ctx), K_(ser_phy_plan));
}
uint64_t sqc_task_ptr_val = reinterpret_cast<uint64_t>(sqc_task_ptr_);
uint64_t sqc_handler_ptr_val = reinterpret_cast<uint64_t>(sqc_handler_);
bool use_share_plan = ser_phy_plan_->px_worker_share_plan_enabled();
LST_DO_CODE(OB_UNIS_ENCODE, use_share_plan);
if (!use_share_plan) {
LST_DO_CODE(OB_UNIS_ENCODE, *ser_phy_plan_);
LST_DO_CODE(OB_UNIS_ENCODE, *exec_ctx_);
LST_DO_CODE(OB_UNIS_ENCODE, task_);
LST_DO_CODE(OB_UNIS_ENCODE, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_ENCODE, sqc_handler_ptr_val);
LOG_TRACE("serialize task", KP_(sqc_task_ptr), KP_(sqc_handler), K_(task));
// Serialize the core part of Task to the execution end: sub plan tree
if (OB_SUCC(ret)) {
const ObExprFrameInfo *frame_info = &ser_phy_plan_->get_expr_frame_info();
if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: op root is null", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_expr_frame_info<true>(
buf, buf_len, pos, *exec_ctx_, *frame_info))) {
LOG_WARN("failed to serialize rt expr", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_tree(
buf, buf_len, pos, *op_spec_root_, false /* is_fulltree */, task_.get_exec_addr()))) {
LOG_WARN("fail serialize root_op", K(ret), K(buf_len), K(pos));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_op_input(
buf, buf_len, pos, *op_spec_root_, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
}
}
} else {
LST_DO_CODE(OB_UNIS_ENCODE, *exec_ctx_);
LST_DO_CODE(OB_UNIS_ENCODE, task_);
LST_DO_CODE(OB_UNIS_ENCODE, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_ENCODE, sqc_handler_ptr_val);
LOG_TRACE("serialize task", KP_(sqc_task_ptr), KP_(sqc_handler), K_(task));
// Serialize the core part of Task to the execution end: sub plan tree
if (OB_SUCC(ret)) {
const ObExprFrameInfo &frame_info = ser_phy_plan_->get_expr_frame_info();
if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: op root is null", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_expr_frame_info<false>(
buf, buf_len, pos, *exec_ctx_, frame_info))) {
LOG_WARN("fail serialize expr frames", K(ret), K(buf_len), K(pos));
} else if (OB_FAIL(ObPxTreeSerializer::serialize_op_input(
buf, buf_len, pos, *op_spec_root_, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
}
}
}
return ret;
}
OB_DEF_DESERIALIZE(ObPxRpcInitTaskArgs)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(exec_ctx_) || OB_ISNULL(inner_phy_plan_) || OB_ISNULL(des_allocator_)) {
ret = OB_NOT_INIT;
LOG_WARN("task not init", K(ret), K_(exec_ctx), K_(des_phy_plan), K_(des_allocator));
} else if (OB_UNLIKELY(NULL != op_spec_root_)) {
// if op_root_ is not NULL, just reset it
op_spec_root_ = NULL;
}
// PX framework do the work at stage named after-process,
// and in this stage we can not ensure the memory to be valid (may be release
// by the network framework). So we deep copy these memory here.
pos = 0;
char *tmp_buf = (char *)des_allocator_->alloc(data_len);
if (OB_FAIL(ret)) {
} else if (OB_ISNULL(tmp_buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret), K(tmp_buf));
} else {
MEMCPY(tmp_buf, buf, data_len);
buf = tmp_buf;
}
bool use_share_plan = false;
LST_DO_CODE(OB_UNIS_DECODE, use_share_plan);
if (OB_FAIL(ret)) {
} else if (!use_share_plan) {
LST_DO_CODE(OB_UNIS_DECODE, *inner_phy_plan_);
LST_DO_CODE(OB_UNIS_DECODE, *exec_ctx_);
LST_DO_CODE(OB_UNIS_DECODE, task_);
uint64_t sqc_task_ptr_val = 0;
uint64_t sqc_handler_ptr_val = 0;
LST_DO_CODE(OB_UNIS_DECODE, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_DECODE, sqc_handler_ptr_val);
sqc_task_ptr_ = reinterpret_cast<ObPxTask *>(sqc_task_ptr_val);
sqc_handler_ = reinterpret_cast<ObPxSqcHandler *>(sqc_handler_ptr_val);
LOG_TRACE("deserialized task", KP_(sqc_task_ptr), KP_(sqc_handler), K_(task));
if (OB_SUCC(ret)) {
const ObExprFrameInfo *expr_frame_info = &inner_phy_plan_->get_expr_frame_info();
if (OB_FAIL(ObPxTreeSerializer::deserialize_expr_frame_info<true>(
buf, data_len, pos, *exec_ctx_, *const_cast<ObExprFrameInfo*>(expr_frame_info)))) {
LOG_WARN("failed to serialize rt expr", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::deserialize_tree(
buf, data_len, pos, *inner_phy_plan_, inner_op_spec_root_))) {
LOG_WARN("fail deserialize tree", K(ret));
} else if (OB_FAIL(inner_op_spec_root_->create_op_input(*exec_ctx_))) {
LOG_WARN("create operator from spec failed", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::deserialize_op_input(buf, data_len, pos, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
} else {
inner_phy_plan_->set_root_op_spec(inner_op_spec_root_);
exec_ctx_->reference_my_plan(inner_phy_plan_);
des_phy_plan_ = inner_phy_plan_;
op_spec_root_ = inner_op_spec_root_;
}
}
} else if (OB_ISNULL(des_phy_plan_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("des phy plan is NULL", K(ret));
} else {
op_spec_root_ = des_phy_plan_->get_root_op_spec();
LST_DO_CODE(OB_UNIS_DECODE, *exec_ctx_);
LST_DO_CODE(OB_UNIS_DECODE, task_);
uint64_t sqc_task_ptr_val = 0;
uint64_t sqc_handler_ptr_val = 0;
LST_DO_CODE(OB_UNIS_DECODE, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_DECODE, sqc_handler_ptr_val);
sqc_task_ptr_ = reinterpret_cast<ObPxTask *>(sqc_task_ptr_val);
sqc_handler_ = reinterpret_cast<ObPxSqcHandler *>(sqc_handler_ptr_val);
LOG_TRACE("deserialized task", KP_(sqc_task_ptr), KP_(sqc_handler), K_(task));
if (OB_SUCC(ret)) {
const ObExprFrameInfo &expr_frame_info = des_phy_plan_->get_expr_frame_info();
if (OB_FAIL(ObPxTreeSerializer::deserialize_expr_frame_info<false>(
buf, data_len, pos, *exec_ctx_, expr_frame_info))) {
LOG_WARN("failed to deserialize expr frames", K(ret));
} else if (OB_FAIL(op_spec_root_->create_op_input(*exec_ctx_))) {
LOG_WARN("create operator from spec failed", K(ret));
} else if (OB_FAIL(ObPxTreeSerializer::deserialize_op_input(buf, data_len, pos, exec_ctx_->get_kit_store()))) {
LOG_WARN("failed to deserialize kit store", K(ret));
} else {
exec_ctx_->reference_my_plan(des_phy_plan_);
}
}
}
return ret;
}
OB_DEF_SERIALIZE_SIZE(ObPxRpcInitTaskArgs)
{
int ret = OB_SUCCESS;
int64_t len = 0;
if (OB_ISNULL(exec_ctx_) || OB_ISNULL(ser_phy_plan_) || OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("task not init", K_(exec_ctx), K_(ser_phy_plan));
} else {
uint64_t sqc_task_ptr_val = reinterpret_cast<uint64_t>(sqc_task_ptr_);
uint64_t sqc_handler_ptr_val = reinterpret_cast<uint64_t>(sqc_handler_);
bool use_share_plan = ser_phy_plan_->px_worker_share_plan_enabled();
LST_DO_CODE(OB_UNIS_ADD_LEN, use_share_plan);
if (!use_share_plan) {
LST_DO_CODE(OB_UNIS_ADD_LEN, *ser_phy_plan_);
LST_DO_CODE(OB_UNIS_ADD_LEN, *exec_ctx_);
LST_DO_CODE(OB_UNIS_ADD_LEN, task_);
LST_DO_CODE(OB_UNIS_ADD_LEN, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_ADD_LEN, sqc_handler_ptr_val);
if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("unexpected status: op root is null", K(ret));
} else {
const ObExprFrameInfo *frame_info = &ser_phy_plan_->get_expr_frame_info();
len += ObPxTreeSerializer::get_serialize_expr_frame_info_size<true>(*exec_ctx_, *frame_info);
len += ObPxTreeSerializer::get_tree_serialize_size(*op_spec_root_, false /* is_fulltree */);
len += ObPxTreeSerializer::get_serialize_op_input_size(
*op_spec_root_, exec_ctx_->get_kit_store());
}
} else {
LST_DO_CODE(OB_UNIS_ADD_LEN, *exec_ctx_);
LST_DO_CODE(OB_UNIS_ADD_LEN, task_);
LST_DO_CODE(OB_UNIS_ADD_LEN, sqc_task_ptr_val);
LST_DO_CODE(OB_UNIS_ADD_LEN, sqc_handler_ptr_val);
if (OB_ISNULL(op_spec_root_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("unexpected status: op root is null", K(ret));
} else {
const ObExprFrameInfo &frame_info = ser_phy_plan_->get_expr_frame_info();
len += ObPxTreeSerializer::get_serialize_expr_frame_info_size<false>(*exec_ctx_, frame_info);
len += ObPxTreeSerializer::get_serialize_op_input_size(
*op_spec_root_, exec_ctx_->get_kit_store());
}
}
}
return len;
}
void ObPxRpcInitTaskArgs::set_serialize_param(ObExecContext &exec_ctx,
ObOpSpec &op_spec_root,
const ObPhysicalPlan &ser_phy_plan)
{
exec_ctx_ = &exec_ctx;
op_spec_root_ = &op_spec_root;
ser_phy_plan_ = &ser_phy_plan;
}
void ObPxRpcInitTaskArgs::set_deserialize_param(ObExecContext &exec_ctx,
ObPhysicalPlan &des_phy_plan,
ObIAllocator *des_allocator)
{
exec_ctx_ = &exec_ctx;
des_phy_plan_ = &des_phy_plan;
des_allocator_ = des_allocator;
}
int ObPxRpcInitTaskArgs::init_deserialize_param(const ObPxRpcInitTaskArgs &arg, lib::MemoryContext &mem_context, const observer::ObGlobalContext &gctx)
{
int ret = OB_SUCCESS;
void *plan_buf = NULL;
void *ctx_buf = NULL;
des_phy_plan_ = arg.ser_phy_plan_;
if (OB_ISNULL(plan_buf = mem_context->get_arena_allocator().alloc(sizeof(ObPhysicalPlan)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else if (OB_ISNULL(ctx_buf = mem_context->get_arena_allocator().alloc(sizeof(ObDesExecContext)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
inner_phy_plan_ = new (plan_buf) ObPhysicalPlan(mem_context);
exec_ctx_ = new (ctx_buf) ObDesExecContext(mem_context->get_arena_allocator(), gctx.session_mgr_);
des_allocator_ = &mem_context->get_arena_allocator();
}
return ret;
}
int ObPxRpcInitTaskArgs::deep_copy_assign(ObPxRpcInitTaskArgs &src,
ObIAllocator &alloc)
{
int ret = OB_SUCCESS;
UNIS_VERSION_GUARD(lib::get_unis_global_compat_version());
// Deep copy all elements in arg, into session, op tree etc.
// Temporarily complete through serialization+deserialization
int64_t ser_pos = 0;
int64_t des_pos = 0;
void *ser_ptr = NULL;
int64_t ser_arg_len = src.get_serialize_size();
if (OB_ISNULL(ser_ptr = alloc.alloc(ser_arg_len))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail alloc memory", K(ser_arg_len), KP(ser_ptr), K(ret));
} else if (OB_ISNULL(des_allocator_)
|| OB_ISNULL(inner_phy_plan_)
|| OB_ISNULL(exec_ctx_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("deserialize args not init", K(ret));
} else if (OB_FAIL(src.serialize(static_cast<char *>(ser_ptr), ser_arg_len, ser_pos))) {
LOG_WARN("fail serialzie init task arg", KP(ser_ptr), K(ser_arg_len), K(ser_pos), K(ret));
} else if (OB_FAIL(deserialize(static_cast<const char *>(ser_ptr), ser_pos, des_pos))) {
LOG_WARN("fail des task arg", KP(ser_ptr), K(ser_pos), K(des_pos), K(ret));
} else if (ser_pos != des_pos) {
ret = OB_DESERIALIZE_ERROR;
LOG_WARN("data_len and pos mismatch", K(ser_arg_len), K(ser_pos), K(des_pos), K(ret));
}
if (OB_SUCC(ret)) {
if (sqc_handler_->get_sqc_init_arg().sqc_.is_fulltree()
&& nullptr != src.exec_ctx_->get_group_pwj_map()) {
exec_ctx_->deep_copy_group_pwj_map(src.exec_ctx_->get_group_pwj_map());
}
}
return ret;
}
void ObDfo::reset_resource(ObDfo *dfo)
{
if (nullptr != dfo) {
dfo->sqcs_.reset();
dfo->child_dfos_.reset();
dfo->tasks_.reset();
for (int64_t j = 0; j < dfo->receive_ch_sets_map_.count(); ++j) {
if (OB_NOT_NULL(dfo->receive_ch_sets_map_.at(j))) {
dfo->receive_ch_sets_map_.at(j)->reset();
}
}
dfo->transmit_ch_sets_.reset();
dfo->p2p_dh_map_info_.destroy();
dfo->~ObDfo();
dfo = nullptr;
}
}
bool ObDfo::check_root_valid()
{
bool invalid = false;
if (nullptr != root_op_spec_) {
invalid = IS_PX_COORD(root_op_spec_->type_);
}
return invalid;
}