Merge lp:~brianlmoon/gearmand/sqlite-replace into lp:gearmand/1.0

Proposed by Brian Moon
Status: Merged
Merged at revision: not available
Proposed branch: lp:~brianlmoon/gearmand/sqlite-replace
Merge into: lp:gearmand/1.0
Diff against target: 23 lines (+5/-1)
1 file modified
libgearman-server/queue_libsqlite3.c (+5/-1)
To merge this branch: bzr merge lp:~brianlmoon/gearmand/sqlite-replace
Reviewer Review Type Date Requested Status
Gearman-developers Pending
Review via email: mp+21453@code.launchpad.net

Description of the change

If the queue is ever out of sync with the daemon memory, inserts into the sqlite queue will prevent jobs from being queued. The memcached queue does not have this problem as it uses a set instead of an add. This will make the sqlite queue work in a similar fashion, replacing any queue item that has the same unique key.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libgearman-server/queue_libsqlite3.c'
--- libgearman-server/queue_libsqlite3.c 2009-12-30 23:57:45 +0000
+++ libgearman-server/queue_libsqlite3.c 2010-03-16 15:59:13 +0000
@@ -478,7 +478,7 @@
478 }478 }
479479
480 query_size= (size_t)snprintf(query, query_size,480 query_size= (size_t)snprintf(query, query_size,
481 "INSERT INTO %s (priority,unique_key,"481 "INSERT OR REPLACE INTO %s (priority,unique_key,"
482 "function_name,data) VALUES (?,?,?,?)",482 "function_name,data) VALUES (?,?,?,?)",
483 queue->table);483 queue->table);
484484
@@ -542,6 +542,10 @@
542 return GEARMAN_QUEUE_ERROR;542 return GEARMAN_QUEUE_ERROR;
543 }543 }
544544
545 GEARMAN_SERVER_CRAZY(server,
546 "sqlite data: priority: %d, unique_key: %s, function_name: %s",
547 priority, (char*)unique, (char*)function_name);
548
545 sqlite3_finalize(sth);549 sqlite3_finalize(sth);
546550
547 if (_sqlite_commit(server, queue) != SQLITE_OK)551 if (_sqlite_commit(server, queue) != SQLITE_OK)

Subscribers

People subscribed via source and target branches

to all changes: