[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
Github user iilyak closed the pull request at: https://github.com/apache/couchdb-couch-replicator/pull/51 ---
[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
Github user iilyak commented on a diff in the pull request: https://github.com/apache/couchdb-couch-replicator/pull/51#discussion_r100128076 --- Diff: src/couch_replicator.erl --- @@ -600,8 +562,23 @@ terminate_cleanup(State) -> format_status(_Opt, [_PDict, State]) -> -[{data, [{"State", state_strip_creds(State)}]}]. - +Rep = couch_replicator_utils:format_rep_record(State#rep_state.rep_details), +[{data, [ +{"State", [{rep_details, Rep} | ?from_record(rep_state, State, [ +session_id, +start_seq, +committed_seq, +current_through_seq, +%%seqs_in_progress = [], --- End diff -- I'll remover it --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
Github user iilyak commented on a diff in the pull request: https://github.com/apache/couchdb-couch-replicator/pull/51#discussion_r100128054 --- Diff: src/couch_replicator.erl --- @@ -1035,3 +1012,39 @@ rep_stats(State) -> {doc_write_failures, couch_replicator_stats:doc_write_failures(Stats)}, {checkpointed_source_seq, CommittedSeq} ]. + +-ifdef(TEST). + +-include_lib("eunit/include/eunit.hrl"). + +format_status_test() -> +S = "https://user_foo:top_secret@account_bar1.cloudant.com/database_baz/";, +T = "https://user_foo:top_secret@account_bar2.cloudant.com/baz_backup/";, +Rep0 = list_to_tuple([rep | record_info(fields, rep)]), +State0 = list_to_tuple([rep_state | record_info(fields, rep_state)]), +Rep = Rep0#rep{source = #httpdb{url = S}, target = #httpdb{url = T}}, +State = State0#rep_state{rep_details = Rep}, +?assertEqual([{data, [{"State", [ +{rep_details,[ + {source,"https://user_foo:*@account_bar1.cloudant.com/database_baz/"}, --- End diff -- I'll fix it --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
Github user tonysun83 commented on a diff in the pull request: https://github.com/apache/couchdb-couch-replicator/pull/51#discussion_r90393469 --- Diff: src/couch_replicator.erl --- @@ -1035,3 +1012,39 @@ rep_stats(State) -> {doc_write_failures, couch_replicator_stats:doc_write_failures(Stats)}, {checkpointed_source_seq, CommittedSeq} ]. + +-ifdef(TEST). + +-include_lib("eunit/include/eunit.hrl"). + +format_status_test() -> +S = "https://user_foo:top_secret@account_bar1.cloudant.com/database_baz/";, +T = "https://user_foo:top_secret@account_bar2.cloudant.com/baz_backup/";, +Rep0 = list_to_tuple([rep | record_info(fields, rep)]), +State0 = list_to_tuple([rep_state | record_info(fields, rep_state)]), +Rep = Rep0#rep{source = #httpdb{url = S}, target = #httpdb{url = T}}, +State = State0#rep_state{rep_details = Rep}, +?assertEqual([{data, [{"State", [ +{rep_details,[ + {source,"https://user_foo:*@account_bar1.cloudant.com/database_baz/"}, --- End diff -- don't want to be too picky, but in the other tests in the companion PR you had a space for these KV pairs. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
Github user iilyak commented on a diff in the pull request: https://github.com/apache/couchdb-couch-replicator/pull/51#discussion_r85435146 --- Diff: src/couch_replicator.erl --- @@ -600,8 +562,23 @@ terminate_cleanup(State) -> format_status(_Opt, [_PDict, State]) -> -[{data, [{"State", state_strip_creds(State)}]}]. - +Rep = couch_replicator_utils:format_rep_record(State#rep_state.rep_details), +[{data, [ +{"State", ?from_record(rep_state, State, [ +start_seq, +committed_seq, +current_through_seq, +%%seqs_in_progress = [], --- End diff -- not sure how useful seqs_in_progress --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] couchdb-couch-replicator pull request #51: Format gen_server state to remove...
GitHub user iilyak opened a pull request: https://github.com/apache/couchdb-couch-replicator/pull/51 Format gen_server state to remove plain passwords Add format_status/2 to every gen_server to prune the state before passing it to SASL logger. There are two goals for this work: - eliminate plain text passwords in the logs - reduce the size of the terms we log The size of a term is a real problem. Since what's currently happening is: 1. we have lot's of data in state (queues for example) 2. the process crashes so the term is send to group leader 3. eventually lagger receives the term 4. couch_log format the term (we have io:format fork [couch_log_trunc_io_fmt] (https://github.com/apache/couchdb-couch-log/blob/master/src/couch_log_trunc_io_fmt.erl)) Having truncate in step `#4` doesn't help much in case we have lot's of events to log. Since we bottleneck on group leader mailbox. Therefore we need to reduce the term size before we attempt to log it. COUCHDB-1606 You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb-couch-replicator 71267-format_process_state Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-couch-replicator/pull/51.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #51 commit 6adced02a672b065fb77432d58779b0ecf91359a Author: ILYA Khlopotov Date: 2016-10-27T21:18:58Z Format gen_server state to remove plain passwords Add format_status/2 to every gen_server to prune the state before passing it to SASL logger. There are two goals for this work: - eliminate plain text passwords in the logs - reduce the size of the terms we log COUCHDB-1606 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---