OpenAgricultureFoundation / openag_brain

ROS package for controlling an OpenAg food computer
GNU General Public License v3.0
221 stars 68 forks source link

recipe sometimes doesn't start the first time, or auto-start after a reboot #325

Closed rbaynes closed 7 years ago

rbaynes commented 7 years ago

To start a recipe, I frequently have to run it a second time. When restarting the brain (or the PFC) a long running recipe should start running again at the current time, it doesn't always do so.

I think the source of these problems is the environmental_data_point by_variable view we are using. I think the index/tree that couch keeps internally for that view is not optimized to find the recipe_start and recipe_end documents in the gigabytes of data which are mostly desired/measured actuator/sensor values.

Investigate adding a new map/reduce view to more quickly return recipe_start and recipe_end from the environmental_data_point DB.

A less desirable solution would be to also write the recipe state to a new DB. But @Spaghet feels that this goes against the original design intentions of the brain/doc db.

rbaynes commented 7 years ago

on rob-bot:

  1. comment out automatic couchdb compaction
  2. write script to spew tons of docs into the DB
  3. at the same time, run a recipe
  4. test the query speed using the existing by_variable view (after my recent DB/view compaction/cleanup the existing query is pretty quick, so maybe this is now a moot point?)
rbaynes commented 7 years ago

On the 3 machines where I have turned on automatic compaction for couchdb, this is no longer an issue! So closing.