You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/05/19 22:48:20 UTC

[couchdb] branch 3.x updated (cc47dcd70 -> a438454ae)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git


    from cc47dcd70 Merge pull request #3985 from noahshaw11/implement-resource_hoggers
     new 104827994 Removed unused include files
     new 5ded3ba5f Remove dead code from smoosh
     new a438454ae Cleanup couch_file exports and unused code

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/src/couch_file.erl         | 24 +++++-------------------
 src/fabric/src/fabric_doc_update.erl |  1 -
 src/rexi/src/rexi.erl                |  2 --
 src/smoosh/src/smoosh_channel.erl    | 13 -------------
 src/smoosh/src/smoosh_server.erl     | 14 --------------
 src/smoosh/src/smoosh_utils.erl      | 15 +--------------
 6 files changed, 6 insertions(+), 63 deletions(-)


[couchdb] 01/03: Removed unused include files

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 104827994f0596f646d86bf1f68bb5628e82374e
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Thu May 19 17:53:11 2022 -0400

    Removed unused include files
    
    Emacs + erlang_ls noticed those. There may be more, but didn't know how
    systematically check all of the files.
---
 src/fabric/src/fabric_doc_update.erl | 1 -
 src/rexi/src/rexi.erl                | 2 --
 2 files changed, 3 deletions(-)

diff --git a/src/fabric/src/fabric_doc_update.erl b/src/fabric/src/fabric_doc_update.erl
index b6a588039..69ad03da5 100644
--- a/src/fabric/src/fabric_doc_update.erl
+++ b/src/fabric/src/fabric_doc_update.erl
@@ -14,7 +14,6 @@
 
 -export([go/3]).
 
--include_lib("fabric/include/fabric.hrl").
 -include_lib("mem3/include/mem3.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
diff --git a/src/rexi/src/rexi.erl b/src/rexi/src/rexi.erl
index 90000dda2..77830996e 100644
--- a/src/rexi/src/rexi.erl
+++ b/src/rexi/src/rexi.erl
@@ -21,8 +21,6 @@
 -export([stream2/1, stream2/2, stream2/3, stream_last/1, stream_last/2]).
 -export([ping/0]).
 
--include_lib("rexi/include/rexi.hrl").
-
 start() ->
     application:start(rexi).
 


[couchdb] 03/03: Cleanup couch_file exports and unused code

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit a438454aee7e6402a7bf589d52f166a35c688661
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Thu May 19 18:08:03 2022 -0400

    Cleanup couch_file exports and unused code
    
    Removed:
     * append_binary_md5/2
     * assemble_file_chunk/1
     * append_term_md5/2
     * append_term_md5/3
     * pread_binaries/2
     * pread_iolists/2
     * append_binaries/2
---
 src/couch/src/couch_file.erl | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 0e786525f..ba8d9c42f 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -39,11 +39,11 @@
 % public API
 -export([open/1, open/2, close/1, bytes/1, sync/1, truncate/2, set_db_pid/2]).
 -export([pread_term/2, pread_iolist/2, pread_binary/2]).
--export([append_binary/2, append_binary_md5/2]).
--export([append_raw_chunk/2, assemble_file_chunk/1, assemble_file_chunk/2]).
--export([append_term/2, append_term/3, append_term_md5/2, append_term_md5/3]).
--export([pread_terms/2, pread_binaries/2, pread_iolists/2]).
--export([append_terms/2, append_terms/3, append_binaries/2]).
+-export([append_binary/2]).
+-export([append_raw_chunk/2, assemble_file_chunk/2]).
+-export([append_term/2, append_term/3]).
+-export([pread_terms/2]).
+-export([append_terms/2, append_terms/3]).
 -export([write_header/2, read_header/1]).
 -export([delete/2, delete/3, nuke_dir/2, init_delete_dir/1]).
 -export([last_read/1]).
@@ -124,13 +124,6 @@ append_term(Fd, Term, Options) ->
     Comp = couch_util:get_value(compression, Options, ?DEFAULT_COMPRESSION),
     append_binary(Fd, couch_compress:compress(Term, Comp)).
 
-append_term_md5(Fd, Term) ->
-    append_term_md5(Fd, Term, []).
-
-append_term_md5(Fd, Term, Options) ->
-    Comp = couch_util:get_value(compression, Options, ?DEFAULT_COMPRESSION),
-    append_binary_md5(Fd, couch_compress:compress(Term, Comp)).
-
 %%----------------------------------------------------------------------
 %% Purpose: To append an Erlang binary to the end of the file.
 %% Args:    Erlang term to serialize and append to the file.
@@ -142,13 +135,6 @@ append_term_md5(Fd, Term, Options) ->
 append_binary(Fd, Bin) ->
     ioq:call(Fd, {append_bin, assemble_file_chunk(Bin)}, erlang:get(io_priority)).
 
-append_binary_md5(Fd, Bin) ->
-    ioq:call(
-        Fd,
-        {append_bin, assemble_file_chunk(Bin, couch_hash:md5_hash(Bin))},
-        erlang:get(io_priority)
-    ).
-
 append_raw_chunk(Fd, Chunk) ->
     ioq:call(Fd, {append_bin, Chunk}, erlang:get(io_priority)).
 


[couchdb] 02/03: Remove dead code from smoosh

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5ded3ba5fa713a979adcd3c75a62782498de963e
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Thu May 19 18:02:53 2022 -0400

    Remove dead code from smoosh
---
 src/smoosh/src/smoosh_channel.erl | 13 -------------
 src/smoosh/src/smoosh_server.erl  | 14 --------------
 src/smoosh/src/smoosh_utils.erl   | 15 +--------------
 3 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/src/smoosh/src/smoosh_channel.erl b/src/smoosh/src/smoosh_channel.erl
index fbeb011d7..952f4fd50 100644
--- a/src/smoosh/src/smoosh_channel.erl
+++ b/src/smoosh/src/smoosh_channel.erl
@@ -460,19 +460,6 @@ maybe_start_compaction(State) ->
             State
     end.
 
-start_compact(State, {schema, DbName, GroupId}) ->
-    case smoosh_utils:ignore_db({DbName, GroupId}) of
-        false ->
-            {ok, Pid} = couch_md_index_manager:get_group_pid(
-                DbName,
-                GroupId
-            ),
-            Ref = erlang:monitor(process, Pid),
-            Pid ! {'$gen_call', {self(), Ref}, compact},
-            State#state{starting = [{Ref, {schema, DbName, GroupId}} | State#state.starting]};
-        _ ->
-            false
-    end;
 start_compact(State, DbName) when is_list(DbName) ->
     start_compact(State, ?l2b(DbName));
 start_compact(State, DbName) when is_binary(DbName) ->
diff --git a/src/smoosh/src/smoosh_server.erl b/src/smoosh/src/smoosh_server.erl
index 145f8d1ab..55c8f61fd 100644
--- a/src/smoosh/src/smoosh_server.erl
+++ b/src/smoosh/src/smoosh_server.erl
@@ -384,20 +384,6 @@ get_priority(Channel, {Shard, GroupId}) ->
             ),
             0
     end;
