forked from couchbase/indexing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
1482 lines (1192 loc) · 30.7 KB
/
message.go
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
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2014 Couchbase, Inc.
// 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.
package indexer
import (
"fmt"
"github.com/couchbase/indexing/secondary/common"
"time"
)
type MsgType int16
const (
//General Messages
MSG_SUCCESS = iota
MSG_ERROR
MSG_TIMESTAMP
//Component specific messages
//STREAM_READER
STREAM_READER_STREAM_DROP_DATA
STREAM_READER_STREAM_BEGIN
STREAM_READER_STREAM_END
STREAM_READER_SYNC
STREAM_READER_SNAPSHOT_MARKER
STREAM_READER_UPDATE_QUEUE_MAP
STREAM_READER_ERROR
STREAM_READER_SHUTDOWN
STREAM_READER_CONN_ERROR
STREAM_READER_HWT
//MUTATION_MANAGER
MUT_MGR_PERSIST_MUTATION_QUEUE
MUT_MGR_ABORT_PERSIST
MUT_MGR_DRAIN_MUTATION_QUEUE
MUT_MGR_GET_MUTATION_QUEUE_HWT
MUT_MGR_GET_MUTATION_QUEUE_LWT
MUT_MGR_SHUTDOWN
MUT_MGR_FLUSH_DONE
MUT_MGR_ABORT_DONE
//TIMEKEEPER
TK_SHUTDOWN
TK_STABILITY_TIMESTAMP
TK_INIT_BUILD_DONE
TK_INIT_BUILD_DONE_ACK
TK_ENABLE_FLUSH
TK_DISABLE_FLUSH
TK_MERGE_STREAM
TK_MERGE_STREAM_ACK
TK_GET_BUCKET_HWT
//STORAGE_MANAGER
STORAGE_MGR_SHUTDOWN
STORAGE_INDEX_SNAP_REQUEST
STORAGE_INDEX_STORAGE_STATS
STORAGE_INDEX_COMPACT
STORAGE_SNAP_DONE
//KVSender
KV_SENDER_SHUTDOWN
KV_SENDER_GET_CURR_KV_TS
KV_SENDER_RESTART_VBUCKETS
KV_SENDER_REPAIR_ENDPOINTS
KV_STREAM_REPAIR
MSG_SUCCESS_OPEN_STREAM
//ADMIN_MGR
ADMIN_MGR_SHUTDOWN
//CLUSTER_MGR
CLUST_MGR_AGENT_SHUTDOWN
CLUST_MGR_CREATE_INDEX_DDL
CLUST_MGR_BUILD_INDEX_DDL
CLUST_MGR_BUILD_INDEX_DDL_RESPONSE
CLUST_MGR_DROP_INDEX_DDL
CLUST_MGR_UPDATE_TOPOLOGY_FOR_INDEX
CLUST_MGR_RESET_INDEX
CLUST_MGR_GET_GLOBAL_TOPOLOGY
CLUST_MGR_GET_LOCAL
CLUST_MGR_SET_LOCAL
CLUST_MGR_DEL_LOCAL
CLUST_MGR_DEL_BUCKET
CLUST_MGR_INDEXER_READY
CLUST_MGR_CLEANUP_INDEX
//CBQ_BRIDGE_SHUTDOWN
CBQ_BRIDGE_SHUTDOWN
CBQ_CREATE_INDEX_DDL
CBQ_DROP_INDEX_DDL
//INDEXER
INDEXER_INIT_PREP_RECOVERY
INDEXER_PREPARE_RECOVERY
INDEXER_PREPARE_DONE
INDEXER_INITIATE_RECOVERY
INDEXER_RECOVERY_DONE
INDEXER_BUCKET_NOT_FOUND
INDEXER_ROLLBACK
STREAM_REQUEST_DONE
INDEXER_PAUSE
INDEXER_RESUME
INDEXER_PREPARE_UNPAUSE
INDEXER_UNPAUSE
INDEXER_BOOTSTRAP
INDEXER_SET_LOCAL_META
INDEXER_GET_LOCAL_META
INDEXER_DEL_LOCAL_META
INDEXER_CHECK_DDL_IN_PROGRESS
INDEXER_UPDATE_RSTATE
//SCAN COORDINATOR
SCAN_COORD_SHUTDOWN
COMPACTION_MGR_SHUTDOWN
//COMMON
UPDATE_INDEX_INSTANCE_MAP
UPDATE_INDEX_PARTITION_MAP
OPEN_STREAM
ADD_INDEX_LIST_TO_STREAM
REMOVE_INDEX_LIST_FROM_STREAM
REMOVE_BUCKET_FROM_STREAM
CLOSE_STREAM
CLEANUP_STREAM
CONFIG_SETTINGS_UPDATE
STORAGE_STATS
SCAN_STATS
INDEX_PROGRESS_STATS
INDEXER_STATS
INDEX_STATS_DONE
STATS_RESET
REPAIR_ABORT
)
type Message interface {
GetMsgType() MsgType
}
//Generic Message
type MsgGeneral struct {
mType MsgType
}
func (m *MsgGeneral) GetMsgType() MsgType {
return m.mType
}
//Error Message
type MsgError struct {
err Error
}
func (m *MsgError) GetMsgType() MsgType {
return MSG_ERROR
}
func (m *MsgError) GetError() Error {
return m.err
}
func (m *MsgError) String() string {
return fmt.Sprintf("%v", m.err)
}
//Success Message
type MsgSuccess struct {
}
func (m *MsgSuccess) GetMsgType() MsgType {
return MSG_SUCCESS
}
//Success Message
type MsgSuccessOpenStream struct {
activeTs *common.TsVbuuid
}
func (m *MsgSuccessOpenStream) GetMsgType() MsgType {
return MSG_SUCCESS_OPEN_STREAM
}
func (m *MsgSuccessOpenStream) GetActiveTs() *common.TsVbuuid {
return m.activeTs
}
//Timestamp Message
type MsgTimestamp struct {
mType MsgType
ts Timestamp
}
func (m *MsgTimestamp) GetMsgType() MsgType {
return m.mType
}
func (m *MsgTimestamp) GetTimestamp() Timestamp {
return m.ts
}
//Stream Reader Message
type MsgStream struct {
mType MsgType
streamId common.StreamId
meta *MutationMeta
snapshot *MutationSnapshot
}
func (m *MsgStream) GetMsgType() MsgType {
return m.mType
}
func (m *MsgStream) GetMutationMeta() *MutationMeta {
return m.meta
}
func (m *MsgStream) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgStream) GetSnapshot() *MutationSnapshot {
return m.snapshot
}
func (m *MsgStream) String() string {
str := "\n\tMessage: MsgStream"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tStreamId: %v", m.streamId)
str += fmt.Sprintf("\n\tMeta: %v", m.meta)
str += fmt.Sprintf("\n\tSnapshot: %v", m.snapshot)
return str
}
//Stream Error Message
type MsgStreamError struct {
streamId common.StreamId
err Error
}
func (m *MsgStreamError) GetMsgType() MsgType {
return STREAM_READER_ERROR
}
func (m *MsgStreamError) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgStreamError) GetError() Error {
return m.err
}
//STREAM_READER_CONN_ERROR
//STREAM_REQUEST_DONE
type MsgStreamInfo struct {
mType MsgType
streamId common.StreamId
bucket string
vbList []Vbucket
buildTs Timestamp
activeTs *common.TsVbuuid
}
func (m *MsgStreamInfo) GetMsgType() MsgType {
return m.mType
}
func (m *MsgStreamInfo) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgStreamInfo) GetBucket() string {
return m.bucket
}
func (m *MsgStreamInfo) GetVbList() []Vbucket {
return m.vbList
}
func (m *MsgStreamInfo) GetBuildTs() Timestamp {
return m.buildTs
}
func (m *MsgStreamInfo) GetActiveTs() *common.TsVbuuid {
return m.activeTs
}
func (m *MsgStreamInfo) String() string {
str := "\n\tMessage: MsgStreamInfo"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tStream: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tVbList: %v", m.vbList)
return str
}
//STREAM_READER_UPDATE_QUEUE_MAP
type MsgUpdateBucketQueue struct {
bucketQueueMap BucketQueueMap
stats *IndexerStats
bucketFilter map[string]*common.TsVbuuid
}
func (m *MsgUpdateBucketQueue) GetMsgType() MsgType {
return STREAM_READER_UPDATE_QUEUE_MAP
}
func (m *MsgUpdateBucketQueue) GetBucketQueueMap() BucketQueueMap {
return m.bucketQueueMap
}
func (m *MsgUpdateBucketQueue) GetStatsObject() *IndexerStats {
return m.stats
}
func (m *MsgUpdateBucketQueue) GetBucketFilter() map[string]*common.TsVbuuid {
return m.bucketFilter
}
func (m *MsgUpdateBucketQueue) String() string {
str := "\n\tMessage: MsgUpdateBucketQueue"
str += fmt.Sprintf("\n\tBucketQueueMap: %v", m.bucketQueueMap)
return str
}
//OPEN_STREAM
//ADD_INDEX_LIST_TO_STREAM
//REMOVE_BUCKET_FROM_STREAM
//REMOVE_INDEX_LIST_FROM_STREAM
//CLOSE_STREAM
//CLEANUP_STREAM
type MsgStreamUpdate struct {
mType MsgType
streamId common.StreamId
indexList []common.IndexInst
buildTs Timestamp
respCh MsgChannel
stopCh StopChannel
bucket string
restartTs *common.TsVbuuid
rollbackTime int64
}
func (m *MsgStreamUpdate) GetMsgType() MsgType {
return m.mType
}
func (m *MsgStreamUpdate) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgStreamUpdate) GetIndexList() []common.IndexInst {
return m.indexList
}
func (m *MsgStreamUpdate) GetTimestamp() Timestamp {
return m.buildTs
}
func (m *MsgStreamUpdate) GetResponseChannel() MsgChannel {
return m.respCh
}
func (m *MsgStreamUpdate) GetStopChannel() StopChannel {
return m.stopCh
}
func (m *MsgStreamUpdate) GetBucket() string {
return m.bucket
}
func (m *MsgStreamUpdate) GetRestartTs() *common.TsVbuuid {
return m.restartTs
}
func (m *MsgStreamUpdate) GetRollbackTime() int64 {
return m.rollbackTime
}
func (m *MsgStreamUpdate) String() string {
str := "\n\tMessage: MsgStreamUpdate"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tStream: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tBuildTS: %v", m.buildTs)
str += fmt.Sprintf("\n\tIndexList: %v", m.indexList)
str += fmt.Sprintf("\n\tRestartTs: %v", m.restartTs)
return str
}
//MUT_MGR_PERSIST_MUTATION_QUEUE
//MUT_MGR_ABORT_PERSIST
//MUT_MGR_DRAIN_MUTATION_QUEUE
type MsgMutMgrFlushMutationQueue struct {
mType MsgType
bucket string
streamId common.StreamId
ts *common.TsVbuuid
changeVec []bool
}
func (m *MsgMutMgrFlushMutationQueue) GetMsgType() MsgType {
return m.mType
}
func (m *MsgMutMgrFlushMutationQueue) GetBucket() string {
return m.bucket
}
func (m *MsgMutMgrFlushMutationQueue) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgMutMgrFlushMutationQueue) GetTimestamp() *common.TsVbuuid {
return m.ts
}
func (m *MsgMutMgrFlushMutationQueue) GetChangeVector() []bool {
return m.changeVec
}
func (m *MsgMutMgrFlushMutationQueue) String() string {
str := "\n\tMessage: MsgMutMgrFlushMutationQueue"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tStream: %v", m.streamId)
return str
}
//MUT_MGR_GET_MUTATION_QUEUE_HWT
//MUT_MGR_GET_MUTATION_QUEUE_LWT
type MsgMutMgrGetTimestamp struct {
mType MsgType
bucket string
streamId common.StreamId
}
func (m *MsgMutMgrGetTimestamp) GetMsgType() MsgType {
return m.mType
}
func (m *MsgMutMgrGetTimestamp) GetBucket() string {
return m.bucket
}
func (m *MsgMutMgrGetTimestamp) GetStreamId() common.StreamId {
return m.streamId
}
//UPDATE_INSTANCE_MAP
type MsgUpdateInstMap struct {
indexInstMap common.IndexInstMap
stats *IndexerStats
rollbackTimes map[string]int64
}
func (m *MsgUpdateInstMap) GetMsgType() MsgType {
return UPDATE_INDEX_INSTANCE_MAP
}
func (m *MsgUpdateInstMap) GetIndexInstMap() common.IndexInstMap {
return m.indexInstMap
}
func (m *MsgUpdateInstMap) GetStatsObject() *IndexerStats {
return m.stats
}
func (m *MsgUpdateInstMap) GetRollbackTimes() map[string]int64 {
return m.rollbackTimes
}
func (m *MsgUpdateInstMap) String() string {
str := "\n\tMessage: MsgUpdateInstMap"
str += fmt.Sprintf("%v", m.indexInstMap)
return str
}
//UPDATE_PARTITION_MAP
type MsgUpdatePartnMap struct {
indexPartnMap IndexPartnMap
}
func (m *MsgUpdatePartnMap) GetMsgType() MsgType {
return UPDATE_INDEX_PARTITION_MAP
}
func (m *MsgUpdatePartnMap) GetIndexPartnMap() IndexPartnMap {
return m.indexPartnMap
}
func (m *MsgUpdatePartnMap) String() string {
str := "\n\tMessage: MsgUpdatePartnMap"
str += fmt.Sprintf("%v", m.indexPartnMap)
return str
}
//MUT_MGR_FLUSH_DONE
//MUT_MGR_ABORT_DONE
//STORAGE_SNAP_DONE
type MsgMutMgrFlushDone struct {
mType MsgType
ts *common.TsVbuuid
streamId common.StreamId
bucket string
aborted bool
}
func (m *MsgMutMgrFlushDone) GetMsgType() MsgType {
return m.mType
}
func (m *MsgMutMgrFlushDone) GetTS() *common.TsVbuuid {
return m.ts
}
func (m *MsgMutMgrFlushDone) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgMutMgrFlushDone) GetBucket() string {
return m.bucket
}
func (m *MsgMutMgrFlushDone) GetAborted() bool {
return m.aborted
}
func (m *MsgMutMgrFlushDone) String() string {
str := "\n\tMessage: MsgMutMgrFlushDone"
str += fmt.Sprintf("\n\tStream: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tTS: %v", m.ts)
str += fmt.Sprintf("\n\tAborted: %v", m.aborted)
return str
}
//TK_STABILITY_TIMESTAMP
type MsgTKStabilityTS struct {
ts *common.TsVbuuid
streamId common.StreamId
bucket string
changeVec []bool
}
func (m *MsgTKStabilityTS) GetMsgType() MsgType {
return TK_STABILITY_TIMESTAMP
}
func (m *MsgTKStabilityTS) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgTKStabilityTS) GetBucket() string {
return m.bucket
}
func (m *MsgTKStabilityTS) GetTimestamp() *common.TsVbuuid {
return m.ts
}
func (m *MsgTKStabilityTS) GetChangeVector() []bool {
return m.changeVec
}
func (m *MsgTKStabilityTS) String() string {
str := "\n\tMessage: MsgTKStabilityTS"
str += fmt.Sprintf("\n\tStream: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tTS: %v", m.ts)
return str
}
//TK_INIT_BUILD_DONE
//TK_INIT_BUILD_DONE_ACK
type MsgTKInitBuildDone struct {
mType MsgType
streamId common.StreamId
buildTs Timestamp
bucket string
mergeTs *common.TsVbuuid
}
func (m *MsgTKInitBuildDone) GetMsgType() MsgType {
return m.mType
}
func (m *MsgTKInitBuildDone) GetBucket() string {
return m.bucket
}
func (m *MsgTKInitBuildDone) GetTimestamp() Timestamp {
return m.buildTs
}
func (m *MsgTKInitBuildDone) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgTKInitBuildDone) GetMergeTs() *common.TsVbuuid {
return m.mergeTs
}
//TK_MERGE_STREAM
//TK_MERGE_STREAM_ACK
type MsgTKMergeStream struct {
mType MsgType
streamId common.StreamId
bucket string
mergeTs Timestamp
mergeList []common.IndexInst
}
func (m *MsgTKMergeStream) GetMsgType() MsgType {
return m.mType
}
func (m *MsgTKMergeStream) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgTKMergeStream) GetBucket() string {
return m.bucket
}
func (m *MsgTKMergeStream) GetMergeTS() Timestamp {
return m.mergeTs
}
func (m *MsgTKMergeStream) GetMergeList() []common.IndexInst {
return m.mergeList
}
//TK_ENABLE_FLUSH
//TK_DISABLE_FLUSH
type MsgTKToggleFlush struct {
mType MsgType
streamId common.StreamId
bucket string
}
func (m *MsgTKToggleFlush) GetMsgType() MsgType {
return m.mType
}
func (m *MsgTKToggleFlush) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgTKToggleFlush) GetBucket() string {
return m.bucket
}
//CBQ_CREATE_INDEX_DDL
//CLUST_MGR_CREATE_INDEX_DDL
type MsgCreateIndex struct {
mType MsgType
indexInst common.IndexInst
respCh MsgChannel
reqCtx *common.MetadataRequestContext
}
func (m *MsgCreateIndex) GetMsgType() MsgType {
return m.mType
}
func (m *MsgCreateIndex) GetIndexInst() common.IndexInst {
return m.indexInst
}
func (m *MsgCreateIndex) GetResponseChannel() MsgChannel {
return m.respCh
}
func (m *MsgCreateIndex) GetRequestCtx() *common.MetadataRequestContext {
return m.reqCtx
}
func (m *MsgCreateIndex) GetString() string {
str := "\n\tMessage: MsgCreateIndex"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tIndex: %v", m.indexInst)
return str
}
//CLUST_MGR_BUILD_INDEX_DDL
type MsgBuildIndex struct {
indexInstList []common.IndexInstId
bucketList []string
respCh MsgChannel
reqCtx *common.MetadataRequestContext
}
func (m *MsgBuildIndex) GetMsgType() MsgType {
return CLUST_MGR_BUILD_INDEX_DDL
}
func (m *MsgBuildIndex) GetIndexList() []common.IndexInstId {
return m.indexInstList
}
func (m *MsgBuildIndex) GetBucketList() []string {
return m.bucketList
}
func (m *MsgBuildIndex) GetRespCh() MsgChannel {
return m.respCh
}
func (m *MsgBuildIndex) GetRequestCtx() *common.MetadataRequestContext {
return m.reqCtx
}
func (m *MsgBuildIndex) GetString() string {
str := "\n\tMessage: MsgBuildIndex"
str += fmt.Sprintf("\n\tType: %v", CLUST_MGR_BUILD_INDEX_DDL)
str += fmt.Sprintf("\n\tIndex: %v", m.indexInstList)
return str
}
//CLUST_MGR_BUILD_INDEX_DDL_RESPONSE
type MsgBuildIndexResponse struct {
errMap map[common.IndexInstId]error
}
func (m *MsgBuildIndexResponse) GetMsgType() MsgType {
return CLUST_MGR_BUILD_INDEX_DDL_RESPONSE
}
func (m *MsgBuildIndexResponse) GetErrorMap() map[common.IndexInstId]error {
return m.errMap
}
func (m *MsgBuildIndexResponse) GetString() string {
str := "\n\tMessage: MsgBuildIndexResponse"
str += fmt.Sprintf("\n\tType: %v", CLUST_MGR_BUILD_INDEX_DDL_RESPONSE)
str += fmt.Sprintf("\n\terrMap: %v", m.errMap)
return str
}
//CBQ_DROP_INDEX_DDL
//CLUST_MGR_DROP_INDEX_DDL
type MsgDropIndex struct {
mType MsgType
indexInstId common.IndexInstId
bucket string
respCh MsgChannel
reqCtx *common.MetadataRequestContext
}
func (m *MsgDropIndex) GetMsgType() MsgType {
return m.mType
}
func (m *MsgDropIndex) GetIndexInstId() common.IndexInstId {
return m.indexInstId
}
func (m *MsgDropIndex) GetBucket() string {
return m.bucket
}
func (m *MsgDropIndex) GetResponseChannel() MsgChannel {
return m.respCh
}
func (m *MsgDropIndex) GetRequestCtx() *common.MetadataRequestContext {
return m.reqCtx
}
func (m *MsgDropIndex) GetString() string {
str := "\n\tMessage: MsgDropIndex"
str += fmt.Sprintf("\n\tType: %v", m.mType)
str += fmt.Sprintf("\n\tIndex: %v", m.indexInstId)
return str
}
//TK_GET_BUCKET_HWT
//STREAM_READER_HWT
type MsgBucketHWT struct {
mType MsgType
streamId common.StreamId
bucket string
ts *common.TsVbuuid
prevSnap *common.TsVbuuid
}
func (m *MsgBucketHWT) GetMsgType() MsgType {
return m.mType
}
func (m *MsgBucketHWT) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgBucketHWT) GetBucket() string {
return m.bucket
}
func (m *MsgBucketHWT) GetHWT() *common.TsVbuuid {
return m.ts
}
func (m *MsgBucketHWT) GetPrevSnap() *common.TsVbuuid {
return m.prevSnap
}
func (m *MsgBucketHWT) String() string {
str := "\n\tMessage: MsgBucketHWT"
str += fmt.Sprintf("\n\tStreamId: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
return str
}
//KV_SENDER_RESTART_VBUCKETS
type MsgRestartVbuckets struct {
streamId common.StreamId
bucket string
restartTs *common.TsVbuuid
connErrVbs []Vbucket
respCh MsgChannel
stopCh StopChannel
}
func (m *MsgRestartVbuckets) GetMsgType() MsgType {
return KV_SENDER_RESTART_VBUCKETS
}
func (m *MsgRestartVbuckets) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgRestartVbuckets) GetBucket() string {
return m.bucket
}
func (m *MsgRestartVbuckets) GetRestartTs() *common.TsVbuuid {
return m.restartTs
}
func (m *MsgRestartVbuckets) ConnErrVbs() []Vbucket {
return m.connErrVbs
}
func (m *MsgRestartVbuckets) GetResponseCh() MsgChannel {
return m.respCh
}
func (m *MsgRestartVbuckets) GetStopChannel() StopChannel {
return m.stopCh
}
func (m *MsgRestartVbuckets) String() string {
str := "\n\tMessage: MsgRestartVbuckets"
str += fmt.Sprintf("\n\tStreamId: %v", m.streamId)
str += fmt.Sprintf("\n\tBucket: %v", m.bucket)
str += fmt.Sprintf("\n\tRestartTS: %v", m.restartTs)
return str
}
//KV_SENDER_REPAIR_ENDPOINTS
type MsgRepairEndpoints struct {
streamId common.StreamId
endpoints []string
}
func (m *MsgRepairEndpoints) GetMsgType() MsgType {
return KV_SENDER_REPAIR_ENDPOINTS
}
func (m *MsgRepairEndpoints) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgRepairEndpoints) GetEndpoints() []string {
return m.endpoints
}
func (m *MsgRepairEndpoints) String() string {
str := "\n\tMessage: MsgRepairEndpoints"
str += fmt.Sprintf("\n\tStreamId: %v", m.streamId)
str += fmt.Sprintf("\n\tEndpoints: %v", m.endpoints)
return str
}
//INDEXER_INIT_PREP_RECOVERY
//INDEXER_PREPARE_RECOVERY
//INDEXER_PREPARE_DONE
//INDEXER_INITIATE_RECOVERY
//INDEXER_RECOVERY_DONE
//INDEXER_BUCKET_NOT_FOUND
type MsgRecovery struct {
mType MsgType
streamId common.StreamId
bucket string
restartTs *common.TsVbuuid
buildTs Timestamp
activeTs *common.TsVbuuid
}
func (m *MsgRecovery) GetMsgType() MsgType {
return m.mType
}
func (m *MsgRecovery) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgRecovery) GetBucket() string {
return m.bucket
}
func (m *MsgRecovery) GetRestartTs() *common.TsVbuuid {
return m.restartTs
}
func (m *MsgRecovery) GetActiveTs() *common.TsVbuuid {
return m.activeTs
}
func (m *MsgRecovery) GetBuildTs() Timestamp {
return m.buildTs
}
type MsgRollback struct {
streamId common.StreamId
bucket string
rollbackTs *common.TsVbuuid
rollbackTime int64
}
func (m *MsgRollback) GetMsgType() MsgType {
return INDEXER_ROLLBACK
}
func (m *MsgRollback) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgRollback) GetBucket() string {
return m.bucket
}
func (m *MsgRollback) GetRollbackTs() *common.TsVbuuid {
return m.rollbackTs
}
func (m *MsgRollback) GetRollbackTime() int64 {
return m.rollbackTime
}
type MsgRepairAbort struct {
streamId common.StreamId
bucket string
}
func (m *MsgRepairAbort) GetMsgType() MsgType {
return REPAIR_ABORT
}
func (m *MsgRepairAbort) GetStreamId() common.StreamId {
return m.streamId
}
func (m *MsgRepairAbort) GetBucket() string {
return m.bucket
}