-
Notifications
You must be signed in to change notification settings - Fork 402
/
zdb.c
683 lines (610 loc) · 19.9 KB
/
zdb.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
/*
* zimg - high performance image storage and processing system.
* http://zimg.buaa.us
*
* Copyright (c) 2013-2014, Peter Zhao <zp@buaa.us>.
* All rights reserved.
*
* Use and distribution licensed under the BSD license.
* See the LICENSE file for full text.
*
*/
/**
* @file zdb.c
* @brief Get and save image for ssdb/redis and beansdb/memcachedb backend functions.
* @author 招牌疯子 zp@buaa.us
* @version 2.0.0
* @date 2014-04-21
*/
#include <string.h>
#include <wand/MagickWand.h>
#include <hiredis/hiredis.h>
#include "zdb.h"
#include "zlog.h"
#include "zcache.h"
#include "zutil.h"
extern struct setting settings;
int get_img_mode_db(zimg_req_t *req, char **buff_ptr, size_t *img_size);
int get_img_db(thr_arg_t *thr_arg, const char *cache_key, char **buff, size_t *len);
int save_img_db(thr_arg_t *thr_arg, const char *cache_key, const char *buff, const size_t len);
int get_img_ssdb(redisContext* c, const char *cache_key, char **buff, size_t *len);
int save_img_ssdb(redisContext* c, const char *cache_key, const char *buff, const size_t len);
int get_img_beansdb(memcached_st *memc, const char *key, char **value_ptr, size_t *len);
int save_img_beansdb(memcached_st *memc, const char *key, const char *value, const size_t len);
int exist_beansdb(memcached_st *memc, const char *key);
int find_beansdb(memcached_st *memc, const char *key, char *value);
int set_beansdb(memcached_st *memc, const char *key, const char *value);
int del_beansdb(memcached_st *memc, const char *key);
/**
* @brief get_img_mode_db Get image from db mode backend.
*
* @param req zimg request struct
* @param buff_ptr buff pointer
* @param img_size buff size
*
* @return 1 for success and -1 for failed
*/
int get_img_mode_db(zimg_req_t *req, char **buff_ptr, size_t *img_size)
{
int result = -1;
char *cache_key = (char *)malloc(strlen(req->md5) + 32);
char *img_format = NULL;
size_t len;
MagickBooleanType status;
MagickWand *magick_wand = NULL;
bool got_color = false;
LOG_PRINT(LOG_DEBUG, "get_img() start processing zimg request...");
//LOG_PRINT(LOG_DEBUG, "req->thr_arg->cache_conn: %p", req->thr_arg->cache_conn);
//sprintf(cache_key, "img:%s:%d:%d:%d:%d", req->md5, req->width, req->height, req->proportion, req->gray);
if(req->gray == 1)
{
gen_key(cache_key, req->md5, 4, req->width, req->height, req->proportion, req->gray);
}
else
{
gen_key(cache_key, req->md5, 3, req->width, req->height, req->proportion);
}
//if(find_cache_bin(cache_key, buff_ptr, img_size) == 1)
if(find_cache_bin(req->thr_arg, cache_key, buff_ptr, img_size) == 1)
{
LOG_PRINT(LOG_DEBUG, "Hit Cache[Key: %s].", cache_key);
result = 1;
goto done;
}
LOG_PRINT(LOG_DEBUG, "Start to Find the Image...");
if(get_img_db(req->thr_arg, cache_key, buff_ptr, img_size) == 1)
{
LOG_PRINT(LOG_DEBUG, "Get image [%s] from backend db succ.", cache_key);
if(*img_size < CACHE_MAX_SIZE)
{
set_cache_bin(req->thr_arg, cache_key, *buff_ptr, *img_size);
}
result = 1;
goto done;
}
magick_wand = NewMagickWand();
if(req->gray == 1)
{
//sprintf(cache_key, "img:%s:%d:%d:%d:0", req->md5, req->width, req->height, req->proportion);
gen_key(cache_key, req->md5, 3, req->width, req->height, req->proportion);
//if(find_cache_bin(cache_key, buff_ptr, img_size) == 1)
if(find_cache_bin(req->thr_arg, cache_key, buff_ptr, img_size) == 1)
{
LOG_PRINT(LOG_DEBUG, "Hit Color Image Cache[Key: %s, len: %d].", cache_key, *img_size);
status = MagickReadImageBlob(magick_wand, *buff_ptr, *img_size);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Color Image Cache[Key: %s] is Bad. Remove.", cache_key);
del_cache(req->thr_arg, cache_key);
}
else
{
got_color = true;
LOG_PRINT(LOG_DEBUG, "Read Image from Color Image Cache[Key: %s, len: %d] Succ. Goto Convert.", cache_key, *img_size);
goto convert;
}
}
if(get_img_db(req->thr_arg, cache_key, buff_ptr, img_size) == 1)
{
LOG_PRINT(LOG_DEBUG, "Get color image [%s] from backend db.", cache_key);
status = MagickReadImageBlob(magick_wand, *buff_ptr, *img_size);
if(status == MagickTrue)
{
got_color = true;
LOG_PRINT(LOG_DEBUG, "Read Image from Color Image[%s] Succ. Goto Convert.", cache_key);
*buff_ptr = (char *)MagickGetImageBlob(magick_wand, img_size);
if(*img_size < CACHE_MAX_SIZE)
{
set_cache_bin(req->thr_arg, cache_key, *buff_ptr, *img_size);
}
goto convert;
}
}
}
//sprintf(cache_key, "img:%s:0:0:1:0", req->md5);
gen_key(cache_key, req->md5, 0);
//if(find_cache_bin(cache_key, buff_ptr, img_size) == 1)
if(find_cache_bin(req->thr_arg, cache_key, buff_ptr, img_size) == 1)
{
LOG_PRINT(LOG_DEBUG, "Hit Cache[Key: %s].", cache_key);
}
else
{
if(get_img_db(req->thr_arg, cache_key, buff_ptr, img_size) == -1)
{
LOG_PRINT(LOG_DEBUG, "Get image [%s] from backend db failed.", cache_key);
goto done;
}
else if(*img_size < CACHE_MAX_SIZE)
{
set_cache_bin(req->thr_arg, cache_key, *buff_ptr, *img_size);
}
}
status = MagickReadImageBlob(magick_wand, *buff_ptr, *img_size);
if(status == MagickFalse)
{
ThrowWandException(magick_wand);
del_cache(req->thr_arg, cache_key);
LOG_PRINT(LOG_DEBUG, "Read image [%s] from blob failed.", cache_key);
goto done;
}
if(!(req->width == 0 && req->height == 0))
{
int width, height;
width = req->width;
height = req->height;
float owidth = MagickGetImageWidth(magick_wand);
float oheight = MagickGetImageHeight(magick_wand);
if(width <= owidth && height <= oheight)
{
if(req->proportion == 1)
{
if(req->width != 0 && req->height == 0)
{
height = width * oheight / owidth;
}
else
{
width = height * owidth / oheight;
}
}
status = MagickResizeImage(magick_wand, width, height, LanczosFilter, 1.0);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Image[%s] Resize Failed!", cache_key);
goto done;
}
LOG_PRINT(LOG_DEBUG, "Resize img succ.");
}
else
{
LOG_PRINT(LOG_DEBUG, "Args width/height is bigger than real size, return original image.");
//result = 1;
//goto done;
}
}
convert:
//compress image
if(got_color == false)
{
LOG_PRINT(LOG_DEBUG, "Start to Compress the Image!");
img_format = MagickGetImageFormat(magick_wand);
LOG_PRINT(LOG_DEBUG, "Image Format is %s", img_format);
if(strcmp(img_format, "JPEG") != 0)
{
LOG_PRINT(LOG_DEBUG, "Convert Image Format from %s to JPEG.", img_format);
status = MagickSetImageFormat(magick_wand, "JPEG");
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Image[%s] Convert Format Failed!", cache_key);
}
LOG_PRINT(LOG_DEBUG, "Compress Image with JPEGCompression");
status = MagickSetImageCompression(magick_wand, JPEGCompression);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Image[%s] Compression Failed!", cache_key);
}
}
size_t quality = MagickGetImageCompressionQuality(magick_wand) * 0.75;
LOG_PRINT(LOG_DEBUG, "Image Compression Quality is %u.", quality);
if(quality == 0)
{
quality = 75;
}
LOG_PRINT(LOG_DEBUG, "Set Compression Quality to 75%.");
status = MagickSetImageCompressionQuality(magick_wand, quality);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Set Compression Quality Failed!");
}
//strip image EXIF infomation
LOG_PRINT(LOG_DEBUG, "Start to Remove Exif Infomation of the Image...");
status = MagickStripImage(magick_wand);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Remove Exif Infomation of the ImageFailed!");
}
*buff_ptr = (char *)MagickGetImageBlob(magick_wand, img_size);
if(*buff_ptr == NULL)
{
LOG_PRINT(LOG_DEBUG, "Magick Get Image Blob Failed!");
goto done;
}
gen_key(cache_key, req->md5, 3, req->width, req->height, req->proportion);
save_img_db(req->thr_arg, cache_key, *buff_ptr, *img_size);
if(*img_size < CACHE_MAX_SIZE)
{
set_cache_bin(req->thr_arg, cache_key, *buff_ptr, *img_size);
}
}
//gray image
if(req->gray == 1)
{
LOG_PRINT(LOG_DEBUG, "Start to Remove Color!");
status = MagickSetImageColorspace(magick_wand, GRAYColorspace);
if(status == MagickFalse)
{
LOG_PRINT(LOG_DEBUG, "Image[%s] Remove Color Failed!", cache_key);
goto done;
}
LOG_PRINT(LOG_DEBUG, "Image Remove Color Finish!");
*buff_ptr = (char *)MagickGetImageBlob(magick_wand, img_size);
if(*buff_ptr == NULL)
{
LOG_PRINT(LOG_DEBUG, "Magick Get Image Blob Failed!");
goto done;
}
//sprintf(cache_key, "img:%s:%d:%d:%d:%d", req->md5, req->width, req->height, req->proportion, req->gray);
gen_key(cache_key, req->md5, 4, req->width, req->height, req->proportion, req->gray);
save_img_db(req->thr_arg, cache_key, *buff_ptr, *img_size);
if(*img_size < CACHE_MAX_SIZE)
{
set_cache_bin(req->thr_arg, cache_key, *buff_ptr, *img_size);
}
}
if(got_color == false)
{
LOG_PRINT(LOG_INFO, "succ compress pic:%s", cache_key);
}
result = 1;
done:
if(magick_wand)
{
magick_wand=DestroyMagickWand(magick_wand);
}
if(img_format)
free(img_format);
if(cache_key)
free(cache_key);
return result;
}
/**
* @brief get_img_db Choose db to get image by setting.
*
* @param thr_arg Thread arg struct.
* @param cache_key The key.
* @param buff Image buffer.
* @param len Image size.
*
* @return 1 for succ or -1 for failed.
*/
int get_img_db(thr_arg_t *thr_arg, const char *cache_key, char **buff, size_t *len)
{
int ret = -1;
if(settings.mode == 2 && thr_arg->beansdb_conn != NULL)
ret = get_img_beansdb(thr_arg->beansdb_conn, cache_key, buff, len);
else if(settings.mode == 3 && thr_arg->ssdb_conn != NULL)
ret = get_img_ssdb(thr_arg->ssdb_conn, cache_key, buff, len);
if(ret == -1 && settings.mode == 3)
{
if(thr_arg->ssdb_conn != NULL)
redisFree(thr_arg->ssdb_conn);
redisContext* c = redisConnect(settings.ssdb_ip, settings.ssdb_port);
if(c->err)
{
redisFree(c);
LOG_PRINT(LOG_DEBUG, "Connect to ssdb server faile");
return ret;
}
else
{
thr_arg->ssdb_conn = c;
LOG_PRINT(LOG_DEBUG, "SSDB Server Reconnected.");
ret = get_img_ssdb(thr_arg->ssdb_conn, cache_key, buff, len);
//evthr_set_aux(thr_arg->thread, thr_arg);
}
}
return ret;
}
/**
* @brief save_img_db Choose db mode to save images.
*
* @param thr_arg Thread arg struct.
* @param cache_key The key of image.
* @param buff Image buffer.
* @param len Image size.
*
* @return 1 for succ or -1 for fialed.
*/
int save_img_db(thr_arg_t *thr_arg, const char *cache_key, const char *buff, const size_t len)
{
int ret = -1;
if(settings.mode == 2)
ret = save_img_beansdb(thr_arg->beansdb_conn, cache_key, buff, len);
else if(settings.mode == 3)
ret = save_img_ssdb(thr_arg->ssdb_conn, cache_key, buff, len);
if(ret == -1 && settings.mode == 3)
{
if(thr_arg->ssdb_conn != NULL)
redisFree(thr_arg->ssdb_conn);
redisContext* c = redisConnect(settings.ssdb_ip, settings.ssdb_port);
if(c->err)
{
redisFree(c);
LOG_PRINT(LOG_DEBUG, "Connect to ssdb server faile");
return ret;
}
else
{
thr_arg->ssdb_conn = c;
LOG_PRINT(LOG_DEBUG, "SSDB Server Reconnected.");
ret = save_img_ssdb(thr_arg->ssdb_conn, cache_key, buff, len);
//evthr_set_aux(thr_arg->thread, thr_arg);
}
}
return ret;
}
/**
* @brief save_img_ssdb Save image to ssdb backends.
*
* @param c Conntion to ssdb.
* @param cache_key image key
* @param buff image buff
* @param len image buff length
*
* @return 1 for success and -1 for fail
*/
int save_img_ssdb(redisContext* c, const char *cache_key, const char *buff, const size_t len)
{
if(c == NULL)
return -1;
redisReply *r = (redisReply*)redisCommand(c, "SET %s %b", cache_key, buff, len);
if( NULL == r)
{
LOG_PRINT(LOG_DEBUG, "Execut ssdb command failure");
return -1;
}
if( !(r->type == REDIS_REPLY_STATUS && strcasecmp(r->str,"OK")==0))
{
LOG_PRINT(LOG_DEBUG, "Failed to execute save [%s] to ssdb.", cache_key);
freeReplyObject(r);
return -1;
}
freeReplyObject(r);
LOG_PRINT(LOG_DEBUG, "Succeed to save [%s] to ssdb. length = [%d].", cache_key, len);
return 1;
}
/**
* @brief get_img_ssdb Get image from ssdb backend by key
*
* @param c Conntion to ssdb.
* @param cache_key image key
* @param buff buffer to storage image
* @param len image size
*
* @return 1 for success and -1 for fail
*/
int get_img_ssdb(redisContext* c, const char *cache_key, char **buff, size_t *len)
{
if(c == NULL)
return -1;
redisReply *r = (redisReply*)redisCommand(c, "GET %s", cache_key);
if( NULL == r)
{
LOG_PRINT(LOG_DEBUG, "Execut ssdb command failure");
return -1;
}
if( r->type != REDIS_REPLY_STRING )
{
LOG_PRINT(LOG_DEBUG, "Failed to execute get [%s] from ssdb.", cache_key);
freeReplyObject(r);
return -1;
}
*len = r->len;
*buff = (char *)malloc(r->len);
memcpy(*buff, r->str, r->len);
freeReplyObject(r);
LOG_PRINT(LOG_DEBUG, "Succeed to get [%s] from ssdb. length = [%d].", cache_key, *len);
return 1;
}
/**
* @brief get_img_beansdb Find a key's BINARY value from beansdb backend.
*
* @param memc The connection to beansdb.
* @param key The key you want to find.
* @param value_ptr It will be alloc and contains the binary value.
* @param len It will change to the length of the value.
*
* @return 1 for success and -1 for fail.
*/
int get_img_beansdb(memcached_st *memc, const char *key, char **value_ptr, size_t *len)
{
int rst = -1;
if(memc == NULL)
return rst;
uint32_t flags;
memcached_return rc;
*value_ptr = memcached_get(memc, key, strlen(key), len, &flags, &rc);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Binary Beansdb Find Key[%s], Len: %d.", key, *len);
rst = 1;
}
else if (rc == MEMCACHED_NOTFOUND)
{
LOG_PRINT(LOG_DEBUG, "Binary Beansdb Key[%s] Not Find!", key);
rst = -1;
}
else
{
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
}
return rst;
}
/**
* @brief save_img_beansdb Set a new BINARY value of a key in beansdb.
*
* @param memc The connection to beansdb.
* @param key The key.
* @param value A char * buffer you want to set.
* @param len The length of the buffer above,
*
* @return 1 for success and -1 for fial.
*/
int save_img_beansdb(memcached_st *memc, const char *key, const char *value, const size_t len)
{
int rst = -1;
if(memc == NULL)
return rst;
memcached_return rc;
rc = memcached_set(memc, key, strlen(key), value, len, 0, 0);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Binary Beansdb Set Successfully. Key[%s] Len: %d.", key, len);
rst = 1;
}
else
{
LOG_PRINT(LOG_DEBUG, "Binary beansdb Set Key: [%s] Failed!", key);
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
rst = -1;
}
return rst;
}
/**
* @brief exist_beansdb If a key is existed in beansdb.
*
* @param memc The connection to beansdb.
* @param key Key
*
* @return 1 for success and -1 for fail
*/
int exist_beansdb(memcached_st *memc, const char *key)
{
int rst = -1;
if(memc == NULL)
return rst;
size_t valueLen;
uint32_t flags;
memcached_return rc;
memcached_get(memc, key, strlen(key), &valueLen, &flags, &rc);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Beansdb Key[%s] Exist.", key);
rst = 1;
}
else
{
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
}
return rst;
}
/**
* @brief find_beansdb Connect to a beansdb server and find a key's value.
*
* @param memc The connection to beansdb.
* @param key The string of the key you want to find.
* @param value It contains the string of the key's value.
*
* @return 1 for success and -1 for fail.
*/
int find_beansdb(memcached_st *memc, const char *key, char *value)
{
int rst = -1;
if(memc == NULL)
return rst;
size_t valueLen;
uint32_t flags;
memcached_return rc;
char *pvalue = memcached_get(memc, key, strlen(key), &valueLen, &flags, &rc);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Beansdb Find Key[%s] Value: %s", key, pvalue);
strcpy(value, pvalue);
free(pvalue);
rst = 1;
}
else if (rc == MEMCACHED_NOTFOUND)
{
LOG_PRINT(LOG_DEBUG, "Beansdb Key[%s] Not Find!", key);
rst = -1;
}
else
{
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
}
return rst;
}
/**
* @brief set_beansdb Set a key with the value input.
*
* @param memc The connection to beansdb.
* @param key The key you want to set a new value.
* @param value The value of the key.
*
* @return 1 for success and -1 for fail.
*/
int set_beansdb(memcached_st *memc, const char *key, const char *value)
{
int rst = -1;
if(memc == NULL)
return rst;
memcached_return rc;
rc = memcached_set(memc, key, strlen(key), value, strlen(value), 0, 0);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Beansdb Set Successfully. Key[%s] Value: %s", key, value);
rst = 1;
}
else
{
LOG_PRINT(LOG_DEBUG, "Beansdb Set(Key: %s Value: %s) Failed!", key, value);
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
rst = -1;
}
return rst;
}
/**
* @brief del_beansdb This function delete a key and its value in beansdb.
*
* @param memc The connection to beansdb.
* @param key The key.
*
* @return 1 for success and -1 for fail.
*/
int del_beansdb(memcached_st *memc, const char *key)
{
int rst = -1;
if(memc == NULL)
return rst;
memcached_return rc;
rc = memcached_delete(memc, key, strlen(key), 0);
if (rc == MEMCACHED_SUCCESS)
{
LOG_PRINT(LOG_DEBUG, "Beansdb Key[%s] Delete Successfully.", key);
rst = 1;
}
else
{
LOG_PRINT(LOG_DEBUG, "Beansdb Key[%s] Delete Failed!", key);
const char *str_rc = memcached_strerror(memc, rc);
LOG_PRINT(LOG_DEBUG, "Beansdb Result: %s", str_rc);
rst = -1;
}
return rst;
}