Commit graph

294 commits

Author SHA1 Message Date
Arnaud Spiwack
bd25f8bee3 Unmask the forked thread in newPipeline
The `newPipeline` function, used as part of `connect`, forks a
listener thread. Before this commit, the thread is forked with
`forkFinally`, where the thread action is run in the same mask as the
parent thread. The thread is then killed by a `killThread` when
closing a connection.

This is typically not a problem if the mask is “masked” (or,
obviously, “unmasked”), because the listener is generally blocked on a
channel at some time or other, and therefore will accept the
asynchronous exception thrown by `killThread`, and terminate.

However, if the mask is “masked uninterruptible”, then the listener
definitely doesn't receive asynchronous exceptions, and the
`killThread` calls hangs, and never returns.

One should probably never call `connect` in a “masked uninterruptible”
action. However, it sounds better to protect the mongoDB library
against the user accidentally doing so than to add a big warning
saying that calling `connect` in “masked uninterruptible” will cause
the program to hang down the line.

Therefore, this commit uses `forkIOWithUnmask`, in order to run the
thread action always in an “unmasked” state. In which case we can be
sure that we can always kill the listener thread regardless of the
client code.
2019-10-29 09:49:44 +01:00
Scott Fleischman
f84cc03517 Add numeric instances that network's PortNumber has.
In particular this allows you to use `fromIntegral` without having to add the newtype wrapper. This can help existing code move away from importing and referencing the PortID type altogether.
2019-05-30 11:33:13 -07:00
Scott Fleischman
996d3e196b Use same version check as in cabal file; fix typo in comment. 2019-05-30 10:28:23 -07:00
Scott Fleischman
17287b5556 Use network's connectTo when available. 2019-05-30 10:02:06 -07:00
Scott Fleischman
21cf023854 Add module Database.MongoDB.Internal.Network.
Add flag imitating bson package PR for network changes.
Add stack files for compilation checking.

Both ghc86 builds work. Still need to fix ghc84 and under builds with older network code.
2019-05-29 18:02:37 -07:00
Scott Fleischman
5bb77518a8 Revert "Remove use of conduit Producer and Consumer."
This reverts commit 5f04dc6a23.

Leave the use of Producer and Consumer for now until we drop support for conduit-1.2.*.
conduit-1.3 introduces ConduitT and deprecates the use of type synonyms.
However, ConduitT is not present in conduit-1.2.
2019-05-29 17:18:00 -07:00
Scott Fleischman
74a40411c1 Update shadowing warnings. 2019-05-29 17:07:29 -07:00
Scott Fleischman
b094dff057 Prefix internal unused fields with underscore.
Due to warning: [-Wunused-top-binds].
2019-05-29 17:03:03 -07:00
Scott Fleischman
5f04dc6a23 Remove use of conduit Producer and Consumer.
Due to deprecations: "Deprecated: Use ConduitT directly".
2019-05-29 17:01:50 -07:00
Scott Fleischman
c03e1ed746 Use Control.Monad.Except instead of Control.Monad.Error.
Due to the following warning:
"Module ‘Control.Monad.Error’ is deprecated:
  Use "Control.Monad.Except" instead"
2019-05-29 16:57:51 -07:00
Scott Fleischman
13f56bbee4 Use ciphersuite_default instead of ciphersuite_all.
Due to this warning: "This ciphersuite list contains RC4. Use ciphersuite_strong or ciphersuite_default instead."
2019-05-29 16:52:37 -07:00
jaccokrijnen
12ab2aef66
Update Query.hs
Fix url to mongo documentation on update modifiers.
2018-10-31 15:03:23 +01:00
Victor Denisov
9e0781dff5 Use stm channels 2018-04-28 16:12:11 -07:00
James Brechtel
87ddf52c97 Stop leaking Nonce generator on authentication 2018-03-12 16:15:56 -04:00
Victor Denisov
a985209714 Add aggregate that returns Cursor
- also add config to the new aggregate that is extensible in a backward
compatible manner.
2018-02-08 22:18:58 -08:00
Victor Denisov
77b84a5695 Recover original indentation 2018-01-27 11:46:53 -08:00
Peter Tillemans
582a16d08e remove a forgotten debug statement 2017-12-31 18:39:09 +01:00
Peter Tillemans
bb3e66073f fix correct finalizing of last block 2017-12-31 18:35:37 +01:00
Fábián Tamás László
5527036d6c
Remove offending putStrLn-s
The two removed lines littered the terminal.
2017-12-27 11:49:08 +01:00
Victor Denisov
dda10d461b Rework WriteResult for updateMany, deleteMany functions
Merge branch 'update-result'

