Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy iterator interrupt #681

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

abudnik
Copy link
Member

@abudnik abudnik commented Dec 22, 2015

  1. copy-iterator: stop iteration only if connection failed or no space left on remote backend
  2. server-send: check that source and destination backends are not the same
  3. server-send: added 80 reserved bytes to dnet_server_send_request struct

@abudnik
Copy link
Member Author

abudnik commented Dec 22, 2015

PRs #668 & #679 are depend on this PR

@@ -783,6 +785,25 @@ int dnet_server_send_write(struct dnet_server_send_ctl *send,
(unsigned long long)re->iterated_keys, (unsigned long long)re->total_keys,
atomic_read(&send->bytes_pending), send->bytes_pending_max);

// check that source and destination backends are not the same
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be on the client side?
Do not even try to start iterator if its source/destination backends are the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this happens when client state gone during iteration. It starts to write to itself.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I see. Please add extended comments about this case

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@bioothod
Copy link
Member

How do #668 and #679 depend on this pull request?

ctl.id.group_id = group_id;
const struct dnet_net_state *st = dnet_state_get_first_with_backend(n, &ctl.id, &backend_id);
if (st == n->st && backend_id == send->backend_id) {
dnet_log(n, DNET_LOG_ERROR, "%s: Interrupting iterator: source and destination backends are the same: "
Copy link
Member

Choose a reason for hiding this comment

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

Does it really interrupt iterator in this case or it just skips the key?

Copy link
Member Author

Choose a reason for hiding this comment

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

It interrupts iterrator. I've manually tested this code with iptables before sending PR :)

Copy link
Member

Choose a reason for hiding this comment

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

How can it be tested via iptables? It's about writing keys when destination and source are the same backend.

Copy link
Member Author

Choose a reason for hiding this comment

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

It interrupts iterrator.

Copy link
Member

Choose a reason for hiding this comment

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

What?

Copy link
Member Author

Choose a reason for hiding this comment

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

Iterator's callback returns error code from dnet_server_send_write(), so iteration stops on this error.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tested manually with iptables closing remote connection, so this case was reproduced and iteration stopped.

Copy link
Member

Choose a reason for hiding this comment

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

It shouldn't interrupt iteration here and there are few reasons for that:

  • it should avoid writing keys to the same backend, but it should write all keys to other groups
  • if there is only one destination group, it should skip keys that should be written to the same backend, but it should write all keys to other backends

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree and will fix it soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -671,6 +672,28 @@ static int dnet_server_send_sync(struct dnet_server_send_ctl *ctl)
return dnet_server_send_put(ctl);
}

static int dnet_filter_invalid_groups(int *groups, const struct dnet_server_send_ctl *send, struct dnet_node *n, struct dnet_id *id)
Copy link
Member

Choose a reason for hiding this comment

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

This requires more comments about the whole logic behind this function.
Why is it needed, what does it do, how does it modify group array.

One should understand this function without looking into the code, but from description.
Looking into the code is only needed when you want to fix a bug.

It also leaks state.

Copy link
Member Author

Choose a reason for hiding this comment

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

@abudnik abudnik force-pushed the copy_iter_interrupt branch 2 times, most recently from 4782b72 to 2b37492 Compare December 24, 2015 13:07
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