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

MySQL jobs table always keep one key #157

Open
lkebin opened this issue Feb 26, 2018 · 4 comments
Open

MySQL jobs table always keep one key #157

lkebin opened this issue Feb 26, 2018 · 4 comments

Comments

@lkebin
Copy link

lkebin commented Feb 26, 2018

Today, I got error notification from system about GEARMAN_TIMEOUT.

When I check gearmand log, found the following message:

  ERROR 2018-02-26 09:02:10.000000 [  proc ] mysql_stmt_execute failed: Duplicate entry '91d919b4-1ad1-11e8-80c4-00163e0e0072-HotelPriceCalculator::updat' for key 'unique_key' -> libgearman-server/plugins/queue/mysql/queue.cc:357
  ERROR 2018-02-26 09:02:10.000000 [  proc ] gearman_server_job_add gearman_server_run_command(QUEUE_ERROR) -> libgearman-server/server.cc:301
WARNING 2018-02-26 09:02:10.000000 [  proc ] GEARMAN_QUEUE_ERROR:QUEUE_ERROR -> libgearman-server/server.cc:302

Then, I check the gearman_jobs table (I'm using MySQL as queue), The unique key 91d919b4-1ad1-11e8-80c4-00163e0e0072 always stay there.

I tried restart gearmand and workers, the key still there.

What happen ?

@p-alik
Copy link
Collaborator

p-alik commented Feb 26, 2018

Does the table contain an unique key for values of unique_key.
create table statement I tested doesn't contain such constrain.

Then, I check the gearman_jobs table (I'm using MySQL as queue), The unique key 91d919b4-1ad1-11e8-80c4-00163e0e0072 always stay there.

I tried restart gearmand and workers, the key still there.

Is there active worker waiting for the job? I guess no.

@lkebin
Copy link
Author

lkebin commented Feb 27, 2018

Yes, I restarted workers.

When I stop all workers, the gearman_jobs table will be include new jobs records, then start workers those jobs will be delete. but 91d919b4-1ad1-11e8-80c4-00163e0e0072 always be there.

@p-alik
Copy link
Collaborator

p-alik commented Feb 27, 2018

I can't explain what happened to this particular job. By putting jobs into the queue after restart gearmand takes all jobs. The jobs will be deleted if they are done. The only guess I've this particular job couldn't be successfully finished for some reason.

@lkebin
Copy link
Author

lkebin commented Feb 27, 2018

I tried stop workers, then watch the jobs list table. Same function_name and data ({"product_id": 837}), but the first row will be there after start workers.

+--------------------------------------+---------------------------------------+----------+---------------------+-------------+
| unique_key                           | function_name                         | priority | data                | when_to_run |
+--------------------------------------+---------------------------------------+----------+---------------------+-------------+
| 91d919b4-1ad1-11e8-80c4-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":837}  |           0 |
| de35ce7a-1b8e-11e8-a8b3-00163e08037b | ********************::updateDataCache |        1 | {"product_id":837}  |           0 |
| df926a76-1b8e-11e8-9be2-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":551}  |           0 |
| dff83cca-1b8e-11e8-9217-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":551}  |           0 |
| e1354858-1b8e-11e8-8a18-00163e08037b | ********************::updateDataCache |        1 | {"product_id":837}  |           0 |
| e2329602-1b8e-11e8-a1fd-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":38}   |           0 |
| e2f5cffa-1b8e-11e8-9b38-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":1745} |           0 |
| e3462298-1b8e-11e8-b11c-00163e0e0072 | ********************::updateDataCache |        1 | {"product_id":1378} |           0 |
+--------------------------------------+---------------------------------------+----------+---------------------+-------------+

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