pascalbenschopTU / WDM_project

Web-Scale Data Management Project
1 stars 0 forks source link

Implement mongodb for order service #12

Closed pascalbenschopTU closed 1 year ago

pascalbenschopTU commented 1 year ago

The init-mongo.js script in /order is called the first time you call docker-compose. It inserts a user into the database from volume order_mongodb_data, if you want to redo the script you have to delete the volume in docker.

pascalbenschopTU commented 1 year ago

Sometimes the test failed with substract_stock 14 != 15, no clue why but rerunning the test fixes it.

LeonKempen commented 1 year ago

Sometimes the test failed with substract_stock 14 != 15, no clue why but rerunning the test fixes it.

Well that is something that we should look into. Otherwise this would mean that the db is sometimes not consistent with even one user. Do you know if this already occured before you made the mongodb changes?

Nobert1 commented 1 year ago

Sometimes the test failed with substract_stock 14 != 15, no clue why but rerunning the test fixes it.

Well that is something that we should look into. Otherwise this would mean that the db is sometimes not consistent with even one user. Do you know if this already occured before you made the mongodb changes?

It did occur before the changes. The current implementation only has "eventual" consistency. If the operation is performed, and the stock consumer has not yet processed the message to return the stock, and put it in the database before the next read operation, the stock will not be updated. So it's random if it passes this test or not at this given time. Adding a small sleep before reading the stock agian will probably fix this.