-I${stagedir}/include -I${top_srcdir}/src -I. \
-I${expat_prefix}/include \
${COVERAGE_FLAGS} \
- -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \
-I${gridsite_prefix}/include \
-D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS}
archlib:=lib64
endif
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- mysqlib := -L${mysql_prefix}/${archlib}/mysql
- else
- mysqlib := -L${mysql_prefix}/${archlib}
- endif
-endif
-
ifneq (${expat_prefix},/usr)
expatlib := -L${expat_prefix}/lib
endif
VOMS_LIBS:=-L${voms_prefix}/lib -lvomsc${vomsflavour}
EXT_LIBS:= \
- ${mysqlib} -lmysqlclient -lz\
${expatlib} -lexpat \
${GRIDSITE_LIBS} \
${VOMS_LIBS}
${STATIC_LIB_BK} \
${SRVBONES_LIB} \
-lglite_lb_common_${nothrflavour} \
+ -lglite_lbu_db \
-lglite_security_gss_${nothrflavour} \
${EXT_LIBS}
glite-lb-proxy: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK}
- @echo DEBUG: mysql_version=${mysql_version} mysql_prefix=${mysql_prefix}
- @echo DEBUG: shell: x$(shell echo ${mysql_version} | cut -d. -f1,2)x
${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS}
glite-lb-proxy-perf: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK}
static char host[300];
static char * port;
int transactions = -1;
+int use_dbcaps = 0;
static struct option opts[] = {
struct clnt_data_t {
edg_wll_Context ctx;
- void *mysql;
+ glite_lbu_DBContext dbctx;
+ int dbcaps;
};
int silent = 0;
-
name = strrchr(argv[0],'/');
if (name) name++; else name = argv[0];
memset(ctx, 0, sizeof(*ctx));
*/
wait_for_open(ctx, dbstring);
- if (edg_wll_DBCheckVersion(ctx, dbstring)) {
+ if ((ctx->dbcaps = glite_lbu_DBQueryCaps(ctx->dbctx)) == -1)
+ {
char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
+ glite_lbu_DBError(ctx->dbctx,&et,&ed);
- fprintf(stderr,"%s: open database: %s (%s)\n",name,et,ed);
+ fprintf(stderr,"%s: open database: %s (%s)\n",argv[0],et,ed);
+ free(et); free(ed);
return 1;
}
- if (!ctx->use_transactions && transactions != 0) {
- fprintf(stderr, "%s: transactions aren't supported!\n", name);
+ edg_wll_Close(ctx);
+ ctx->dbctx = NULL;
+ fprintf(stderr, "[%d]: DB '%s'\n", getpid(), dbstring);
+
+ if ((ctx->dbcaps & GLITE_LBU_DB_CAP_INDEX) == 0) {
+ fprintf(stderr,"%s: missing index support in DB layer\n",argv[0]);
+ return 1;
}
+ if ((ctx->dbcaps & GLITE_LBU_DB_CAP_TRANSACTIONS) == 0)
+ fprintf(stderr, "[%d]: transactions aren't supported!\n", getpid());
if (transactions >= 0) {
- fprintf(stderr, "%s: transactions forced from %d to %d\n", name, ctx->use_transactions, transactions);
+ fprintf(stderr, "[%d]: transactions forced from %d to %d\n", getpid(), ctx->dbcaps & GLITE_LBU_DB_CAP_TRANSACTIONS ? 1 : 0, transactions);
+ ctx->dbcaps &= ~GLITE_LBU_DB_CAP_TRANSACTIONS;
+ ctx->dbcaps |= transactions ? GLITE_LBU_DB_CAP_TRANSACTIONS : 0;
}
- edg_wll_Close(ctx);
+ use_dbcaps = ctx->dbcaps;
edg_wll_FreeContext(ctx);
if ( !debug ) {
dprintf(("[%d] opening database ...\n", getpid()));
wait_for_open(ctx, dbstring);
- cdata->mysql = ctx->mysql;
+ cdata->dbctx = ctx->dbctx;
+ cdata->dbcaps = use_dbcaps;
edg_wll_FreeContext(ctx);
#ifdef LB_PERF
/* Shared structures (pointers)
*/
- ctx->mysql = cdata->mysql;
+ ctx->dbctx = cdata->dbctx;
+ ctx->dbcaps = cdata->dbcaps;
/* set globals
*/
char *errt,*errd;
if (dbfail_string1) free(dbfail_string1);
- edg_wll_Error(ctx,&errt,&errd);
+ glite_lbu_DBError(ctx->dbctx,&errt,&errd);
asprintf(&dbfail_string1,"%s (%s)\n",errt,errd);
if (dbfail_string1 != NULL) {
if (dbfail_string2 == NULL || strcmp(dbfail_string1,dbfail_string2)) {
dprintf(("[%d]: DB connection established\n",getpid()));
if (!debug) syslog(LOG_INFO,"DB connection established\n");
}
-
- if (transactions >= 0) ctx->use_transactions = transactions;
}
static int decrement_timeout(struct timeval *timeout, struct timeval before, struct timeval after)