[JAVA-5288] Sessions do not work with deployments with hidden members Created: 05/Jan/24 Updated: 30/Jan/24 Resolved: 30/Jan/24 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Sessions |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Unknown |
| Reporter: | Libor Danek | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||
| Description |
SummaryI'm unable to unable to start session on a deployment that contains hidden member. Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).Driver version is 3.12.11. I believe all versions are affected. See the next section for a topology compose file. How to ReproduceSee this github repository containing reproduction. Run the compose file and test. Additional BackgroundWhy I think this is a bug. Server sessions documentation contains no mention of sessions not being available for hidden members. Same holds for sessions specification. Also docs on hidden members contain no information on that and present hidden member as a secondary. Driver code. I've checked the driver code as information why this should not work was not available elsewhere. While session is started (MongoClientDelegate.createClientSession), ClusterDescription.getLogicalSessionTimeoutMinutes is used to determine whether sessions are supported by a cluster – as advised by sessions specification. That method filters ServerDescriptions picking only primary and secondary. With this deployment and way of connecting, there is only one server description – hidden member which has a type REPLICA_SET_OTHER }}hence will be filtered out. But the hidden member docs advertise it as a {{{}secondary. And also this hidden member has value of logicalSessionTimeoutMinutes set, so I presume it should be capable of handling sessions. Possible solution. Would it make sense to consider hidden member secondary? Why do I need this? Hidden member docs advise to use this feature for non-standard workloads as eg. analytics. That exactly is my use case. I need to use sessions here to be able to kill running operations. Aside on standalone deployments. General docs I've linked say, that sessions are only available for replica sets and sharded clusters. But we are able to run sessions also on standalone deployments. It seems like inconsistency. Thank you in advance for looking into this. |
| Comments |
| Comment by Jeffrey Yemin [ 16/Jan/24 ] |
|
Yes, that's right. I think that's the only thing you can do with a session on a standalone. |
| Comment by Libor Danek [ 16/Jan/24 ] |
|
I'm using sessions to kill running aggregations. Timeout is not an option for me, as the aggregation needs to be killed in a moment when eg. user decides it is taking too long. I'm not sure if killing a session is what you've meant in this comment, but after reading it and reading the java api, I've found that the most straightforward way of achieving what I needed. |
| Comment by Jeffrey Yemin [ 16/Jan/24 ] |
|
There is some ambiguity here. While it's true that standalones support sessions, the support they provide is very limited. In particular, they don't support
So while it's technically true that you can start a ClientSession on a standalone, you can't do much with it. |
| Comment by Libor Danek [ 16/Jan/24 ] |
|
The library is called [monger|https://github.com/michaelklishin/monger]. It is a clojure library. It uses 3.12.11 mongo java driver version. Interface for sessions is not provided there, so I had to use driver java driver code directly. As I'm using only a small subset of what it provides, I'll attempt to wrap newer version of the java driver alone and see later if it would make sense to attempt merging my code that back into the library.
With regards documentation change, I'm able to start session eg. on standalone deployment, which is ruled out by the sentence "...sessions are only available for replica sets and sharded clusters...". Link to the doc is in the ticket description. Moreover, eg. sessions test spec mentions that: "...all regular 3.6+ servers support sessions...". If the latter is true, I believe that should be mentioned in the docs instead. If not, I believe I should be able to find there a mention of standalone deployment compatibility.
Thanks for the clarification in advance, if my interpretation is incorrect |
| Comment by Jeffrey Yemin [ 15/Jan/24 ] |
|
> I'm using the driver as part of another library, but I'll attempt the upgrade. Let us know which library please, and also whether the upgrade is successful. > I believe that line is not correct. Should I open another ticket for that? I can do it on your behalf, but what would you like it to say instead? |
| Comment by Libor Danek [ 15/Jan/24 ] |
|
Hello jeff.yemin@mongodb.com. Thank you for the prompt reply. Good to know that sessions work with hidden members from version 4.10.0. I'm using the driver as part of another library, but I'll attempt the upgrade. I believe we can close this issue.
With regards to server sessions documentation mentioning that "Server sessions are available for replica sets and sharded clusters only", I believe that line is not correct. Should I open another ticket for that? |
| Comment by PM Bot [ 15/Jan/24 ] |
|
Hi lbr.dnk@posteo.net! If this is still an issue for you, please open Jira to review the latest status and provide your feedback. Thanks! |
| Comment by Jeffrey Yemin [ 05/Jan/24 ] |
|
Hi lbr.dnk@posteo.net , I suspect this was an oversight in the original specification, or perhaps the Java driver's implementation, of client sessions. In scope of Given that you are the first to report this issue, I gather that the combination of hidden members and sessions is uncommon. Sorry this bit you and I hope you are able to upgrade the driver. |
| Comment by PM Bot [ 05/Jan/24 ] |
|
Hi lbr.dnk@posteo.net, thank you for reporting this issue! The team will look into it and get back to you soon. |