Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
attachments not being replicated from touchdb to couchdb.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mohit  
View profile  
 More options Oct 25 2012, 6:04 am
From: Mohit <mohit.tiw...@gmail.com>
Date: Thu, 25 Oct 2012 03:04:38 -0700 (PDT)
Local: Thurs, Oct 25 2012 6:04 am
Subject: attachments not being replicated from touchdb to couchdb.

Hi all,

quick question: do attachments get replicated across touchdb and couchdbs?

(I saw prior posts with problems regarding this, e.g.
https://groups.google.com/forum/#!topic/mobile-couchbase/h_7sAddedvw)

When I add an image attachment to a document on the touchdb client -- following
which I can get the attachment and display it locally -- the attachment
does not show up on the couchdb server. To check, I can see the local
document size go from 100kB to 600kB when I add a photo, but the remote
document size only increases from 20kB to 33kB. (curl -X GET ../_all_docs
output below).

Other android clients replicating with couchdb crash when trying to get
the attachment from their local touchdb. The document name, however gets
replicated correctly, which indicates that replication (minus the
attachments) seems to work fine across touchdb and couchdb.

Let me know if you have any suggestions! Thanks,
Mohit

Setup: Touchdb-android(JB)-client replicating push and pull with Couchdb
1.2.0

Code for creating attachment on touchdb client:
public void insertPhoto(Photos photo) {
String imagePath = photo.getUri();
File file = new File(imagePath);
InputStream data = null;
try {
data = new FileInputStream(file);

} catch (FileNotFoundException e) {

e.printStackTrace();
}

String contentType = "image/jpeg";

AttachmentInputStream a = new AttachmentInputStream(new
String(photo.getTimeStamp()),
data, contentType);

lastInsertedId = dbInterface.createAttachment(new
String(photo.getTimeStamp()), a);  //
calls dbConnector.createAttachment(string, a);
 }

_all_docs on touchdb: curl -X GET touchdb-android:5984/photoapp/_all_docs

{"offset":0,"total_rows":2,"rows":[{"value":{"rev":"1-9b6b0dc3-2220-4789-a2 a5-d4a311b1727b"},"id":"IMG_20121025_024511.jpg","key":"IMG_20121025_024511 .jpg"},{"value":{"rev":"1-2ac6632b-8aca-453c-a955-7546d560fc68"},"id":"IMG_ 20121025_024633.jpg","key":"IMG_20121025_024633.jpg"}]}

_all_docs on couchdb:  curl -X GET server:5984/photoapp/_all_docs

{"total_rows":2,"offset":0,"rows":[
{"id":"IMG_20121025_024511.jpg","key":"IMG_20121025_024511.jpg","value":{"r ev":"1-9b6b0dc3-2220-4789-a2a5-d4a311b1727b"}},
{"id":"IMG_20121025_024633.jpg","key":"IMG_20121025_024633.jpg","value":{"r ev":"1-2ac6632b-8aca-453c-a955-7546d560fc68"}}
]}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mohit  
View profile  
 More options Oct 25 2012, 7:04 pm
From: Mohit <mohit.tiw...@gmail.com>
Date: Thu, 25 Oct 2012 16:04:10 -0700 (PDT)
Local: Thurs, Oct 25 2012 7:04 pm
Subject: Re: attachments not being replicated from touchdb to couchdb.

update: I tried the touchdb testapp, and the unit tests for attachments and
attachments-using-ektorp both pass.

(tests:
https://github.com/couchbaselabs/TouchDB-Android/blob/master/TouchDB-...,
and
https://github.com/couchbaselabs/TouchDB-Android/blob/master/TouchDB-...)

But these tests seem to cover adding and retrieving attachments from a
local database only...I am able to attach images to couchdb documents using
futon,
so I'm assuming the problem might be with either ektorp or touchdb's
attachment/replication api implementation.
Or with my implementation above :-)

Please let me know if you have any thoughts on this!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marty Schoch  
View profile  
 More options Oct 25 2012, 7:16 pm
From: Marty Schoch <marty.sch...@gmail.com>
Date: Thu, 25 Oct 2012 19:16:48 -0400
Local: Thurs, Oct 25 2012 7:16 pm
Subject: Re: attachments not being replicated from touchdb to couchdb.

I'm pretty sure the problem is not in Ektorp, it is in the replicator
implementation.  The TouchDB-Android replicator is a mess and I
haven't any time to work on it for about 2 months now.

marty


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bart  
View profile  
 More options Dec 3 2012, 6:57 am
From: Bart <bart.sme...@gmail.com>
Date: Mon, 3 Dec 2012 03:57:17 -0800 (PST)
Local: Mon, Dec 3 2012 6:57 am
Subject: Re: attachments not being replicated from touchdb to couchdb.

Hi Marty,

Did you make any progress yet on the TouchDB-Android replicator? I seem to
be having a similar problem when creating attachments. I am trying to add
an attachment to an existing document using the following piece of code:

        final File attachmentFile = new File(URI.create(uri.toString()));
        final String contentType = "image/jpeg";
        final AttachmentInputStream attachmentContents = new
AttachmentInputStream(attachmentFile.getName(), new
FileInputStream(attachmentFile), contentType);
        couchDbConnector.createAttachment(resourceId, revision,
attachmentContents);

Note that *uri* points to a valid file, and both *resourceId* and *revision*are also correct.

I'm not getting any errors in the log but after replicating to the central
CouchDB, the document has no attachments whatsoever. Even worse: any
existing attachments seem to have been removed from the document as well.
The local version of the document does seem to have the attachment attached
correctly.

Kind regards,

Bart


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marty Schoch  
View profile  
 More options Dec 3 2012, 11:58 am
From: Marty Schoch <marty.sch...@gmail.com>
Date: Mon, 3 Dec 2012 11:58:27 -0500
Local: Mon, Dec 3 2012 11:58 am
Subject: Re: attachments not being replicated from touchdb to couchdb.

I haven't yet gone back to working on TouchDB-Android, but I hope to this
week.  First up will be merging the replicator fixes branch to mainline (no
one reported it being worse than the main branch, and I feel it is better).

Next will be seeing why attachments aren't getting pushed.

What I can say is that if your attachments look correct in TouchDB (which
seems to be what you're saying), then there is no need to review the code
that creates the attachment.  The problem must be in the replicator.

marty


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paschal Maduhu  
View profile  
 More options Dec 12 2012, 3:00 am
From: Paschal Maduhu <maduhu1...@gmail.com>
Date: Wed, 12 Dec 2012 00:00:11 -0800 (PST)
Local: Wed, Dec 12 2012 3:00 am
Subject: Re: attachments not being replicated from touchdb to couchdb.

Hi Marty,
is there any progress on the TouchDB attachments Replication.
It seems that Attachments are locally present, but not in cloud CouchDB.
Thanks,
Paschal


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jens Alfke  
View profile  
 More options Dec 12 2012, 1:01 pm
From: Jens Alfke <j...@couchbase.com>
Date: Wed, 12 Dec 2012 10:01:39 -0800
Local: Wed, Dec 12 2012 1:01 pm
Subject: Re: attachments not being replicated from touchdb to couchdb.

On Dec 12, 2012, at 12:00 AM, Paschal Maduhu <maduhu1...@gmail.com<mailto:maduhu1...@gmail.com>> wrote:

is there any progress on the TouchDB attachments Replication.

Looking at the commit history of the repo<https://github.com/couchbaselabs/TouchDB-Android/commits/master> is a good way to answer questions like that.
Marty has said several times recently that he hasn’t had time to work on TouchDB in recent months, but plans to start again soon.

—Jens


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »