You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by nickva <gi...@git.apache.org> on 2017/02/07 05:03:08 UTC

[GitHub] couchdb-couch pull request #226: Allow limiting length of document ID

GitHub user nickva opened a pull request:

    https://github.com/apache/couchdb-couch/pull/226

    Allow limiting length of document ID

    Previously it was not possibly to define a maxum document ID size. That meant
    large document ID would hit various limitations and corner cases. For example,
    large document IDs could be inserted via a _bulk_docs endpoint but then trying
    to insert the same document via a single HTTP method like PUT would fail
    because of a limitation in Mochiweb's HTTP parser.
    
    Let operators specify a maxium document ID length via the:
    
    ```
    couchdb.max_document_id_length = 0
    ```
    
    configuration.
    
    The default value of 0 means current behavior where document ID length is not
    checked.
    
    COUCHDB-3293

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch couchdb-3293

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch/pull/226.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 #226
    
----
commit 8e1443a8165d07311ab1c0b1a5c0a33fb48de08b
Author: Nick Vatamaniuc <va...@apache.org>
Date:   2017-02-07T04:53:51Z

    Allow limiting length of document ID
    
    Previously it was not possibly to define a maxum document ID size. That meant
    large document ID would hit various limitations and corner cases. For example,
    large document IDs could be inserted via a _bulk_docs endpoint but then trying
    to insert the same document via a single HTTP method like PUT would fail
    because of a limitation in Mochiweb's HTTP parser.
    
    Let operators specify a maxium document ID length via the:
    
    ```
    couchdb.max_document_id_length = 0
    ```
    
    configuration.
    
    The default value of 0 means current behavior where document ID length is not
    checked.
    
    COUCHDB-3293

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by nickva <gi...@git.apache.org>.
Github user nickva commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    Before setting the limit (python code):
    
    ```
    d1 = {"_id":"2"*21}
    d.update([d1])
    
    >>>  [(True, u'222222222222222222222', u'1-967a00dff5e02add41819138abb3284d')]
    ```
    
    after `> config:set("couchdb", "max_document_id_length", "20").`
    
    ```
    d2 = {"_id":"x"*21}
    d.update([d2])
    
    ServerError: (400, (u'illegal_docid', u'Document id is too long'))
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    @nickva I think this would be a nice helper. For quite specific cases, but nice.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by nickva <gi...@git.apache.org>.
Github user nickva commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    Will do. Maybe we should even have it as a config function get_integer_or_infinity? But that's for another PR...


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    Good point. The `max_replication_retry_count` option is an example where the value is an integer, but the `infinity` is used for no limit value.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by nickva <gi...@git.apache.org>.
Github user nickva commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    @rnewson @kxepal pr to use infinity for replicator as well https://github.com/apache/couchdb-couch-replicator/pull/55


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    +1. tests pass locally
    ```
        Running test function(s):
          couch_doc_json_tests:json_doc_test_/0
          couch_doc_tests:validate_docid_test_/0
    ======================== EUnit ========================
    couch_doc_tests:89: validate_docid_test_...[0.003 s] ok
    couch_doc_tests:90: validate_docid_test_...ok
    couch_doc_tests:91: validate_docid_test_...ok
    couch_doc_tests:92: validate_docid_test_...[0.001 s] ok
    couch_doc_tests:93: validate_docid_test_...ok
    couch_doc_tests:95: validate_docid_test_...ok
    couch_doc_tests:97: validate_docid_test_...ok
    couch_doc_tests:99: validate_docid_test_...ok
    couch_doc_tests:101: validate_docid_test_...ok
    couch_doc_tests:103: validate_docid_test_...ok
    couch_doc_tests:105: validate_docid_test_...ok
    Document from JSON
      couch_doc_json_tests:168: from_json_success_cases (Return an empty document for an empty JSON object.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Parses document ids.)...ok
      couch_doc_json_tests:168: from_json_success_cases (_design/document ids.)...ok
      couch_doc_json_tests:168: from_json_success_cases (_local/document ids.)...ok
      couch_doc_json_tests:168: from_json_success_cases (_rev stored in revs.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Non underscore prefixed fields stored in body.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Attachments are parsed correctly.)...[0.011 s] ok
      couch_doc_json_tests:168: from_json_success_cases (_deleted controls the deleted field.)...ok
      couch_doc_json_tests:168: from_json_success_cases ({"_deleted": false} is ok.)...ok
      couch_doc_json_tests:168: from_json_success_cases (_revisions attribute are preferred to _rev.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Drops _revs_info.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Drops _local_seq.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Drops _conflicts.)...ok
      couch_doc_json_tests:168: from_json_success_cases (Drops _deleted_conflicts.)...ok
      couch_doc_json_tests:239: from_json_error_cases (arrays are invalid)...ok
      couch_doc_json_tests:239: from_json_error_cases (integers are invalid)...ok
      couch_doc_json_tests:239: from_json_error_cases (literals are invalid)...ok
      couch_doc_json_tests:239: from_json_error_cases (Document id must be a string.)...ok
      couch_doc_json_tests:239: from_json_error_cases (Disallow arbitrary underscore prefixed docids.)...ok
      couch_doc_json_tests:239: from_json_error_cases (_rev must be a string)...ok
      couch_doc_json_tests:239: from_json_error_cases (_rev must be %d-%s)...ok
      couch_doc_json_tests:245: from_json_error_cases (Error if _rev's integer expection is broken.)...ok
      couch_doc_json_tests:239: from_json_error_cases (_revisions.start must be an integer.)...ok
      couch_doc_json_tests:239: from_json_error_cases (_revions.ids must be a list.)...ok
      couch_doc_json_tests:239: from_json_error_cases (Revision ids must be strings.)...ok
      couch_doc_json_tests:239: from_json_error_cases (Underscore prefix fields are reserved.)...ok
      [done in 0.088 s]
    Document to JSON
      couch_doc_json_tests:400: to_json_success_cases (Empty docs are {"_id": ""})...ok
      couch_doc_json_tests:400: to_json_success_cases (_id is added.)...ok
      couch_doc_json_tests:400: to_json_success_cases (_rev is added.)...ok
      couch_doc_json_tests:402: to_json_success_cases (_revisions include with revs option)...ok
      couch_doc_json_tests:400: to_json_success_cases (Arbitrary fields are added.)...ok
      couch_doc_json_tests:400: to_json_success_cases (Deleted docs no longer drop body members.)...ok
      couch_doc_json_tests:400: to_json_success_cases (_revs_info field is added correctly.)...ok
      couch_doc_json_tests:400: to_json_success_cases (_local_seq is added as an integer.)...ok
      couch_doc_json_tests:400: to_json_success_cases (_conflicts is added as an array of strings.)...ok
      couch_doc_json_tests:400: to_json_success_cases (_deleted_conflicsts is added as an array of strings.)...ok
      couch_doc_json_tests:400: to_json_success_cases (Attachments attached as stubs only include a length.)...ok
      couch_doc_json_tests:402: to_json_success_cases (Attachments included inline with attachments option.)...ok
      [done in 0.036 s]
    =======================================================
      All 49 tests passed.
    ``` 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request #226: Allow limiting length of document ID

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch/pull/226


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    @nickva 
    Nice! +1


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on the issue:

    https://github.com/apache/couchdb-couch/pull/226
  
    Can we change this so that an undefined value means 'no limit' and any set value, which must be an integer, is the length? I realise this means we can't use config:get_integer, but it seems awkward that '0' means 'infinite'.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---