Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C2DA5200CC2 for ; Tue, 6 Jun 2017 00:21:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C1401160BE7; Mon, 5 Jun 2017 22:21:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1340E160BE1 for ; Tue, 6 Jun 2017 00:21:33 +0200 (CEST) Received: (qmail 78334 invoked by uid 500); 5 Jun 2017 22:21:33 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 78324 invoked by uid 99); 5 Jun 2017 22:21:33 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2017 22:21:33 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 4068881490; Mon, 5 Jun 2017 22:21:31 +0000 (UTC) Date: Mon, 05 Jun 2017 22:21:32 +0000 To: "commits@couchdb.apache.org" Subject: [couchdb] 01/01: Handle attachments in a mixed cluster environment. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: vatamane@apache.org Reply-To: "commits@couchdb.apache.org" In-Reply-To: <149670129173.6302.3955847995403436202@gitbox.apache.org> References: <149670129173.6302.3955847995403436202@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: couchdb X-Git-Refname: refs/heads/COUCHDB-3287-pluggable-storage-engines-mixed-cluster-attachments X-Git-Reftype: branch X-Git-Rev: 7cd630f82fa0bbbcb8892d5fa72f7bde88b1b071 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20170605222132.4068881490@gitbox.apache.org> archived-at: Mon, 05 Jun 2017 22:21:35 -0000 This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch COUCHDB-3287-pluggable-storage-engines-mixed-cluster-attachments in repository https://gitbox.apache.org/repos/asf/couchdb.git commit 7cd630f82fa0bbbcb8892d5fa72f7bde88b1b071 Author: Nick Vatamaniuc AuthorDate: Mon Jun 5 18:05:06 2017 -0400 Handle attachments in a mixed cluster environment. Previously attachment uploading would fail if non-PSE nodes would push attachment to PSE nodes. This commit handles dynamic translation of previous attachment streamer format to the new PSE-version. --- src/couch/src/couch_att.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/couch/src/couch_att.erl b/src/couch/src/couch_att.erl index bd53086..ae08c2f 100644 --- a/src/couch/src/couch_att.erl +++ b/src/couch/src/couch_att.erl @@ -490,6 +490,19 @@ flush(Db, Att) -> flush_data(Db, fetch(data, Att), Att). +flush_data(Db, {Fd, StreamPointer}, Att) when is_pid(Fd) -> + % Temporary clause to handle previous non-PSE versions in a mixed cluster. + % Only applicable to for (default) couch_bt_engine. Remove in next release. + case couch_db_engine:get_engine(Db) of + couch_bt_engine -> + StreamEngine = {couch_bt_engine_stream, {Fd, StreamPointer}}, + flush_data(Db, {stream, StreamEngine}, Att); + OtherEngine -> + Msg = "Mixed (PSE vs non-PSE) cluster attachment handling only" + "supported for default couch_bt_engine not ~p", + couch_log:error(Msg, OtherEngine), + erlang:error({unsupported_mixed_cluster_configuration, OtherEngine}) + end; flush_data(Db, Data, Att) when is_binary(Data) -> couch_db:with_stream(Db, Att, fun(OutputStream) -> couch_stream:write(OutputStream, Data) -- To stop receiving notification emails like this one, please contact "commits@couchdb.apache.org" .