Skip to content

Fixes#30

Merged
luisremis merged 4 commits intodevelopfrom
fixes
Aug 2, 2018
Merged

Fixes#30
luisremis merged 4 commits intodevelopfrom
fixes

Conversation

@vishakha041
Copy link
Copy Markdown
Contributor

In case of errors, the lack of PMGDQueryHandler pointer cleanup was causing problems. And not being able to set the number of attempts for RWLock was annoying for some application use cases. This pull request address both the problems.

src/RWLock.h Outdated
{ ::atomic_and<uint16_t>(m, v); }

volatile uint16_t _rw_lock;
unsigned _max_attempts;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be const (since it is initialized in the constructor). This may allow compiler to improve code generation in the methods where it is used.

src/RWLock.h Outdated
{ ::atomic_and<uint16_t>(m, v); }

volatile uint16_t _rw_lock;
unsigned _max_attempts;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where _max_attempts is used.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's not clear that this is the comment that caused me to withhold approval. The other comments are questions/suggestions.


public:
static void init();
static void destroy();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this a destructor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pairs up with an init

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I can see that. But init is needed (I assume) because the information required to perform initialization isn't available at construction time. The same concern doesn't apply to using a destructor, and I think performing this cleanup work in the destructor would be preferable.

Copy link
Copy Markdown

@philiplantz philiplantz Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you pointed out, the object is a static member, so the destructor isn't called at the time when this destroy function is called, so this cannot be changed to a destructor.


void PMGDQueryHandler::destroy()
{
if (_db) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't needed.

Vishakha Gupta-Cledat added 3 commits May 24, 2018 22:17
Edit multiple add test in python to add slowdown between threads
to avoid connection refusal due to queueing.

public:
RWLock() : _rw_lock(0) {}
static const unsigned MAX_ATTEMPTS = 10;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called DEFAULT_MAX_ATTEMPTS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Copy link
Copy Markdown

@philiplantz philiplantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may not be aware that the branch name is included in the commit message for the merge commit, so you may want to choose more descriptive branch names. (Look at the commit history and you will see some pretty iffy merge commit messages.)

thread_add = Thread(target=self.addEntity,args=(i,) )
thread_add.start()
thread_arr.append(thread_add)
time.sleep(0.002)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced we should change the test so that it passes.
The introduction of the RWlock and msync should not break this tests, we should push a fix to address this, not change the tests so that we mask it.

Should we create an separate issue for this? Or want to address it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can create a separate issue. What I noticed here is....msync increases how long PMGD takes. That means the reader writer lock has more timeouts and so more threads wait. That somehow seems to be messing with some queue that starts denying newer threads from even getting connected. Needs more exploring which I don't want to hold up this pull request for.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, one of the things we need to figure now at the VDMS layer is that timeout based locking is bound to cause more failures since threads don't get to wait however long. Do we introduce internal retries or let the client retry? We should of course try to figure out the right values as we run more experiments but just saying.


public:
RWLock() : _rw_lock(0) {}
static const unsigned MAX_ATTEMPTS = 10;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants