rnewson commented on PR #4679:
URL: https://github.com/apache/couchdb/pull/4679#issuecomment-1640198515

   make a file to be used as an attachment;
   
   ```
   #!/usr/bin/env python3
   
   file_size = 1 * 1024 * 1024
   chunk_size = 8 * 1024
   int_size = 16
   
   with open('att', 'bw') as f:
       for i in range(file_size // chunk_size):
           b = i.to_bytes(int_size, byteorder='big')
           for k in range(chunk_size // int_size):
               f.write(b)
   ```
   
   create a database full of docs with multiple attachments
   
   ```
   #!/usr/bin/env python3
   
   import requests
   
   auth = ('foo', 'bar')
   base = 'http://127.0.0.1:5984/db1'
   
   requests.delete(base, auth=auth)
   requests.put(base, auth=auth)
   
   for i in range(1000):
       r = requests.put('{}/doc{}'.format(base, i), data='{}', auth=auth)
       print('create doc {}: {}'.format(i, r.json()))
       rev = r.json()['rev']
       for j in range(4):
           with open('att', 'rb') as f:
               r = requests.put('{}/doc{}/att{}?rev={}'.format(base, i, j, 
rev), data=f, auth=auth)
               print('add att {} to doc {}: {}'.format(j, i, r.json()))
               rev = r.json()['rev']
   ```
   
   then try to replicate this database to a new, empty database. observe that 
doc_write_failures is non-zero without the patch and reliably zero with the 
patch.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to