You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@quickstep.apache.org by hbdeshmukh <gi...@git.apache.org> on 2016/10/21 21:57:37 UTC

[GitHub] incubator-quickstep pull request #120: Store handle count in FastSeparateCha...

GitHub user hbdeshmukh opened a pull request:

    https://github.com/apache/incubator-quickstep/pull/120

    Store handle count in FastSeparateChainingHashTable

    - Using handles_ vector directly in FastSeparateChainingHashTable can
      cause problems. One example is a distinctify hash table which doesn't
      accept any payload. In this case, the reference to handles_ vector
      becomes garbage after the constructor gets executed. Therefore to
      avoid faults about accessing an invalid reference, we use the number
      of handles as a guarding mechanism.
    
    - Verified by reducing the hash table size artificially, so as to forcing a ``resize()`` operation. The ``destroyPayload()`` function gets called in ``resize()``. The fix in this PR fixes the behavior of ``destroyPayload`` function. 

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

    $ git pull https://github.com/apache/incubator-quickstep fix-emptypayload-fastsephashtable

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

    https://github.com/apache/incubator-quickstep/pull/120.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 #120
    
----
commit 9c32ea45c5971568fae3d611a0fc9d963d7501bf
Author: Harshad Deshmukh <hb...@apache.org>
Date:   2016-10-21T21:15:53Z

    Remember handle count in FastSeparateChainingHashTable
    
    - Using handles_ vector directly in FastSeparateChainingHashTable can
      cause problems. One example is a distinctify hash table which doesn't
      accept any payload. In this case, the reference to handles_ vector
      becomes garbage after the constructor gets executed. Therefore to
      avoid faults about accessing an invalid reference, we use the number
      of handles as a guarding mechanism.

----


---
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] incubator-quickstep issue #120: Store handle count in FastSeparateChainingHa...

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

    https://github.com/apache/incubator-quickstep/pull/120
  
    LGTM. Merging.


---
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] incubator-quickstep pull request #120: Store handle count in FastSeparateCha...

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

    https://github.com/apache/incubator-quickstep/pull/120


---
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] incubator-quickstep pull request #120: Store handle count in FastSeparateCha...

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

    https://github.com/apache/incubator-quickstep/pull/120#discussion_r84566413
  
    --- Diff: storage/FastSeparateChainingHashTable.hpp ---
    @@ -145,10 +145,10 @@ class FastSeparateChainingHashTable
             header_->buckets_allocated.load(std::memory_order_relaxed);
         void *bucket_ptr = static_cast<char *>(buckets_) + kValueOffset;
         for (std::size_t bucket_num = 0; bucket_num < num_buckets; ++bucket_num) {
    -      for (std::size_t handle_num = 0; handle_num < handles_.size(); ++handle_num) {
    +      for (std::size_t handle_id = 0; handle_id < num_handles_; ++handle_id) {
             void *value_internal_ptr =
    --- End diff --
    
    Hi @hbdeshmukh,
    It is not critical but I have a question.
    Is there a particular reason for `value_internal_ptr` 's type is `void *` instead of `char *`. Right hand side of the assignment has type of `char *`.


---
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] incubator-quickstep pull request #120: Store handle count in FastSeparateCha...

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

    https://github.com/apache/incubator-quickstep/pull/120#discussion_r84570072
  
    --- Diff: storage/FastSeparateChainingHashTable.hpp ---
    @@ -145,10 +145,10 @@ class FastSeparateChainingHashTable
             header_->buckets_allocated.load(std::memory_order_relaxed);
         void *bucket_ptr = static_cast<char *>(buckets_) + kValueOffset;
         for (std::size_t bucket_num = 0; bucket_num < num_buckets; ++bucket_num) {
    -      for (std::size_t handle_num = 0; handle_num < handles_.size(); ++handle_num) {
    +      for (std::size_t handle_id = 0; handle_id < num_handles_; ++handle_id) {
             void *value_internal_ptr =
    --- End diff --
    
    I think it's okay either way. If we are using `char *`, then we need `reinterpret_cast` to cast `char *` to `std::uint8_t *`. Here two `static_cast`'s should semantically be better.


---
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] incubator-quickstep issue #120: Store handle count in FastSeparateChainingHa...

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

    https://github.com/apache/incubator-quickstep/pull/120
  
    Hi @hakanmemisoglu 
    
    Can you please review this 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.
---