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

UUID is not unique #4

Closed
upsala opened this issue Feb 13, 2017 · 3 comments
Closed

UUID is not unique #4

upsala opened this issue Feb 13, 2017 · 3 comments

Comments

@upsala
Copy link

upsala commented Feb 13, 2017

if I do a SELECT lib_mysqludf_amqp_sendstring(...) FROM table, the returned UUID is always the same.

@tcort
Copy link
Member

tcort commented Feb 14, 2017

Hmm, maybe this is an issue with the way arc4random() from libbsd is being used. From issue #1, I assume you're on Linux. Or maybe it's an issue with caching. Or maybe something else. I'll look into it.

@tcort
Copy link
Member

tcort commented Feb 14, 2017

I was able to reproduce it. The UUID in the messages is indeed the same, but each individual row is getting sent. I'm thinking I may have to move the UUID generation from the lib_mysqludf_amqp_send_init function to the main lib_mysqludf_amqp_send

create table bar ( message text );
insert into bar (message) values ('Hello, World');
insert into bar (message) values ('Hello, World');
insert into bar (message) values ('Goodbye');

SET @AMQP_HOST = 'localhost';
SET @AMQP_PORT = 5672;
SET @AMQP_USER = 'guest';
SET @AMQP_PASS = 'guest';
SET @AMQP_EXCHANGE = 'udf';

SELECT lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) FROM bar;
root@localhost [tcort]> SELECT lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) FROM bar;
+-------------------------------------------------------------------------------------------------------------------------------------+
| lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) |
+-------------------------------------------------------------------------------------------------------------------------------------+
| 54d65a1d-b02d-450f-96f6-072776e4581f                                                                                                |
| 54d65a1d-b02d-450f-96f6-072776e4581f                                                                                                |
| 54d65a1d-b02d-450f-96f6-072776e4581f                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.23 sec)

root@localhost [tcort]> SELECT lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) FROM bar;
+-------------------------------------------------------------------------------------------------------------------------------------+
| lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) |
+-------------------------------------------------------------------------------------------------------------------------------------+
| d30093b7-dd4f-45f3-bcbf-b86fe5282f9f                                                                                                |
| d30093b7-dd4f-45f3-bcbf-b86fe5282f9f                                                                                                |
| d30093b7-dd4f-45f3-bcbf-b86fe5282f9f                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.23 sec)

screen shot 2017-02-14 at 1 36 12 pm

@tcort
Copy link
Member

tcort commented Feb 14, 2017

I moved the message_id generation and it's working nicely now. The change also eliminates a memory allocation and removes a few lines of code. The change will be in the next release which will probably happen when the other open issues are addressed.

root@localhost [tcort]> SELECT lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) FROM bar;
+-------------------------------------------------------------------------------------------------------------------------------------+
| lib_mysqludf_amqp_sendjson(@AMQP_HOST, @AMQP_PORT, @AMQP_USER, @AMQP_PASS, @AMQP_EXCHANGE, 'test', json_object('message', message)) |
+-------------------------------------------------------------------------------------------------------------------------------------+
| 10f019ce-0be6-40ec-b944-cb6e87f9aec7                                                                                                |
| 6e98623a-62a0-4a72-9603-855212b1423d                                                                                                |
| 42d65fb4-d4a1-43c1-8df7-37eaa5dd8081                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------+

@tcort tcort closed this as completed Feb 14, 2017
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

No branches or pull requests

2 participants