Skip to content

Conversation

@davisp
Copy link
Member

@davisp davisp commented Jun 1, 2018

This PR updates the pluggable storage engine test suite so that its a self contained app to clean up code and various other odds and ends.

The biggest change is that this also makes the tests go through couch_server instead of instantiating the engines directly. This allows a storage engine to open itself as a database which turned out to be necessary for compactions with purge so that we can enable code re-use without requiring every engine to correctly implement the get_minimum_purge_seq logic.

This PR depends on #1366 and #1367.

ok = couch_server:delete(couch_db:name(Db), []).


cpse_read_empty_docs(Db) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of the test is misleading. For some reason I read the test name as "Read documents which are empty". It could be just me though.
cpse_read_missing_docs or cpse_read_non_existent_docs would be better IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpse_read_docs_from_empty_db is also an option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to cpse_read_docs_from_empty_db/1

?assertEqual(?NUM_CLIENTS + 2, length(Pids1)),
Pids1 = couch_db_engine:monitored_by(Db),
% +3 for self, db pid, and process tracker
?assertEqual(?NUM_CLIENTS + 3, length(Pids1)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use couch_db:monitored_by/1, which would remove db and process tracker. However we probably want to limit functions we use to couch_db_engine module. I am really not sure which approach is better. Just wanted to mention it so I don't forget why I stopped here.

@davisp davisp force-pushed the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch from e2bbbf0 to 826b17e Compare July 6, 2018 17:34
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep branch 2 times, most recently from 8cbf976 to 966497c Compare August 9, 2018 02:50
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch from 826b17e to 163b02e Compare August 9, 2018 03:04
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep branch from 966497c to b663478 Compare August 14, 2018 09:21
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch from 6a370e6 to bff390d Compare August 14, 2018 09:22
@davisp
Copy link
Member Author

davisp commented Aug 20, 2018

+1 but squerge that merge conflict to the commit it goes in.

@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep branch from b663478 to da43788 Compare August 21, 2018 01:13
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch from bff390d to 4c87d78 Compare August 21, 2018 01:29
@jiangphcn
Copy link
Contributor

Thanks @davisp I already squashed that merge conflict to the commit it goes in.

@davisp davisp force-pushed the COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep branch from 169e84c to 391d7b5 Compare August 21, 2018 14:40
@jiangphcn jiangphcn changed the base branch from COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep to master August 21, 2018 15:29
davisp added 6 commits August 21, 2018 23:31
It turns out that if any storage engine has to open itself during
a callback it would end up violating the guarantee of a single writer.
This change in the test suite changes things to use couch_server so that
storage engines are now free to do as they want reopening themselves.
@jiangphcn jiangphcn force-pushed the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch from 4c87d78 to e0c7ad3 Compare August 21, 2018 15:34
@jiangphcn jiangphcn merged commit c02f6d2 into master Aug 21, 2018
@nickva nickva deleted the COUCHDB-3326-clustered-purge-pr3-refactor-pse-tests branch December 18, 2019 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants