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

Proposed by Brian Moon on 2010-03-16
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 2010-03-16 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
1=== modified file 'libgearman-server/queue_libsqlite3.c'
2--- libgearman-server/queue_libsqlite3.c 2009-12-30 23:57:45 +0000
3+++ libgearman-server/queue_libsqlite3.c 2010-03-16 15:59:13 +0000
4@@ -478,7 +478,7 @@
5 }
6
7 query_size= (size_t)snprintf(query, query_size,
8- "INSERT INTO %s (priority,unique_key,"
9+ "INSERT OR REPLACE INTO %s (priority,unique_key,"
10 "function_name,data) VALUES (?,?,?,?)",
11 queue->table);
12
13@@ -542,6 +542,10 @@
14 return GEARMAN_QUEUE_ERROR;
15 }
16
17+ GEARMAN_SERVER_CRAZY(server,
18+ "sqlite data: priority: %d, unique_key: %s, function_name: %s",
19+ priority, (char*)unique, (char*)function_name);
20+
21 sqlite3_finalize(sth);
22
23 if (_sqlite_commit(server, queue) != SQLITE_OK)

Subscribers

People subscribed via source and target branches

to all changes: