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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]