tidbSetPDClientForGC is an initialization step of Dumper.
(d *Dumper)
| 1446 | |
| 1447 | // tidbSetPDClientForGC is an initialization step of Dumper. |
| 1448 | func tidbSetPDClientForGC(d *Dumper) error { |
| 1449 | tctx, si, pool := d.tctx, d.conf.ServerInfo, d.dbHandle |
| 1450 | if si.ServerType != version.ServerTypeTiDB || |
| 1451 | si.ServerVersion == nil || |
| 1452 | si.ServerVersion.Compare(*gcSafePointVersion) < 0 { |
| 1453 | return nil |
| 1454 | } |
| 1455 | pdAddrs, err := GetPdAddrs(tctx, pool) |
| 1456 | if err != nil { |
| 1457 | tctx.L().Info("meet some problem while fetching pd addrs. This won't affect dump process", log.ShortError(err)) |
| 1458 | return nil |
| 1459 | } |
| 1460 | if len(pdAddrs) > 0 { |
| 1461 | doPdGC, err := checkSameCluster(tctx, pool, pdAddrs) |
| 1462 | if err != nil { |
| 1463 | tctx.L().Info("meet error while check whether fetched pd addr and TiDB belong to one cluster. This won't affect dump process", log.ShortError(err), zap.Strings("pdAddrs", pdAddrs)) |
| 1464 | } else if doPdGC { |
| 1465 | pdClient, err := pd.NewClientWithContext(tctx, pdAddrs, pd.SecurityOption{}) |
| 1466 | if err != nil { |
| 1467 | tctx.L().Info("create pd client to control GC failed. This won't affect dump process", log.ShortError(err), zap.Strings("pdAddrs", pdAddrs)) |
| 1468 | } |
| 1469 | d.tidbPDClientForGC = pdClient |
| 1470 | } |
| 1471 | } |
| 1472 | return nil |
| 1473 | } |
| 1474 | |
| 1475 | // tidbGetSnapshot is an initialization step of Dumper. |
| 1476 | func tidbGetSnapshot(d *Dumper) error { |
nothing calls this directly
no test coverage detected