Skip to content

Dynamic backends#705

Open
abudnik wants to merge 5 commits into
reverbrain:masterfrom
abudnik:dynamic_backends
Open

Dynamic backends#705
abudnik wants to merge 5 commits into
reverbrain:masterfrom
abudnik:dynamic_backends

Conversation

@abudnik

@abudnik abudnik commented May 29, 2016

Copy link
Copy Markdown
Member

Server parses config and starts backend, which was not presented in config initially, on DNET_BACKEND_ENABLE command. Thus, it is possible to add backends on the fly.

@shaitan

shaitan commented May 29, 2016

Copy link
Copy Markdown
Member
[13:06:15][Step 1/3] Set base directory: "/tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/result/dnet_backends_test"
[13:06:15][Step 1/3] Set cocaine run directory: "/tmp/elliptics-test-run-764d4862/"
[13:06:15][Step 1/3] Starting 5 servers
[13:06:15][Step 1/3] Starting server #1
[13:06:15][Step 1/3] Started server #1
[13:06:15][Step 1/3] *** glibc detected *** /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../example/dnet_ioserv: corrupted double-linked list: 0x000000000096e540 ***
[13:06:15][Step 1/3] ======= Backtrace: =========
[13:06:15][Step 1/3] /lib/x86_64-linux-gnu/libc.so.6(+0x7da26)[0x2ac4bc7d6a26]
[13:06:15][Step 1/3] /lib/x86_64-linux-gnu/libc.so.6(+0x7ed0b)[0x2ac4bc7d7d0b]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics.so.2.26(_ZNSt6vectorI25dnet_backend_config_entrySaIS0_EE13_M_insert_auxIIS0_EEEvN9__gnu_cxx17__normal_iteratorIPS0_S2_EEDpOT_+0x397)[0x2ac4bc2279d7]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics.so.2.26(_ZN17dnet_backend_info5parseEPN7ioremap9elliptics6config11config_dataERKNS2_6configE+0xca9)[0x2ac4bc21d129]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics.so.2.26(dnet_backend_init+0x497)[0x2ac4bc21df87]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics.so.2.26(dnet_cmd_backend_control+0x9a8)[0x2ac4bc21fd78]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics.so.2.26(dnet_process_cmd_raw+0x1185)[0x2ac4bc20fea5]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics_client.so.2.26(dnet_process_recv+0x7e0)[0x2ac4bbf27de0]
[13:06:15][Step 1/3] /tmp/buildd/elliptics-2.26.11.0/obj-x86_64-linux-gnu/tests/../library/libelliptics_client.so.2.26(dnet_io_process+0x5d1)[0x2ac4bbf522c1]
[13:06:15][Step 1/3] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x2ac4bc543e9a]
[13:06:15][Step 1/3] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x2ac4bc84c36d]

Comment thread tests/test_base.hpp
config_data &operator() (const std::string &name, const variant &value);
const variant *value_impl(const std::string &name) const;

bool m_serializable;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please, add description to m_serializable and its getter/setter.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@shaitan shaitan mentioned this pull request May 30, 2016
Comment thread library/backend.cpp
return std::shared_ptr<dnet_backend_info>();
}

void dnet_backend_info_manager::add_backend(std::shared_ptr<dnet_backend_info> &backend)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure this does not leak one reference?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep

@bioothod

bioothod commented Jun 1, 2016

Copy link
Copy Markdown
Member

Please elaborate, what does this huge patch do? Why is this needed, what was the problem, why have you decided to 'fix' it this way?

@abudnik

abudnik commented Jun 1, 2016

Copy link
Copy Markdown
Member Author

why have you decided to 'fix' it this way?

backends array of dnet_backend_io structs in dnet_io was changed to array of pointers. It allows quick reallocating of the array for adding new backends on the fly, but introduces locking mechanics for every access to backends array via rw-lock.

For the same reasons backends vector in dnet_config_data was changed to a hash table encapsulated in dnet_backend_info_manager class.

@bioothod

bioothod commented Jun 9, 2016

Copy link
Copy Markdown
Member

There is definitely no quick reallocation, since you copy the whole array again and again when adding new elements.

Let's start with more fundamental questions: What is the purpose of this patch? What is the problem it tries to solve? Is it present in the list of issues to solve first which was introduced like a year ago?

@shaitan

shaitan commented Jun 9, 2016

Copy link
Copy Markdown
Member

This patch is the development of #661.

The issue behind these changes is: allow users to add/remove backends in dynamic without restarting dnet_ioserv.

These patch introduces minimal changes to solve the issue. The next step is refactoring dnet_io::backends and dnet_config_data::backends, and merging them into one entity that will rule all backends' life. We broke solution into 2 steps because "next step" will change a lot that can be dangerous. It will be done in a separate PR but not now.

@abudnik

abudnik commented Jun 9, 2016

Copy link
Copy Markdown
Member Author

There is definitely no quick reallocation, since you copy the whole array again and again when adding new elements.

Reallocation of small array of pointers is a pretty fast operation.

Comment thread library/common.cpp
return 0;
}

struct dnet_backend_io *dnet_get_backend_io(struct dnet_io *io, size_t backend_id)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function doesn't increase reference counter or perform any other control flow operations (like remove object from array) else, why does it use locking?

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