summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2022-10-10 15:43:26 +0100
committerRobert Newson <rnewson@apache.org>2022-10-10 15:53:00 +0100
commitf1b2aac82b712301eb69be03dd3dc1e96efb66dd (patch)
tree81bd86b989f6667ca0e0f42c06fc666be8bdefab
parent0c584227350afe963d5c0acc8af45791200deb38 (diff)
downloadcouchdb-f1b2aac82b712301eb69be03dd3dc1e96efb66dd.tar.gz
remove obsolete upgrade/export logic
-rw-r--r--src/dreyfus/src/dreyfus_fabric_group1.erl6
-rw-r--r--src/dreyfus/src/dreyfus_fabric_group2.erl6
-rw-r--r--src/dreyfus/src/dreyfus_fabric_search.erl10
-rw-r--r--src/dreyfus/src/dreyfus_util.erl122
4 files changed, 12 insertions, 132 deletions
diff --git a/src/dreyfus/src/dreyfus_fabric_group1.erl b/src/dreyfus/src/dreyfus_fabric_group1.erl
index 1edfd653f..8cc6720e6 100644
--- a/src/dreyfus/src/dreyfus_fabric_group1.erl
+++ b/src/dreyfus/src/dreyfus_fabric_group1.erl
@@ -42,7 +42,7 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
Workers = fabric_util:submit_jobs(Shards, dreyfus_rpc, group1, [
DDoc,
IndexName,
- dreyfus_util:export(QueryArgs)
+ QueryArgs
]),
Replacements = fabric_view:get_shard_replacements(DbName, Workers),
Counters = fabric_dict:init(Workers, nil),
@@ -68,9 +68,7 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
after
rexi_monitor:stop(RexiMon),
fabric_util:cleanup(Workers)
- end;
-go(DbName, DDoc, IndexName, OldArgs) ->
- go(DbName, DDoc, IndexName, dreyfus_util:upgrade(OldArgs)).
+ end.
handle_message({ok, NewTopGroups}, Shard, State0) ->
State = upgrade_state(State0),
diff --git a/src/dreyfus/src/dreyfus_fabric_group2.erl b/src/dreyfus/src/dreyfus_fabric_group2.erl
index e962c7e4a..972b2a9bb 100644
--- a/src/dreyfus/src/dreyfus_fabric_group2.erl
+++ b/src/dreyfus/src/dreyfus_fabric_group2.erl
@@ -45,7 +45,7 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
Shards,
dreyfus_rpc,
group2,
- [DDoc, IndexName, dreyfus_util:export(QueryArgs)]
+ [DDoc, IndexName, QueryArgs]
),
Replacements = fabric_view:get_shard_replacements(DbName, Workers),
Counters = fabric_dict:init(Workers, nil),
@@ -73,9 +73,7 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
after
rexi_monitor:stop(RexiMon),
fabric_util:cleanup(Workers)
- end;
-go(DbName, DDoc, IndexName, OldArgs) ->
- go(DbName, DDoc, IndexName, dreyfus_util:upgrade(OldArgs)).
+ end.
handle_message(
{ok, NewTotalHits, NewTotalGroupedHits, NewTopGroups},
diff --git a/src/dreyfus/src/dreyfus_fabric_search.erl b/src/dreyfus/src/dreyfus_fabric_search.erl
index 7e78e5fc3..a11007b3f 100644
--- a/src/dreyfus/src/dreyfus_fabric_search.erl
+++ b/src/dreyfus/src/dreyfus_fabric_search.erl
@@ -47,7 +47,7 @@ go(DbName, DDoc, IndexName, #index_query_args{bookmark = nil} = QueryArgs) ->
Shards,
dreyfus_rpc,
search,
- [DDoc, IndexName, dreyfus_util:export(QueryArgs)]
+ [DDoc, IndexName, QueryArgs]
),
Counters = fabric_dict:init(Workers, nil),
go(DbName, DDoc, IndexName, QueryArgs, Counters, Counters, RingOpts);
@@ -65,9 +65,9 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
Bookmark1 = dreyfus_bookmark:add_missing_shards(Bookmark0, LiveShards),
Counters0 = lists:flatmap(
fun({#shard{name = Name, node = N} = Shard, After}) ->
- QueryArgs1 = dreyfus_util:export(QueryArgs#index_query_args{
+ QueryArgs1 = QueryArgs#index_query_args{
bookmark = After
- }),
+ },
case lists:member(Shard, LiveShards) of
true ->
Ref = rexi:cast(N, {dreyfus_rpc, search, [Name, DDoc, IndexName, QueryArgs1]}),
@@ -92,9 +92,7 @@ go(DbName, DDoc, IndexName, #index_query_args{} = QueryArgs) ->
QueryArgs2 = QueryArgs#index_query_args{
bookmark = Bookmark1
},
- go(DbName, DDoc, IndexName, QueryArgs2, Counters, Bookmark1, RingOpts);
-go(DbName, DDoc, IndexName, OldArgs) ->
- go(DbName, DDoc, IndexName, dreyfus_util:upgrade(OldArgs)).
+ go(DbName, DDoc, IndexName, QueryArgs2, Counters, Bookmark1, RingOpts).
go(DbName, DDoc, IndexName, QueryArgs, Counters, Bookmark, RingOpts) ->
{Workers, _} = lists:unzip(Counters),
diff --git a/src/dreyfus/src/dreyfus_util.erl b/src/dreyfus/src/dreyfus_util.erl
index 301d3887a..74593fb9a 100644
--- a/src/dreyfus/src/dreyfus_util.erl
+++ b/src/dreyfus/src/dreyfus_util.erl
@@ -119,124 +119,10 @@ pad(List, Padding, Length) ->
pad(List ++ [Padding], Padding, Length).
upgrade(#index_query_args{} = Args) ->
- Args;
-upgrade({index_query_args, Query, Limit, Stale, IncludeDocs, Bookmark, Sort, Grouping, Stable}) ->
- #index_query_args{
- q = Query,
- limit = Limit,
- stale = Stale,
- include_docs = IncludeDocs,
- bookmark = Bookmark,
- sort = Sort,
- grouping = Grouping,
- stable = Stable
- };
-upgrade(
- {index_query_args, Query, Limit, Stale, IncludeDocs, Bookmark, Sort, Grouping, Stable, Counts,
- Ranges, Drilldown}
-) ->
- #index_query_args{
- q = Query,
- limit = Limit,
- stale = Stale,
- include_docs = IncludeDocs,
- bookmark = Bookmark,
- sort = Sort,
- grouping = Grouping,
- stable = Stable,
- counts = Counts,
- ranges = Ranges,
- drilldown = Drilldown
- };
-upgrade(
- {index_query_args, Query, Limit, Stale, IncludeDocs, Bookmark, Sort, Grouping, Stable, Counts,
- Ranges, Drilldown, IncludeFields, HighlightFields, HighlightPreTag, HighlightPostTag,
- HighlightNumber, HighlightSize}
-) ->
- #index_query_args{
- q = Query,
- limit = Limit,
- stale = Stale,
- include_docs = IncludeDocs,
- bookmark = Bookmark,
- sort = Sort,
- grouping = Grouping,
- stable = Stable,
- counts = Counts,
- ranges = Ranges,
- drilldown = Drilldown,
- include_fields = IncludeFields,
- highlight_fields = HighlightFields,
- highlight_pre_tag = HighlightPreTag,
- highlight_post_tag = HighlightPostTag,
- highlight_number = HighlightNumber,
- highlight_size = HighlightSize
- };
-upgrade(
- {index_query_args, Query, Limit, Stale, IncludeDocs, Bookmark, Sort, Grouping, Stable, Counts,
- Ranges, Drilldown, IncludeFields, HighlightFields, HighlightPreTag, HighlightPostTag,
- HighlightNumber, HighlightSize, RawBookmark}
-) ->
- #index_query_args{
- q = Query,
- limit = Limit,
- stale = Stale,
- include_docs = IncludeDocs,
- bookmark = Bookmark,
- sort = Sort,
- grouping = Grouping,
- stable = Stable,
- counts = Counts,
- ranges = Ranges,
- drilldown = Drilldown,
- include_fields = IncludeFields,
- highlight_fields = HighlightFields,
- highlight_pre_tag = HighlightPreTag,
- highlight_post_tag = HighlightPostTag,
- highlight_number = HighlightNumber,
- highlight_size = HighlightSize,
- raw_bookmark = RawBookmark
- }.
-
-export(
- #index_query_args{
- partition = nil,
- counts = nil,
- ranges = nil,
- drilldown = [],
- include_fields = nil,
- highlight_fields = nil
- } = Args
-) ->
- % Ensure existing searches work during the upgrade by creating an
- % #index_query_args record in the old format
- {index_query_args, Args#index_query_args.q, Args#index_query_args.limit,
- Args#index_query_args.stale, Args#index_query_args.include_docs,
- Args#index_query_args.bookmark, Args#index_query_args.sort, Args#index_query_args.grouping,
- Args#index_query_args.stable};
-export(
- #index_query_args{
- partition = nil,
- include_fields = nil,
- highlight_fields = nil
- } = Args
-) ->
- {index_query_args, Args#index_query_args.q, Args#index_query_args.limit,
- Args#index_query_args.stale, Args#index_query_args.include_docs,
- Args#index_query_args.bookmark, Args#index_query_args.sort, Args#index_query_args.grouping,
- Args#index_query_args.stable, Args#index_query_args.counts, Args#index_query_args.ranges,
- Args#index_query_args.drilldown};
-export(#index_query_args{partition = nil} = Args) ->
- {index_query_args, Args#index_query_args.q, Args#index_query_args.limit,
- Args#index_query_args.stale, Args#index_query_args.include_docs,
- Args#index_query_args.bookmark, Args#index_query_args.sort, Args#index_query_args.grouping,
- Args#index_query_args.stable, Args#index_query_args.counts, Args#index_query_args.ranges,
- Args#index_query_args.drilldown, Args#index_query_args.include_fields,
- Args#index_query_args.highlight_fields, Args#index_query_args.highlight_pre_tag,
- Args#index_query_args.highlight_post_tag, Args#index_query_args.highlight_number,
- Args#index_query_args.highlight_size, Args#index_query_args.raw_bookmark};
-export(QueryArgs) ->
- QueryArgs.
+ Args.
+
+export(#index_query_args{} = Args) ->
+ Args.
time(Metric, {M, F, A}) when is_list(Metric) ->
Start = os:timestamp(),