Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

When mongoDB split read and write, "find after update" will be wrong #1047

Open
jacky-cyber opened this issue Jan 20, 2019 · 2 comments
Open

Comments

@jacky-cyber
Copy link

jacky-cyber commented Jan 20, 2019

https://github.com/CollectionFS/Meteor-CollectionFS/blob/45f7288f9c9e4470e15f7ad927a634704064e4da/packages/tempstore/tempStore.js#L294

tracker.update(selector, {$set: setObj});
var temp = tracker.findOne(selector);
if (!temp) {
      FS.debug && console.log('NOT FOUND FROM TEMPSTORE => EXIT (REMOVED)');
      return;
}

// Get updated chunkCount
 var chunkCount = FS.Utility.size(temp.keys);

The chunkCount will be 0.

@harryadel
Copy link
Member

Hi @ljshj Could you please elaborate? As far as I can tell, there's a return within that if statement, so if temp is empty, it'd never move on to deduce the chunkCount.

@jacky-cyber
Copy link
Author

@harryadel When "update" is write to mongodb primary node(or write node), the secondary node (or read node)'s data is little later. so I think we should test the return value of "tracker.update" for checking "temp".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants