Commit Graph

102 Commits

Author SHA1 Message Date
David Glasser
4daaa76b12 METEOR@1.0.4 2015-03-17 13:06:07 -07:00
David Glasser
873018df44 Minor version bumps to packages with new features
* accounts-base: client-side login hooks
* accounts-password: emailTemplates features
* autoupdate: reload via Node IPC messages (and SIGHUP)
* blaze: template-level subscriptions and onRendered/etc hooks
* ddp: client-side onStop callback, permessage-deflate, subscriptionId
  on subscription handles
* http: npmRequestOptions, HTTPInternals.NpmModules
* mongo: validated against 2.6, oplog-backlog,
  rawCollection/rawDatabase, MongoInternals.NpmModules
* reactive-dict/session: Session.set({k1: v1, k2: v2})
* templating: attributes on <body>
* webapp: WebAppInternals.NpmModules
2015-03-05 22:30:22 -08:00
David Glasser
f65035e11a oplog: re-fetch on confusing modifiers
For example, 5ddf203 stops us from understanding $sets and $unsets with
empty field parts, but pre-2.6 MongoDB could generate them.  (And even
post-2.6 may be able to generate $unsets with bad field names, but it's
not important for us to match that behavior since with Minimongo you
shouldn't be able to put them in in the first place.)
2015-03-05 19:56:42 -08:00
David Glasser
3674c12fc7 Fix server side of #3571 2015-03-05 18:41:38 -08:00
David Glasser
456d06bde3 Failing test for #3571
This fails on both server and client.

This is also related to #2254.
2015-03-05 18:41:37 -08:00
David Glasser
82bbcd112c run a test on the client too 2015-03-05 18:41:37 -08:00
David Glasser
ef9671e705 Document direct access features in READMEs 2015-03-05 17:12:37 -08:00
David Glasser
63a0076305 mongo: provide direct access to node driver db
Specifically, Mongo.Collection objects on the server now have
rawCollection and rawDatabase methods.

You can use MongoInternals.NpmModules.mongodb.version to tell what
version of the mongodb npm module is the backend for HTTP.call.  This
version may change incompatibly from version to version of Meteor; use
at your own risk.  (For example, we expect to upgrade from the 1.4.x
series to the 2.x series in the not-too-distant future.)

Fixes #3640.
2015-03-05 17:12:37 -08:00
David Glasser
cfc1699b0c Add direct access to mongodb module from mongo
Addresses #3640.
2015-03-05 17:12:36 -08:00
David Glasser
6ef63ce43d Fix update when rules have different transforms
Previously, the document would be transformed based on the first deny or
allow rule's transform, instead of using the matching transform rule.
This bug only applied to update, not insert or remove.

Technically one could do something fancy to avoid calling transform
unnecessarily if there are many validators with the same transform, but
if you're stressing that much about performance you might as well just
write a method instead of using allow/deny.

Fixes #3108.
2015-03-04 19:47:06 -08:00
David Glasser
7c443e46de slight refactor to a test 2015-03-04 19:38:45 -08:00
David Glasser
0c0cbe12be Update to Mongo driver 1.4.32
This contains a PR we just submitted to help with error handling
for #2534.
2015-02-27 12:00:25 -08:00
David Glasser
3e59a1bf8c Better errors on observeChanges and sub errors 2015-02-26 11:48:47 -08:00
David Glasser
874b3ff74d Fix #2534 for oplog too
In order to test this, we applied the following diff to
minimongo/selector.js:

--- a/packages/minimongo/selector.js
+++ b/packages/minimongo/selector.js
@@ -591,6 +591,8 @@ ELEMENT_OPERATORS = {
   },
   $in: {
     compileElementSelector: function (operand) {
+      if (operand === null)
+        operand = [];
       if (!isArray(operand))
         throw Error("$in needs an array");

This means that minimongo now allows `$in: null`, and thus
OplogObserveDriver can be used for the query in the new 'bad query'
test, but mongod still returns an error that is processed by the passing
test.  (The client side of the test fails with this temporary change,
because minimongo no longer throws!)

It's hard to see how to test this better, because minimongo should throw
on any queries that mongod throws on.
2015-02-26 11:48:47 -08:00
David Glasser
2f2ba3979c Make observeChanges throw on bad query
Fixes #2534.

In the past, a bad query would be retried forever, causing the
observeChanges to hang.

(In the common case of a DDP subscription, this would also cause the
current DDP connection to completely stop reading messages, and would
make methods that do writes to the same collection (on ANY DDP
connection) never get their 'updated' messages.  See
https://github.com/meteor/meteor/issues/2534#issuecomment-73355050
These two secondary problems may still need to be fixed but at least
the root cause should be addressed.)

This only fixes PollingObserveDriver, not OplogObserveDriver, but this
issue typically only affects PollingObserveDriver because we don't
choose to use OplogObserveDriver when minimongo can't understand a
query.
2015-02-26 11:48:47 -08:00
David Glasser
cfc4015f61 Failing test for #2534.
Test fails on server (passes on client).
2015-02-26 11:48:47 -08:00
Slava Kim
62ac82c835 Bump 2015-02-24 21:16:41 -08:00
David Glasser
f426f09abb Allow asking for full update result from Mongo 2015-02-19 10:42:08 -08:00
David Glasser
7e533c6fb0 Set up skip handle earlier 2015-02-10 12:16:02 -08:00
David Glasser
b34027ec25 Use callback-hook 2015-02-10 12:16:02 -08:00
David Glasser
50d5276ad0 Fix last entry issue in a simpler way
This way we don't have to worry about NEVER getting to the "processing
an entry" phase if the firehose never stops.
2015-02-10 12:16:02 -08:00
David Glasser
9040c1461b Add a test for oplog-backlog 2015-02-10 12:16:01 -08:00
David Glasser
cf363d8530 Make sure to not clear queue completely
Expand on some comments
2015-02-10 12:16:01 -08:00
David Glasser
56f21fc82e Use double-ended-queue for various server queues
See benchmarks at https://github.com/petkaantonov/deque
2015-02-10 12:16:01 -08:00
David Glasser
a4626f1c8e If oplog tailing gets too far behind, just poll
The number of entries that is "too far" to be behind is configurable
with $METEOR_OPLOG_TOO_FAR_BEHIND and defaults to 2000.

Fixes #2668.
2015-02-10 12:16:01 -08:00
David Glasser
7ae5678db2 Move oplog tailing to an explicit background queue
This will allow us to drop the queue if it gets too far behind.
2015-02-10 12:16:01 -08:00
Sashko Stubailo
f29c954458 Bump a bunch of version numbers for new preview 2015-02-09 13:23:24 -08:00
David Glasser
8e8ee3eca4 Unregister ObserveMultiplexer before stop
It's maybe possible that stop() yields, and in general is more complex.
Since the ObserveMultiplexer is already at the point where it will not
be able to start running again, we should remove it from the registry
first.
2015-02-07 00:02:42 -08:00
David Glasser
9166de39fe Release write fences on PollingObserveDriver.stop
OplogObserveDriver.stop() already does this.
2015-02-07 00:01:20 -08:00
David Glasser
25d9ab8250 Improve error message in PollingObserveDriver
Now when we get an error from Mongo, the cursor description is included.

Other than by the test-only _resumePolling, _pollMongo is only called at
the top level of an async-queued task, so the previously thrown error
never did anything other than print the exception (from within
_SynchronousQueue) anyway.

Fixes #1633.

(See also #2534.)
2015-02-06 19:21:30 -08:00
David Glasser
eaf11fa55e Update Node Mongo driver from 1.4.1 to 1.4.30
and BSON from 0.2.7 to 0.2.18

This is past the minimum version required to use the upcoming MongoDB
3.0.

Fixes #3654.
2015-02-06 18:05:16 -08:00
David Glasser
2e4d3f2833 Don't use system.replset to check for replset
It requires an unnecessary level of permissions in Mongo 2.6.  Instead,
use the isMaster command plus parsing the URL.

Fixes #2121.
2015-02-05 22:40:45 -08:00
David Glasser
5936c0b3de Add a link to a comment about upsert 2015-02-05 22:40:44 -08:00
David Glasser
a83008ebb4 Make our upserts match 2.6 semantics
Mongo 2.4 had the following behavior: if

  c.update({_id: 'x'}, {y: 1}, {upsert: 1})

resulted in an insert, it would get a random _id instead of 'x'.  (This
only happened when the update was a "replacement" rather than a
"modifier".) We dutifully implemented this behavior in various parts of
Meteor and added tests to prove that it occured.

However, this was actually a bug which got fixed in Mongo 2.6:
https://jira.mongodb.org/browse/SERVER-5289

Since this was regarded by Mongo as a bug (not a backwards-incompatible
change deemed worthy of mention in the Mongo 2.6 release notes), we
should just make Meteor always behave the Mongo 2.6 way, no matter what
version we're on (at least in the aspects where Meteor has its own code
to control this).  In other parts of Meteor where the queries are just
getting processed by Mongo, the behavior of this special case will match
Mongo's behavior.  If you care strongly about consistent behavior in
this strange edge case, upgrade to Mongo 2.6!

Specifically:

 - The minimongo implementation of modifiers loses its special-case code
   which drops _id from the modified document during an upsert replace.
 - Mongo.Collection.update should only generate a random _id as an
   insertedId if the selector doesn't mention one.
 - The case of a selector mentioning _id and a *replacement* modifier
   not mentioning _id should still count as "known ID" in the
   lower-level MongoConnection.update, which means that there's no
   reason to use simulated upsert and that we should include it as
   insertedId in the return object.
 - Various tests of the previous behavior should be changed.

(Note that if this commit is cherry-picked onto 1.0.3.1 (ie, run against
2.4), it would fail, because some of the tested cases end up going to
unsimulated Mongo upsert and assume the 2.6 behavior. That's OK, as
described above.)

Fixes #2278.
2015-02-05 22:40:44 -08:00
David Glasser
ceb07b254e upsert: Detect "can't change _id" in Mongo 2.6
This fixes the "upsert error parse" test and changes the behavior of
other failing upsert tests to be failing with "Upsert failed after 3
tries" errors instead of failing with a "can't change _id"-style error.

First step of addressing #2278.
2015-02-05 22:40:44 -08:00
David Glasser
d9cfa85b48 Fix test depending on Mongo document key order
In Mongo 2.6, _id always comes first:
http://docs.mongodb.org/manual/release-notes/2.6/#insert-and-update-improvements
2015-02-05 22:40:44 -08:00
Sashko Stubailo
a75cae93ed Merge branch 'devel' into windows-r
Conflicts:
	packages/package-version-parser/package.js
	tools/bundler.js
	tools/server/boot.js
2015-02-04 15:50:31 -08:00
Sashko Stubailo
b3cb7a49f7 Merge branch 'devel' into windows-cr
Conflicts:
	packages/application-configuration/package.js
	packages/ctl-helper/package.js
	packages/ctl/package.js
	packages/dev-bundle-fetcher/package.js
	packages/follower-livedata/package.js
	packages/jquery/package.js
	packages/star-translate/package.js
	packages/test-in-browser/package.js
	tools/bundler.js
	tools/compiler.js
	tools/package-client.js
	tools/package-source.js
	tools/package-version-parser.js
	tools/server/boot.js
2015-02-04 13:56:54 -08:00
Slava Kim
3c68cebf0d bump 2015-02-02 13:38:01 -08:00
David Glasser
dde3924c9d Make MongoConnection constructor always wait
Summary:
Previously, the MongoConnection constructor (which gets called
implicitly the first time you make a Mongo.Collection) would wait for a
successful connection before returning ... if an oplog URL is supplied.
If not in oplog mode, it would return before the connection is
successful, and the first subsequent calls that actually tried to do
something with the DB would block instead.

Having an inconsistent API that is sometimes sync and sometimes async is
not very clear.  Moreover, error handling from connect was strange.
Prior to 0.8.1 (24a0006c), connect errors would be thrown
uncatchably (ie, from an unrelated context).  Starting with 0.8.1,
connect errors would effectively be ignored due to the new
bindEnvironment (they'd be logged, but all code would continue
normally).

It's pretty important that startup connection errors crash the server
process instead of letting it keep running unproductively.  And it would
also be nice if those errors could be caught (if you're making a
MongoConnection in your own code).  So this change ensures that
connection errors get thrown by the MongoConnection constructor.

Fixes #3038.

Test Plan: new unit test. manual test with MONGO_URL=xxx

Reviewers: ben

Subscribers: justinsb

Differential Revision: https://phabricator.meteor.io/D19
2015-01-29 16:56:22 -08:00
David Glasser
5990e71ddc Remove legacy AppConfig code
Nothing ever made full use of the promise of the complexity of the
API (configuration that can change at runtime) anyway.

This includes completely ignoring the $APP_CONFIG variable.

I opened GitHub issues against the only Atmosphere packages that had
dependencies on application-configuration (none of which actually used
the package other than by declaring the dependency).
2015-01-29 14:03:20 -08:00
David Glasser
62037959fe Clean up comments about legacy code 2015-01-29 14:03:11 -08:00
Slava Kim
27f249bfed A lot of crazy package bumps 2015-01-21 14:03:55 -08:00
Sashko Stubailo
c37342d504 Bump a bunch of package versions 2015-01-20 22:34:24 -08:00
David Glasser
4ece886c36 1.0.2.1 2014-12-22 16:52:44 -08:00
David Glasser
837c5faddf 1.0.2.1-rc.1 2014-12-22 12:33:14 -08:00
David Glasser
6b204ca73a Bump package versions for 1.0.2 2014-12-19 10:31:59 -08:00
David Glasser
7239b4051c 1.0.2-rc.6 2014-12-17 00:22:47 -08:00
Emily Stark
d700610397 Disallow mixed modifier/non-modifier fields in updates
We expect modifiers to be either modifiers or replacements, not a
mix. MongoDB does this check also, but do it in meteor too as a safety
belt.
2014-12-16 17:16:26 -08:00
Emily Stark
d9feb32148 Disallow EJSON custom types as replacement documents in updates 2014-12-16 17:16:13 -08:00