Skip to content

Conversation

@jiangphcn
Copy link
Contributor

Overview

This fix is to refactor the logic for soft-deletion of search index. In the past, there is case where write.lock was stayed in search index directory and can't be moved. It is due to the fact that the index was not closed gracefully before moving/renaming search index. With this fix, the search index writer can be closed, and then search index can be moved to .deleted directory smoothly.

Testing recommendations

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.cloudant.clouseau.AnalyzerServiceSpec
Running com.cloudant.clouseau.AnalyzerServiceSpec
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.238 sec
Running com.cloudant.clouseau.ClouseauTypeFactorySpec
Running com.cloudant.clouseau.ClouseauTypeFactorySpec
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec
Running com.cloudant.clouseau.IndexManagerServiceSpec
Running com.cloudant.clouseau.IndexManagerServiceSpec
2019-11-21 15:26:30 clouseau [INFO] foo.5432109876 Renaming '/Users/jiangph/couchdb/clouseau.dreyfus/clouseau/target/indexes/foo.5432109876' to '/Users/jiangph/couchdb/clouseau.dreyfus/clouseau/target/indexes/foo.20191121.072630.deleted.5432109876'
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.445 sec
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.465 sec
Running com.cloudant.clouseau.ClouseauQueryParserSpec
Running com.cloudant.clouseau.ClouseauQueryParserSpec
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 sec
Running com.cloudant.clouseau.IndexServiceSpec
Running com.cloudant.clouseau.IndexServiceSpec
Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.937 sec
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.954 sec
Running com.cloudant.clouseau.SupportedAnalyzersSpec
Running com.cloudant.clouseau.SupportedAnalyzersSpec
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec
Tests run: 42, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.109 sec

Results :

Tests run: 95, Failures: 0, Errors: 0, Skipped: 0

Related Issues or Pull Requests

#2130
cloudant-labs/clouseau#25

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation

rpc(Ref, {delete, couch_util:to_binary(Id)}).

soft_delete(DbName) ->
rpc({main, clouseau()}, {soft_delete, DbName}).
Copy link
Member

Choose a reason for hiding this comment

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

This should look like rpc(Ref, {soft_delete, couch_util:to_binary(Id)}). and be sent to the IndexService process itself (opening it if it's not already open in the usual manner).

@rnewson
Copy link
Member

rnewson commented Nov 21, 2019

As this is, by definition, a change to behaviour, it's not a refactor.

@jiangphcn jiangphcn changed the title refactor soft deletion of search index close writer before soft deletion of search index Nov 21, 2019
@jiangphcn jiangphcn force-pushed the refactor-soft-deletion-searchindex branch from 72faf5d to 383606b Compare November 22, 2019 08:24
Copy link
Member

@rnewson rnewson left a comment

Choose a reason for hiding this comment

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

This is what I was expecting, thanks. Let's not merge until the clouseau side is approved, in case there are changes needed here.

@janl
Copy link
Member

janl commented Jan 4, 2020

should we hold this for 3.0 in light of making search setup easy?

@wohali
Copy link
Member

wohali commented Jan 8, 2020

@rnewson Clouseau was approved and merged, per Jan's comment should we progress with this for 3.0?

@jiangphcn
Copy link
Contributor Author

thanks @wohali and @janl for comments for this PR. Finally, we found that we just need to cloudant-labs/clouseau#27. It means that we don't need the change on dreyfus anymore. Let me close this PR.

@jiangphcn jiangphcn closed this Jan 9, 2020
@wohali wohali deleted the refactor-soft-deletion-searchindex branch October 21, 2020 19:14
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.

5 participants