/
bootstrap.go
618 lines (561 loc) · 19.4 KB
/
bootstrap.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
// Copyright (c) 2017-2018 Uber Technologies, 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 memstore
import (
"context"
"io"
"math"
"math/rand"
"strconv"
"sync"
"sync/atomic"
"time"
m3Shard "github.com/m3db/m3/src/cluster/shard"
xerrors "github.com/m3db/m3/src/x/errors"
xretry "github.com/m3db/m3/src/x/retry"
xsync "github.com/m3db/m3/src/x/sync"
"github.com/uber/aresdb/cluster/topology"
"github.com/uber/aresdb/datanode/bootstrap"
"github.com/uber/aresdb/datanode/client"
"github.com/uber/aresdb/datanode/generated/proto/rpc"
"github.com/uber/aresdb/utils"
)
// IsBootstrapped returns whether this table shard is bootstrapped.
func (shard *TableShard) IsBootstrapped() bool {
shard.bootstrapLock.Lock()
defer shard.bootstrapLock.Unlock()
return shard.BootstrapState == bootstrap.Bootstrapped
}
// IsDiskDataAvailable returns whether the data is available on disk for table shard
func (shard *TableShard) IsDiskDataAvailable() bool {
return atomic.LoadUint32(&shard.needPeerCopy) != 1
}
func (m *memStoreImpl) Bootstrap(
peerSource client.PeerSource,
origin string,
topo topology.Topology,
topoState *topology.StateSnapshot,
options bootstrap.Options,
) error {
// snapshot table shards not bootstrapped
m.RLock()
tableShards := make([]*TableShard, 0)
for _, shardMap := range m.TableShards {
for _, shard := range shardMap {
if !shard.IsBootstrapped() {
shard.Users.Add(1)
tableShards = append(tableShards, shard)
}
}
}
m.RUnlock()
// partition table shards based on whether it needs to copy data from peer
// so that we can start process those doesn't first
nonInitializingEnd := 0
for i := 0; i < len(tableShards); i++ {
// if doesn't need peer copy, swap into the first half
if atomic.LoadUint32(&tableShards[i].needPeerCopy) == 0 {
tableShards[i], tableShards[nonInitializingEnd] = tableShards[nonInitializingEnd], tableShards[i]
nonInitializingEnd++
}
}
workers := xsync.NewWorkerPool(options.MaxConcurrentTableShards())
workers.Init()
var (
multiErr = xerrors.NewMultiError()
mutex sync.Mutex
wg sync.WaitGroup
)
for _, shard := range tableShards {
shard := shard
wg.Add(1)
workers.Go(func() {
err := shard.Bootstrap(peerSource, origin, topo, topoState, options)
if err != nil {
mutex.Lock()
multiErr = multiErr.Add(err)
mutex.Unlock()
}
wg.Done()
shard.Users.Done()
})
}
wg.Wait()
return multiErr.FinalError()
}
// Bootstrap executes bootstrap for table shard
func (shard *TableShard) Bootstrap(
peerSource client.PeerSource,
origin string,
topo topology.Topology,
topoState *topology.StateSnapshot,
options bootstrap.Options,
) error {
shard.bootstrapLock.Lock()
// check whether shard is already bootstrapping
if shard.BootstrapState == bootstrap.Bootstrapping {
shard.bootstrapLock.Unlock()
return bootstrap.ErrTableShardIsBootstrapping
}
shard.BootstrapState = bootstrap.Bootstrapping
shard.bootstrapLock.Unlock()
shard.Schema.RLock()
numColumns := len(shard.Schema.GetValueTypeByColumn())
schema := shard.Schema.Schema
shard.Schema.RUnlock()
shard.BootstrapDetails.Clear()
shard.BootstrapDetails.SetNumColumns(numColumns)
success := false
defer func() {
shard.bootstrapLock.Lock()
if success {
shard.BootstrapState = bootstrap.Bootstrapped
} else {
shard.BootstrapState = bootstrap.BootstrapNotStarted
}
shard.bootstrapLock.Unlock()
}()
if atomic.LoadUint32(&shard.needPeerCopy) == 1 {
shard.BootstrapDetails.SetBootstrapStage(bootstrap.PeerCopy)
// find peer node for copy metadata and raw data
peerNodes := shard.findBootstrapSource(origin, topo, topoState)
if len(peerNodes) == 0 {
utils.GetLogger().
With("table", shard.Schema.Schema.Name).
With("shardID", shard.ShardID).
With("origin", origin).
With("source", "").
Info("no available bootstrap source")
return utils.StackError(nil, "no peer node available")
}
utils.GetLogger().
With("table", shard.Schema.Schema.Name).
With("shardID", shard.ShardID).
With("peers", peerNodes).
Info("found peer to bootstrap from")
// shuffle peer nodes randomly
rand.New(rand.NewSource(utils.Now().Unix())).Shuffle(len(peerNodes), func(i, j int) {
peerNodes[i], peerNodes[j] = peerNodes[j], peerNodes[i]
})
var dataStreamErr error
borrowErr := peerSource.BorrowConnection(peerNodes, func(peerID string, nodeClient rpc.PeerDataNodeClient) {
shard.BootstrapDetails.SetSource(peerID)
dataStreamErr = shard.fetchDataFromPeer(peerID, nodeClient, origin, options)
})
if borrowErr != nil {
return borrowErr
}
if dataStreamErr != nil {
return dataStreamErr
}
atomic.StoreUint32(&shard.needPeerCopy, 0)
}
// load metadata from disk
err := shard.LoadMetaData()
if err != nil {
return err
}
shard.BootstrapDetails.SetBootstrapStage(bootstrap.Preload)
// preload snapshot or archive batches into memory
if schema.IsFactTable {
// preload all columns for fact table
endDay := int(utils.Now().Unix() / 86400)
for columnID, column := range schema.Columns {
if column.Deleted {
continue
}
shard.PreloadColumn(columnID, endDay-column.Config.PreloadingDays, endDay)
}
} else {
// preload snapshot for dimension table
err = shard.LoadSnapshot()
if err != nil {
return err
}
}
shard.BootstrapDetails.SetBootstrapStage(bootstrap.Recovery)
// start play redolog
shard.PlayRedoLog()
success = true
shard.BootstrapDetails.SetBootstrapStage(bootstrap.Finished)
return nil
}
type vpRawDataRequest struct {
tableShardMeta *rpc.TableShardMetaData
batchMeta *rpc.BatchMetaData
vpMeta *rpc.VectorPartyMetaData
}
// fetchDataFromPeer fetch metadata and raw vector party data from peer
func (shard *TableShard) fetchDataFromPeer(
peerID string,
client rpc.PeerDataNodeClient,
origin string,
options bootstrap.Options,
) error {
sessionID, doneFn, err := shard.startStreamSession(peerID, client, origin, options)
if err != nil {
return err
}
defer doneFn()
// 1. fetch meta data
tableShardMeta, err := shard.fetchBatchMetaDataFromPeer(origin, sessionID, client)
if err != nil {
return err
}
// 2. set metadata and trigger recovery
if err := shard.setTableShardMetadata(tableShardMeta); err != nil {
return err
}
// 3. fetch raw vps
workerPool := xsync.NewWorkerPool(options.MaxConcurrentStreamsPerTableShards())
workerPool.Init()
retrier := xretry.NewRetrier(xretry.NewOptions().SetMaxRetries(3))
var (
mutex sync.Mutex
errors xerrors.MultiError
wg sync.WaitGroup
)
for _, batchMeta := range tableShardMeta.Batches {
err := shard.setBatchMetadata(tableShardMeta, batchMeta)
if err != nil {
return utils.StackError(err, "failed to set batch level metadata")
}
for _, vpMeta := range batchMeta.Vps {
shard.BootstrapDetails.AddVPToCopy(batchMeta.GetBatchID(), vpMeta.GetColumnID())
}
}
fetchStart := utils.Now()
for _, batchMeta := range tableShardMeta.Batches {
for _, vpMeta := range batchMeta.Vps {
// capture batchMeta and vpMeta
batchMeta := batchMeta
vpMeta := vpMeta
wg.Add(1)
// TODO: add checksum to vp file and vpMeta to avoid copying existing data on disk
workerPool.Go(func() {
defer wg.Done()
attempts := 0
err = retrier.Attempt(func() error {
attempts++
request, vpWriter, err := shard.createVectorPartyRawDataRequest(origin, sessionID, tableShardMeta, batchMeta, vpMeta)
if err != nil {
utils.GetLogger().
With("peer", peerID, "table", shard.Schema.Schema.Name, "shard", shard.ShardID, "batch", batchMeta.GetBatchID(), "column", vpMeta.GetColumnID(), "request", request, "error", err.Error()).
Errorf("failed to create vector party raw data request, attempt %d", attempts)
return err
}
defer vpWriter.Close()
fetchStart := utils.Now()
bytesFetched, err := shard.fetchVectorPartyRawDataFromPeer(client, vpWriter, request)
if err != nil {
utils.GetLogger().
With("peer", peerID, "table", shard.Schema.Schema.Name, "shard", shard.ShardID, "batch", batchMeta.GetBatchID(), "column", vpMeta.GetColumnID(), "request", request, "error", err.Error()).
Errorf("failed to fetch data from peer, attempt %d", attempts)
return err
}
duration := utils.Now().Sub(fetchStart)
utils.GetLogger().
With("peer", peerID, "table", shard.Schema.Schema.Name, "shard", shard.ShardID, "batch", batchMeta.GetBatchID(), "column", vpMeta.GetColumnID(), "request", request).
Infof("successfully fetched data (%d bytes) from peer, took %f seconds, attempt %d", bytesFetched, duration.Seconds(), attempts)
utils.GetReporter(tableShardMeta.Table, int(tableShardMeta.Shard)).
GetChildTimer(map[string]string{
"batch": strconv.Itoa(int(batchMeta.GetBatchID())),
"column": strconv.Itoa(int(vpMeta.GetColumnID())),
}, utils.RawVPFetchTime).Record(duration)
utils.GetReporter(tableShardMeta.Table, int(tableShardMeta.Shard)).GetChildCounter(
map[string]string{
"batch": strconv.Itoa(int(batchMeta.GetBatchID())),
"column": strconv.Itoa(int(vpMeta.GetColumnID())),
}, utils.RawVPBytesFetched).Inc(int64(bytesFetched))
utils.GetReporter(tableShardMeta.Table, int(tableShardMeta.Shard)).
GetChildGauge(map[string]string{
"batch": strconv.Itoa(int(batchMeta.GetBatchID())),
"column": strconv.Itoa(int(vpMeta.GetColumnID())),
}, utils.RawVPFetchBytesPerSec).Update(float64(bytesFetched) / duration.Seconds())
shard.BootstrapDetails.MarkVPFinished(batchMeta.GetBatchID(), vpMeta.GetColumnID())
return nil
})
if err != nil {
mutex.Lock()
errors = errors.Add(err)
mutex.Unlock()
utils.GetReporter(tableShardMeta.GetTable(), int(tableShardMeta.GetShard())).GetCounter(utils.RawVPFetchFailure).Inc(1)
} else {
utils.GetReporter(tableShardMeta.GetTable(), int(tableShardMeta.GetShard())).GetCounter(utils.RawVPFetchSuccess).Inc(1)
}
})
}
}
wg.Wait()
if !errors.Empty() {
return errors.FinalError()
}
utils.GetReporter(tableShardMeta.Table, int(tableShardMeta.Shard)).GetTimer(utils.TotalRawVPFetchTime).Record(utils.Now().Sub(fetchStart))
return nil
}
func (shard *TableShard) fetchBatchMetaDataFromPeer(origin string, sessionID int64, client rpc.PeerDataNodeClient) (*rpc.TableShardMetaData, error) {
var (
endBatchID int32 = math.MaxInt32
startBatchID int32 = math.MinInt32
)
shard.Schema.RLock()
if shard.Schema.Schema.IsFactTable {
endBatchID = int32(utils.Now().Unix() / 86400)
}
if shard.Schema.Schema.IsFactTable && shard.Schema.Schema.Config.RecordRetentionInDays > 0 {
startBatchID = endBatchID - int32(shard.Schema.Schema.Config.RecordRetentionInDays) + 1
}
shard.Schema.RUnlock()
req := &rpc.TableShardMetaDataRequest{
Table: shard.Schema.Schema.Name,
Incarnation: int32(shard.Schema.Schema.Incarnation),
Shard: uint32(shard.ShardID),
StartBatchID: startBatchID,
SessionID: sessionID,
NodeID: origin,
EndBatchID: endBatchID,
}
return client.FetchTableShardMetaData(context.Background(), req)
}
func (shard *TableShard) createVectorPartyRawDataRequest(
origin string,
sessionID int64,
tableMeta *rpc.TableShardMetaData,
batchMeta *rpc.BatchMetaData,
vpMeta *rpc.VectorPartyMetaData,
) (rawVPDataRequest *rpc.VectorPartyRawDataRequest, vpWriter io.WriteCloser, err error) {
if shard.Schema.Schema.IsFactTable {
// fact table archive vp writer
vpWriter, err = shard.diskStore.OpenVectorPartyFileForWrite(tableMeta.GetTable(),
int(vpMeta.GetColumnID()),
int(tableMeta.GetShard()), int(batchMeta.GetBatchID()),
batchMeta.GetArchiveVersion().GetArchiveVersion(),
batchMeta.GetArchiveVersion().GetBackfillSeq())
rawVPDataRequest = &rpc.VectorPartyRawDataRequest{
SessionID: sessionID,
NodeID: origin,
Table: tableMeta.GetTable(),
Shard: tableMeta.GetShard(),
Incarnation: tableMeta.GetIncarnation(),
BatchID: int32(batchMeta.GetBatchID()),
Version: &rpc.VectorPartyRawDataRequest_ArchiveVersion{
ArchiveVersion: &rpc.ArchiveVersion{
ArchiveVersion: batchMeta.GetArchiveVersion().GetArchiveVersion(),
BackfillSeq: batchMeta.GetArchiveVersion().GetBackfillSeq(),
},
},
ColumnID: vpMeta.GetColumnID(),
}
} else {
// dimension table snapshot vp writer
vpWriter, err = shard.diskStore.OpenSnapshotVectorPartyFileForWrite(
tableMeta.GetTable(),
int(tableMeta.GetShard()),
tableMeta.GetDimensionMeta().GetSnapshotVersion().GetRedoFileID(),
tableMeta.GetDimensionMeta().GetSnapshotVersion().GetRedoFileOffset(),
int(batchMeta.GetBatchID()),
int(vpMeta.GetColumnID()))
rawVPDataRequest = &rpc.VectorPartyRawDataRequest{
SessionID: sessionID,
NodeID: origin,
Table: tableMeta.GetTable(),
Shard: tableMeta.GetShard(),
Incarnation: tableMeta.GetIncarnation(),
BatchID: int32(batchMeta.GetBatchID()),
Version: &rpc.VectorPartyRawDataRequest_SnapshotVersion{
SnapshotVersion: tableMeta.GetDimensionMeta().GetSnapshotVersion(),
},
ColumnID: vpMeta.GetColumnID(),
}
}
return
}
func (shard *TableShard) fetchVectorPartyRawDataFromPeer(
client rpc.PeerDataNodeClient,
vpWriter io.WriteCloser,
request *rpc.VectorPartyRawDataRequest,
) (int, error) {
stream, err := client.FetchVectorPartyRawData(context.Background(), request)
if err != nil {
return 0, err
}
totalBytes := 0
for {
data, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
return totalBytes, err
}
bytesWritten, err := vpWriter.Write(data.Chunk)
if err != nil {
return totalBytes, err
}
totalBytes += bytesWritten
}
return totalBytes, nil
}
func (shard *TableShard) setBatchMetadata(tableShardMeta *rpc.TableShardMetaData, batchMeta *rpc.BatchMetaData) error {
if shard.Schema.Schema.IsFactTable {
err := shard.metaStore.OverwriteArchiveBatchVersion(shard.Schema.Schema.Name, shard.ShardID,
int(batchMeta.BatchID),
batchMeta.GetArchiveVersion().GetArchiveVersion(),
batchMeta.GetArchiveVersion().GetBackfillSeq(),
int(batchMeta.GetSize()))
if err != nil {
return err
}
}
return nil
}
func (shard *TableShard) setTableShardMetadata(tableShardMeta *rpc.TableShardMetaData) error {
// update kafka offsets
err := shard.metaStore.UpdateRedoLogCommitOffset(shard.Schema.Schema.Name, shard.ShardID, tableShardMeta.GetKafkaOffset().GetCommitOffset())
if err != nil {
return utils.StackError(err, "failed to update kafka commit offset")
}
err = shard.metaStore.UpdateRedoLogCheckpointOffset(shard.Schema.Schema.Name, shard.ShardID, tableShardMeta.GetKafkaOffset().GetCheckPointOffset())
if err != nil {
return utils.StackError(err, "failed to update archiving cutoff")
}
if shard.Schema.Schema.IsFactTable {
// update archiving low water mark cutoff and backfill progress for fact table
err := shard.metaStore.UpdateArchivingCutoff(shard.Schema.Schema.Name, shard.ShardID, tableShardMeta.GetFactMeta().GetHighWatermark())
if err != nil {
return utils.StackError(err, "failed to update archiving cutoff")
}
err = shard.metaStore.UpdateBackfillProgress(shard.Schema.Schema.Name, shard.ShardID, tableShardMeta.GetFactMeta().GetBackfillCheckpoint().GetRedoFileID(), tableShardMeta.GetFactMeta().GetBackfillCheckpoint().GetRedoFileOffset())
if err != nil {
return utils.StackError(err, "failed to update backfill progress")
}
} else {
// update snapshot pregress for dimension table
err := shard.metaStore.UpdateSnapshotProgress(
shard.Schema.Schema.Name,
shard.ShardID, tableShardMeta.GetDimensionMeta().GetSnapshotVersion().GetRedoFileID(),
tableShardMeta.GetDimensionMeta().GetSnapshotVersion().GetRedoFileOffset(),
tableShardMeta.GetDimensionMeta().GetLastBatchID(),
uint32(tableShardMeta.GetDimensionMeta().GetLastBatchSize()))
if err != nil {
return utils.StackError(err, "failed to update archiving cutoff")
}
}
return nil
}
func (shard *TableShard) startStreamSession(peerID string, client rpc.PeerDataNodeClient, origin string, options bootstrap.Options) (sessionID int64, doneFn func(), err error) {
done := make(chan struct{})
ttl := int64(options.BootstrapSessionTTL())
startSessionRequest := &rpc.StartSessionRequest{
Table: shard.Schema.Schema.Name,
Shard: uint32(shard.ShardID),
NodeID: origin,
Ttl: ttl,
}
session, err := client.StartSession(context.Background(), startSessionRequest)
if err != nil {
return 0, nil, utils.StackError(err, "failed to start session")
}
sessionID = session.ID
stream, err := client.KeepAlive(context.Background())
if err != nil {
return 0, nil, utils.StackError(err, "failed to create keep alive stream")
}
// send loop
go func(stream rpc.PeerDataNode_KeepAliveClient) {
for {
ticker := time.NewTicker(time.Duration(atomic.LoadInt64(&ttl) / 2))
select {
case <-ticker.C:
err = xretry.NewRetrier(xretry.NewOptions()).Attempt(func() error {
return stream.Send(&rpc.Session{ID: sessionID, NodeID: origin})
})
if err != nil {
utils.GetLogger().
With(
"table", shard.Schema.Schema.Name,
"shard", shard.ShardID,
"error", err.Error(),
"peer", peerID).
Error("failed to send keep alive session")
}
case <-done:
err = stream.CloseSend()
if err != nil {
utils.GetLogger().
With(
"table",
shard.Schema.Schema.Name,
"shard", shard.ShardID,
"error", err.Error(),
"peer", peerID).
Error("failed to close keep alive session")
}
return
}
}
}(stream)
// receive loop
go func(stream rpc.PeerDataNode_KeepAliveClient) {
for {
resp, err := stream.Recv()
if err == io.EOF {
// server closed the stream
utils.GetLogger().With("table", shard.Schema.Schema.Name, "shard", shard.ShardID).Error("server closed keep alive session")
return
} else if err != nil {
utils.GetLogger().With("table", shard.Schema.Schema.Name, "shard", shard.ShardID, "error", err.Error()).Error("received error from keep alive session")
return
}
if resp.Ttl > 0 {
atomic.StoreInt64(&ttl, resp.Ttl)
}
}
}(stream)
return sessionID, func() {
close(done)
}, nil
}
func (shard *TableShard) findBootstrapSource(
origin string, topo topology.Topology, topoState *topology.StateSnapshot) []string {
peers := make([]string, 0, topo.Get().HostsLen())
hostShardStates, ok := topoState.ShardStates[topology.ShardID(shard.ShardID)]
if !ok {
// This shard was not part of the topology when the bootstrapping
// process began.
return nil
}
for _, hostShardState := range hostShardStates {
if hostShardState.Host.ID() == origin {
// Don't take self into account
continue
}
shardState := hostShardState.ShardState
switch shardState {
// Don't want to peer bootstrap from a node that has not yet completely
// taken ownership of the shard.
case m3Shard.Initializing:
// Success cases - We can bootstrap from this host, which is enough to
// mark this shard as bootstrappable.
case m3Shard.Leaving:
fallthrough
case m3Shard.Available:
peers = append(peers, hostShardState.Host.ID())
case m3Shard.Unknown:
fallthrough
default:
}
}
return peers
}