redis queue: fix loading old jobs from the database
redis queue: fix loading old jobs from the database

The old code wasn't able to restore the jobs stored into a redis
database because of different issues:

  * The code to find all the gearman-related keys into Redis was wrong,
    it didn't use globbing, causing zero keys to be found.
  * Each key is made by three parts: gearman identifier (never changes),
    name of the function and unique id. The old code wasn't able to
    associate the correct value to the function and the unique id becase
    the scan code was using a wrong pattern (the `-` was not ignored).
  * The code stored the keys as binary data instead of strings. That
    caused the keys to have null terminators as part of their name,
    hence making the retrieval of the job data fail (an empty data was
    always returned).
  * The code created the job representation in memory without making a
    duplicate of the data attribute. The char* holding the data was
    freed by the hiredis code and later, as soon as a worker tried to
    access it caused a segmentation fault on the server side.

With these changes everything is working as expected.

Signed-off-by: Flavio Castelli <d1035a58d87d0b7918844ad2fd699273faf2f5d5@suse.com>

dm/gearmand,dm/gearmand,dm/gearmand,dm/gearmand