-get_priority(Channel, {schema, DbName, DDocId}) ->
-    case couch_md_index_manager:get_group_pid(DbName, DDocId) of
-        {ok, Pid} ->
-            {ok, SchemaInfo} = couch_md_index:get_info(Pid),
-            DiskSize = couch_util:get_value(disk_size, SchemaInfo),
-            DataSize = couch_util:get_value(data_size, SchemaInfo),
-            get_priority(Channel, DiskSize, DataSize, false);
-        {error, Reason} ->
-            couch_log:warning(
-                "Failed to get group_pid for ~p ~p ~p: ~p",
-                [Channel, DbName, DDocId, Reason]
-            ),
-            0
-    end;
 get_priority(Channel, DbName) when is_list(DbName) ->
     get_priority(Channel, ?l2b(DbName));
 get_priority(Channel, DbName) when is_binary(DbName) ->
diff --git a/src/smoosh/src/smoosh_utils.erl b/src/smoosh/src/smoosh_utils.erl
index ac9b0568f..6dd231ce7 100644
--- a/src/smoosh/src/smoosh_utils.erl
+++ b/src/smoosh/src/smoosh_utils.erl
@@ -13,23 +13,10 @@
 -module(smoosh_utils).
 -include_lib("couch/include/couch_db.hrl").
 
--export([get/2, get/3, group_pid/1, split/1, stringify/1, ignore_db/1]).
+-export([get/2, get/3, split/1, stringify/1, ignore_db/1]).
 -export([in_allowed_window/1, write_to_file/3]).
 -export([log_level/2]).
 
-group_pid({Shard, GroupId}) ->
-    case couch_view_group:open_db_group(Shard, GroupId) of
-        {ok, Group} ->
-            try
-                gen_server:call(couch_view, {get_group_server, Shard, Group})
-            catch
-                _:Error ->
-                    {error, Error}
-            end;
-        Else ->
-            Else
-    end.
-
 get(Channel, Key) ->
     ?MODULE:get(Channel, Key, undefined).