@@ -163,11 +163,11 @@ func (is *InfoSyncer) getTopologyInfo(cfg *config.Config) (*TopologyInfo, error)
163163 ip := sys .GetLocalIP ()
164164 _ , port , err := net .SplitHostPort (cfg .Proxy .Addr )
165165 if err != nil {
166- return nil , err
166+ return nil , errors . WithStack ( err )
167167 }
168168 _ , statusPort , err := net .SplitHostPort (cfg .API .Addr )
169169 if err != nil {
170- return nil , err
170+ return nil , errors . WithStack ( err )
171171 }
172172 return & TopologyInfo {
173173 Version : versioninfo .TiProxyVersion ,
@@ -202,7 +202,7 @@ func (is *InfoSyncer) storeTopologyInfo(ctx context.Context, topologyInfo *Topol
202202 childCtx , cancel := context .WithTimeout (ctx , is .syncConfig .putTimeout )
203203 _ , err := is .etcdCli .Put (childCtx , key , value , clientv3 .WithLease (is .topologySession .Lease ()))
204204 cancel ()
205- return err
205+ return errors . WithStack ( err )
206206 }, ctx , is .syncConfig .putRetryIntvl , is .syncConfig .putRetryCnt )
207207}
208208
@@ -214,7 +214,7 @@ func (is *InfoSyncer) updateTopologyAliveness(ctx context.Context, topologyInfo
214214 childCtx , cancel := context .WithTimeout (ctx , is .syncConfig .putTimeout )
215215 _ , err := is .etcdCli .Put (childCtx , key , value , clientv3 .WithLease (is .topologySession .Lease ()))
216216 cancel ()
217- return err
217+ return errors . WithStack ( err )
218218 }, ctx , is .syncConfig .putRetryIntvl , is .syncConfig .putRetryCnt )
219219}
220220
@@ -224,14 +224,14 @@ func (is *InfoSyncer) removeTopology(ctx context.Context) error {
224224 childCtx , cancel := context .WithTimeout (ctx , is .syncConfig .putTimeout )
225225 _ , err := is .etcdCli .Delete (childCtx , tiproxyTopologyPath , clientv3 .WithPrefix ())
226226 cancel ()
227- return err
227+ return errors . WithStack ( err )
228228}
229229
230230func (is * InfoSyncer ) GetTiDBTopology (ctx context.Context ) (map [string ]* TiDBInfo , error ) {
231231 // etcdCli.Get will retry infinitely internally.
232232 res , err := is .etcdCli .Get (ctx , tidbinfo .TopologyInformationPath , clientv3 .WithPrefix ())
233233 if err != nil {
234- return nil , err
234+ return nil , errors . WithStack ( err )
235235 }
236236
237237 infos := make (map [string ]* TiDBInfo , len (res .Kvs )/ 2 )
@@ -280,7 +280,7 @@ func (is *InfoSyncer) Close() error {
280280 }
281281 if is .etcdCli != nil {
282282 if err := is .etcdCli .Close (); err != nil {
283- errs = append (errs , err )
283+ errs = append (errs , errors . WithStack ( err ) )
284284 }
285285 }
286286 return errors .Collect (errors .New ("closing InfoSyncer" ), errs ... )
0 commit comments