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 2017/06/05 22:21:32 UTC

[couchdb] 01/01: Handle attachments in a mixed cluster environment.

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 <va...@apache.org>
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" <co...@couchdb.apache.org>.