You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by davisp <gi...@git.apache.org> on 2014/12/12 21:31:42 UTC

[GitHub] couchdb-couch pull request: Add IS_OLD_RECORD macro

GitHub user davisp opened a pull request:

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

    Add IS_OLD_RECORD macro

    This can be used in guards to detect if a state variable needs to be
    upgraded. An example of it's use might be:
    
        handle_call(Msg, From, St) when ?IS_OLD_RECORD(St, #st{}) ->
            handle_call(Msg, From, upgrade_state(St));
    
    This is useful for upgrading any of our various gen behaviors that
    aren't properly supervised.
    
    COUCHDB-2511

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

    $ git pull https://github.com/apache/couchdb-couch 2511-add-is-old-record

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

    https://github.com/apache/couchdb-couch/pull/23.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 #23
    
----
commit dd83465cee262162bee4819dc21cbca073181861
Author: Paul J. Davis <pa...@gmail.com>
Date:   2014-12-12T20:25:38Z

    Add IS_OLD_RECORD macro
    
    This can be used in guards to detect if a state variable needs to be
    upgraded. An example of it's use might be:
    
        handle_call(Msg, From, St) when ?IS_OLD_RECORD(St, #st{}) ->
            handle_call(Msg, From, upgrade_state(St));
    
    This is useful for upgrading any of our various gen behaviors that
    aren't properly supervised.
    
    COUCHDB-2511

----


---
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: Add IS_OLD_RECORD macro

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

    https://github.com/apache/couchdb-couch/pull/23#issuecomment-69665022
  
    @davisp ok with merge?


---
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: Add IS_OLD_RECORD macro

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

    https://github.com/apache/couchdb-couch/pull/23#issuecomment-67052194
  
    +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 pull request: Add IS_OLD_RECORD macro

Posted by chewbranca <gi...@git.apache.org>.
Github user chewbranca commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/23#issuecomment-67385114
  
    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 pull request: Add IS_OLD_RECORD macro

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/23#discussion_r21851111
  
    --- Diff: include/couch_db.hrl ---
    @@ -23,6 +23,8 @@
     -define(JSON_ENCODE(V), couch_util:json_encode(V)).
     -define(JSON_DECODE(V), couch_util:json_decode(V)).
     
    +-define(IS_OLD_RECORD(V, R), (tuple_size(V) /= tuple_size(R))).
    --- End diff --
    
    But wouldn't it get false positive result if we just change some record field name / remove some field and add new one?


---
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: Add IS_OLD_RECORD macro

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

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


---
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: Add IS_OLD_RECORD macro

Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/23#issuecomment-85280780
  
    +1 to merge. I guess I should probably get to that.


---
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: Add IS_OLD_RECORD macro

Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/23#discussion_r21931145
  
    --- Diff: include/couch_db.hrl ---
    @@ -23,6 +23,8 @@
     -define(JSON_ENCODE(V), couch_util:json_encode(V)).
     -define(JSON_DECODE(V), couch_util:json_decode(V)).
     
    +-define(IS_OLD_RECORD(V, R), (tuple_size(V) /= tuple_size(R))).
    --- End diff --
    
    You'll get a false negative if the change to a record doesn't change the size. But in that case you probably need to avoid the use of dynamic code upgrades altogether.


---
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: Add IS_OLD_RECORD macro

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/23#discussion_r21931509
  
    --- Diff: include/couch_db.hrl ---
    @@ -23,6 +23,8 @@
     -define(JSON_ENCODE(V), couch_util:json_encode(V)).
     -define(JSON_DECODE(V), couch_util:json_decode(V)).
     
    +-define(IS_OLD_RECORD(V, R), (tuple_size(V) /= tuple_size(R))).
    --- End diff --
    
    Sounds fair.


---
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: Add IS_OLD_RECORD macro

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

    https://github.com/apache/couchdb-couch/pull/23#issuecomment-67231075
  
    +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.
---