You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by "littlepangdi (via GitHub)" <gi...@apache.org> on 2023/04/17 08:13:20 UTC
[GitHub] [incubator-pegasus] littlepangdi opened a new issue, #1446: Add deprecate to TableConnector.Close() to avoid misleading users
littlepangdi opened a new issue, #1446:
URL: https://github.com/apache/incubator-pegasus/issues/1446
## Feature Request
**Is your feature request related to a problem? Please describe:**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
I'd like to propose we add Deprecated to `TableConnector.Close()` for two reasons:
We use golang-client to manage pegasus tables in our project(Loki).
Normally, after create any connection, client should manully call `defer conn.Close()` to avoid any connection leakage if `Close()` exists.
For example:
```
table, err := c.pegasusDB.GetClient().OpenTable(goCtx, tableName)
if err != nil {
//close anyway to make sure session released
if table != nil {
table.Close()
}
errChan <- err
return
}
defer table.Close()
//do something with table
table.MultiSet(timeoutCtx, []byte(hashKey), entry.SortKeys, entry.Values)
```
However, in golang-client sdk, pegasus.Client takeover this job for `TableConnector` and calls it in `Client.Close()`https://github.com/apache/incubator-pegasus/blob/1beb24a765ba009499a6348f82f1ea95ca2a663d/go-client/pegasus/client.go#L82
1. This action indicates that users don't have to call `TableConnector.Close()`.
In golang-client sdk, `TableConnector.Close()` will kill tom and destroy all related goroutine, including `loopForAutoUpdate()`. which makes `TableConnector.Close()` a danger operation since if error like server crushed or restarted occurred, we'd hope config be updated anyway.
2. This method itself indicates `TableConnector.Close()` should not be called by users.
**Describe the feature you'd like:**
<!-- A clear and concise description of what you want to happen. -->
Add Deprecated to `TableConnector.Close()`
**Describe alternatives you've considered:**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
hide `TableConnector.Close()` by changing `Close()` to `close()` since it's in-package call only.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org
[GitHub] [incubator-pegasus] hycdong closed issue #1446: Add deprecate to go-client TableConnector.Close() to avoid misleading users
Posted by "hycdong (via GitHub)" <gi...@apache.org>.
hycdong closed issue #1446: Add deprecate to go-client TableConnector.Close() to avoid misleading users
URL: https://github.com/apache/incubator-pegasus/issues/1446
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org
[GitHub] [incubator-pegasus] littlepangdi commented on issue #1446: Add deprecate to go-client TableConnector.Close() to avoid misleading users
Posted by "littlepangdi (via GitHub)" <gi...@apache.org>.
littlepangdi commented on issue #1446:
URL: https://github.com/apache/incubator-pegasus/issues/1446#issuecomment-1510967129
This issue is also related to #1385 , normally, when replica server is restarted , client should update config and build connect with another server ip.
I suspect that the reason config is not updated successful is that `TableConnector.Close()` is called and `loopForAutoUpdate()` is interrupted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org