Repository navigation
Conversation
MongoClientSettings#getStreamFactoryFactory() MongoClientSettings.Builder#streamFactoryFactory(StreamFactoryFactory) AsynchronousSocketChannelStreamFactory AsynchronousSocketChannelStreamFactoryFactory BufferProvider SocketStreamFactory Stream StreamFactory StreamFactoryFactory TlsChannelStreamFactoryFactory NettyStreamFactory NettyStreamFactoryFactory JAVA-5161
* Remove builders * Remove now-unused factory configuration * Simplify usage in MongoClient instantiation JAVA-5161
* ServerAddress#getSocketAddress * ServerAddress#getSocketAddresses * UnixServerAddress#getSocketAddress * UnixServerAddress#getUnixSocketAddress JAVA-4937
Since we ended up adding explain support to FindIterable, no reason to leave it deprecated in the legacy API. JAVA-5154
The dead code is a remnant of when the driver supported the full range of OP_REPLY wire protocol message usage. Since the driver now only runs against MongoDB releases that support OP_MSG, OP_REPLY is only used for the response to the `hello` command in the handshake, and therefore most of the OP_REPLY-handling code is no longer on any execution paths. JAVA-5204
Now that Stream is not part of the API, this method can be removed. It only existed due to the possibility that an application creates its own Stream implementation. JAVA-5180
* getStats * isCapped JAVA-5116
JAVA-5149
from the following internal interfaces: * ClusterAwareReadWriteBinding * AsyncClusterAwareReadWriteBinding The interfaces remain as they have picket up a second method. JAVA-5217
JAVA-5142
Since StreamFactoryFactory is now internal, just made that interface extend AutoCloseable in order to simplify MongoClients code JAVA-5158
* ConnectionPoolOpenedEvent * ConnectionAddedEvent * ConnectionRemovedEvent * ConnectionPoolListener#connectionPoolOpened * ConnectionPoolListener#connectionAdded * ConnectionPoolListener#connectionRemoved JAVA-5151
* ClusterListenerAdapter * ConnectionPoolListenerAdapter * ServerListenerAdapter * ServerMonitorListenerAdapter JAVA-5151
JAVA-5142
JAVA-5142
It's still used by IterableCodecProvider, so it can't be removed entirely. (Though IterableCodecProvider is almost entirely supplanted by CollectionCodecProvider, it was not itself deprecated because it provides a codec for any Iterable, while CollectionCodecProvider only provides one for any Collection, which is not quite the same thing). JAVA-5142
There was a problem hiding this comment.
There are alternatives to ignoring the option, as described in the "API design" section of the PR description.
495d60e to
18dbb33
Compare
rozza
left a comment
There was a problem hiding this comment.
I'm not 100% sure its worth adding a ListCollection Mapper type to wrap the Observable / Iterable. As listCollectionNames is a helper built on top of listCollections it be easier if it automatically sets authorizedCollections=true.
What do you think?
The listCollections and listDatabases API should be inline - so either way this may require another ticket to bring the listDatabase method inline.
There was a problem hiding this comment.
This is annoying that its needed.
There was a problem hiding this comment.
1) I'm not 100% sure its worth adding a ListCollection Mapper type to wrap the Observable / Iterable.
If we don't have
ListCollectionsIterableImpl.mapreturningListCollectionsIterableListCollectionsPublisherImpl.mapreturningListCollectionsPublisher
how will
com.mongodb.client.internal.MongoDatabaseImpl.listCollectionNamescom.mongodb.reactivestreams.client.internal.MongoDatabaseImpl.listCollectionNames
be implemented?
2) As listCollectionNames is a helper built on top of listCollections it be easier if it automatically sets authorizedCollections=true.
listCollectionNames can set authorizedCollections=true automatically only if it know when a user wants authorizedCollections=true, and when a user doesn't want it. But how will listCollectionNames know that information without a user explicitly providing it?
3) The listCollections and listDatabases API should be inline - so either way this may require another ticket to bring the listDatabase method inline.
- They have already been different: there is
ListDatabasesIterable.nameOnly, while the same option forListCollectionsIterablecan be set only internally by the driver whenlistCollectionNamesis called. If we exposeListDatabasesIterablefromlistDatabaseNames, then a user will be able to callListDatabasesIterable.nameOnly(false), which does not make sense. However, if we haveListDatabaseNamesIterable(similarly toListCollectionNamesIterable, which is the solution Jeff prefers, then we won't have to exposenameOnlywhenlistDatabaseNamesis called. Note that even if we have a ticket to deal with this (I'll create it), it can only be done in a major release, and I am not sure we want to do it in the upcoming major release. - The
ListCollectionsPublisherImpl.mapmethod added in the PR is not part of API, it's an internal method. While a similar method could be added toListDatabasesPublisherImplnow, it will be unused. I don't think we should add unused internal method toListDatabasesPublisherImplonly because a similar method is present onListCollectionsPublisherImpl.
jyemin
left a comment
There was a problem hiding this comment.
Regarding the API design, I am inclined to go with option 2 and introduce new ListCollectionNamesIterable and related interfaces. It is more work to maintain but will protect against the existing weirdness of having an option that is ignored for listCollections and the possibility of more options like this being added in the future.
Somehow we ended up with three nearly identical classes, all of which were unnecessarily complicated. Remove two of them and simplify the remaining one to use CompletableFuture.
This turned out surprisingly non-trivial (I am talking only about synchronous Java API, haven't touched anything else). The approach I tried yesterday was a dead end. I have another one in mind. |
ce47fa2 to
bcc7ac1
Compare
2a015f6 to
60baa8a
Compare
JAVA-4353
JAVA-4353
c076264 to
7b3312a
Compare
Done in #1270. |
This PR is based on the original #855.
API changes
MongoDatabase.listCollectionNamesChanged the return type of a method. The change preserves source-code compatibility (existing source code that uses the changed methods does not have to be changed), breaks binary compatibility (existing source code that uses the changed methods has to be recompiled against the updated driver dependency).
com.mongodb.clientMongoDatabaselistCollectionNamesMongoIterableListCollectionsIterablecom.mongodb.reactivestreams.clientMongoDatabaselistCollectionNamesPublisherListCollectionsPublisherorg.mongodb.scalaMongoDatabaselistCollectionNamesObservableListCollectionsObservablecom.mongodb.kotlin.clientMongoDatabaselistCollectionNamesMongoIterableListCollectionsIterablecom.mongodb.kotlin.client.coroutineMongoDatabaselistCollectionNamesFlowListCollectionsFlowauthorizedCollectionsAdded a method to an interface/class. The change preserves source-code and binary compatibility when done to a class, but breaks source-code compatibility for implementors when done to an interface. For the interfaces affected, we disregard such a change as breaking nonetheless.
com.mongodb.clientListCollectionsIterableauthorizedCollectionscom.mongodb.reactivestreams.clientListCollectionsPublisherauthorizedCollectionsorg.mongodb.scalaListCollectionsObservableauthorizedCollectionscom.mongodb.kotlin.clientListCollectionsIterableauthorizedCollectionscom.mongodb.kotlin.client.coroutineListCollectionsFlowauthorizedCollectionsAPI design
Note how
authorizedCollectionsis documented to be ignored in some situations. There seem to be two alternatives:authorizedCollectionsis added, add this method to the new types, return these types fromlistCollectionNames. I didn't try this approach in the original PR, maybe because it seemed like more work, or maybe because the approach didn't occur to me. Will see what reviewers think about this.Other notes
You may see a few methods marked as
@VisibleForTesting, which are used reflectively either from Java tests, or from Groovy. The code that effectively required the presence of these methods was already in the tests, I simply made the changes to fit into existing test infrastructure.JAVA-4353