PR #77

Conflicts:
	CHANGELOG.md
	Database/MongoDB/Query.hs
2017-05-29 19:37:21 -07:00
Victor Denisov
a1e19379f6 Add test and fix for updateMany nMatched and nModified 2017-05-29 12:58:39 -07:00
Victor Denisov
50b7fef240 Fix delete count 2017-05-28 12:58:29 -07:00
Victor Denisov
2984a9b57a Rewrite function in a shorter way 2017-05-21 00:32:13 -07:00
Victor Denisov
161ca964cb Fix wording in docs 2017-05-21 00:31:49 -07:00
Victor Denisov
77c7ee3ee9 Drop MonadBaseControl from two more modules 2017-05-11 21:35:41 -07:00
Victor Denisov
a1568d9dbf Add mkWeakMVar for Action monad 2017-05-08 23:12:26 -07:00
Victor Denisov
dd6c5057f5 Add modifyMVar for Action monad 2017-05-08 22:48:13 -07:00
Victor Denisov
d963d89c0b Fix documentation for access function 2017-05-06 23:55:27 -07:00
Victor Denisov
4855793dd7 Rewrite updateBlock 2017-05-01 21:47:40 -07:00
Victor Denisov
1d6d6ca9c0 Rewrite deleteBlock 2017-04-09 22:23:34 -07:00
Victor Denisov
d6419daa50 Move WriteConcernError to Failure 2017-04-09 20:43:55 -07:00
Victor Denisov
2a5bfa44e2 Handle unknown documents in insertMany reply 2017-04-09 20:43:55 -07:00
Victor Denisov
48d8dba4e1 Add compound failure 2017-04-09 20:43:55 -07:00
Victor Denisov
7ae65ce487 Assign ids before insert block 2017-04-09 20:43:55 -07:00
Victor Denisov
b6078cc19d Wrap lines 2017-04-09 20:43:54 -07:00
Victor Denisov
173e90eb90 Don't run ...Many tests against mongo 2.4 2017-04-09 20:43:54 -07:00
Victor Denisov
e2e9f12af8 Adjust index for updateBlock results 2017-04-09 20:43:54 -07:00
Victor Denisov
f57ac94a3b Drop support of mongo 2.6 in updateMany and deleteMany 2017-04-09 20:43:54 -07:00
Victor Denisov
dad19515de Keep old behavior of delete command 2017-04-09 20:43:54 -07:00
Victor Denisov
d1d5f84b22 Keep old behavior of update 2017-04-09 20:43:54 -07:00
Victor Denisov
6a13bde01b Set proper index for exception 2017-04-09 20:43:54 -07:00
Victor Denisov
6013272c5d Rewrite delete comand using interruptible for 2017-04-09 20:43:54 -07:00
Victor Denisov
8db991bb5d Rewrite deleteBlock using WriteResult 2017-04-09 20:43:54 -07:00
Victor Denisov
09c05d4b69 Rename UpdateResult to WriteResult
Many fields of DeleteResult overlap with UpdateResult.
It's better to have only one result for all results, just
like it's done in c mongodb driver.
2017-04-09 20:43:54 -07:00
Victor Denisov
569d8ccc08 Fix list append complexity issue 2017-04-09 20:43:54 -07:00
Victor Denisov
eeb0c7981d Edit comments slightly 2017-04-09 20:43:54 -07:00
Victor Denisov
80ebc6f756 Throw exception when insertAll encounters big doc
- insertAll should throw an exception if it encounters a document
too big for one message. However all other documents will be inserted.

- slightly edit docs
2017-04-09 20:43:54 -07:00
Victor Denisov
bedaa744ba Add indexes to error reporting 2017-04-09 20:43:54 -07:00
Victor Denisov
86f782db72 Insert remaining values in insertAll and then throw exception 2017-04-09 20:43:54 -07:00
Victor Denisov
139a17248f Fix tests 2017-04-09 20:43:54 -07:00