Update man page.
</group></arg>
<arg><group choice='plain'>
+ <arg>-k</arg>
+ <arg>--key</arg>
+ </group></arg>
+
+ <arg><group choice='plain'>
+ <arg>-c</arg>
+ <arg>--cert</arg>
+ </group></arg>
+
+<!-- <arg><group choice='plain'>
+ <arg>-C</arg>
+ <arg>CAdir</arg>
+ </group></arg>
+
+ <arg><group choice='plain'>
+ <arg>-V</arg>
+ <arg>VOMSdir</arg>
+ </group></arg>-->
+
+ <arg><group choice='plain'>
<arg>-n</arg>
<arg>--no-auth</arg>
</group></arg>
<arg>--config</arg>
</group> <replaceable>CONFIG.XML</replaceable></arg>
+ <arg><group choice='plain'>
+ <arg>-s</arg>
+ <arg>--slaves</arg>
+ </group> <replaceable>N</replaceable> </arg>
+
+ <arg><group choice='plain'>
+ <arg>-D</arg>
+ <arg>--delete-db</arg>
+ </group></arg>
+
</cmdsynopsis>
</refsynopsisdiv>
</varlistentry>
<varlistentry>
+ <term><option>-k</option>|<option>--key</option></term>
+ <listitem><para>
+Private key file.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-c</option>|<option>--cert</option></term>
+ <listitem><para>
+Certification file.
+ </para></listitem>
+ </varlistentry>
+
+<!-- <varlistentry>
+ <term><option>-C</option>|<option>CAdir</option></term>
+ <listitem><para>
+Trusted certificates directory.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-V</option>|<option>VOMSdir</option></term>
+ <listitem><para>
+Trusted VOMS servers certificates directory.
+ </para></listitem>
+ </varlistentry>-->
+
+ <varlistentry>
<term><option>-n</option>|<option>--no-auth</option></term>
<listitem><para>
Don't check user identity with result owner.
<varlistentry>
<term><option>-x</option>|<option>--config</option></term>
<listitem><para>
-Configuration file containing information about feeds, primary storages, ... Structure is defined in <filename>server_conf.xsd</filename>.
+Configuration file containing information about feeds, primary storages, ... Structure is defined in <filename>server_conf.xsd</filename> (default: <filename>$GLITE_LOCATION/etc/glite-jpis-config.xml</filename>).
</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>-s</option>|<option>--slaves</option></term>
+ <listitem><para>
+Number of slave processes for responses (default: number of feeds, max. 20).
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-D</option>|<option>--delete-db</option></term>
+ <listitem><para>
+Delete and refetch the data in the database. You need use this parameter when feeds from primary storage are already expired.
+ </para></listitem>
+ </varlistentry>
+
</variablelist>
- <para>
-Other parameters will be configurable in close future. Its current hard-coded values are in <filename>org.glite.jp.index/src/conf.[ch]</filename>.
- </para>
</refsect1>
<refsect1>
</varlistentry>
<varlistentry>
- <term><command>glite-jp-indexd -s JPPS:8901 -i $HOME/jpis.log -o $HOME/jpis.pid</command></term>
+ <term><command>glite-jp-indexd -x /opt/glite/etc/glite-jpis-config-custom.xml -i $HOME/jpis.log -o $HOME/jpis.pid</command></term>
<listitem><para>
-Manual run of the JP index server. Use local MySQL database, communicates with Job Provenance on JPPS:8901, listen on default port, store logs and pid to given files.
+Manual run of the JP index server. Use local MySQL database, feeds from job provenances and attributes configured in <filename>/opt/glite/etc/glite-jpis-config-custom.xml</filename>, listen on default port, store logs and pid to given files.
</para></listitem>
</varlistentry>
</variablelist>
*/
- if (glite_jpis_dropDatabase(isctx) != 0) {
- fprintf(stderr, "Drop DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source);
- glite_jpis_free_db(isctx);
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
- glite_jp_free_conf(conf);
- return 1;
+ if (conf->delete_db) {
+ if (glite_jpis_dropDatabase(isctx) != 0) {
+ fprintf(stderr, "Drop DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source);
+ glite_jpis_free_db(isctx);
+ glite_jpis_free_context(isctx);
+ glite_jp_free_context(ctx);
+ glite_jp_free_conf(conf);
+ return 1;
+ }
}
if (glite_jpis_initDatabase(isctx) != 0) {
extern SOAP_NMAC struct Namespace jp__namespaces[];
-static const char *get_opt_string = "dq:c:k:C:V:nm:p:i:o:x:s:";
+static const char *get_opt_string = "dq:c:k:C:V:nm:p:i:o:x:s:D";
static struct option opts[] = {
{"debug", 0, NULL, 'd'},
{"logfile", 1, NULL, 'o'},
{"config", 1, NULL, 'x'},
{"slaves", 1, NULL, 's'},
+ {"delete-db", 0, NULL, 'D'},
{NULL, 0, NULL, 0}
};
"\t-o, --logfile\t file to store logs\n"
"\t-x, --config\t file with server configuration\n"
"\t-s, --slaves\t number of slaves for responses\n"
+ "\t-D, --delete-db\t delete and restore data in the database"
"\n"
,me);
}
case 'o': conf->logfile = optarg; break;
case 'x': conf_file = optarg; break;
case 's': conf->slaves = atoi(optarg); if (conf->slaves > 0) break;
+ case 'D': conf->delete_db = 1; break;
default : usage(argv[0]); exit(0); break;
}
*server_cert,
*server_key;
int slaves;
+ int delete_db;
} glite_jp_is_conf;
*/
int glite_jpis_initDatabase(glite_jpis_context_t ctx) {
- char **attrs, *attrid;
+ char **attrs, *attrid, *num;
const char *type_index, *type_full;
size_t i;
- int indexed, state, locked;
+ int indexed, state, locked, nattrs;
size_t conds_len;
char sql[512];
glite_jp_is_feed **feeds;
glite_lbu_Statement stmt = NULL;
jpctx = ctx->jpctx;
+
+ // check, if database was already created
+ if (glite_jp_db_ExecSQL(jpctx, "SELECT COUNT(*) FROM attrs", &stmt) < 0) {
+ glite_jpis_stack_error(ctx->jpctx, EIO, "error during counting attrs");
+ goto fail;
+ }
+ if (glite_jp_db_FetchRow(jpctx, stmt, 1, NULL, &num) < 0) {
+ glite_jpis_stack_error(ctx->jpctx, EIO, "error during fetching attrs");
+ goto fail;
+ }
+ nattrs = atoi(num);
+ llprintf(LOG_SQL, "found '%s' attributes in attrs table\n", num, nattrs);
+ free(num);
+ glite_jp_db_FreeStmt(&stmt);
+ if (nattrs != 0) {
+ lprintf("database with %d attributes keeped (use -D for delete)\n");
+ return 0;
+ }
+
if (glite_jp_db_PrepareStmt(jpctx, "INSERT INTO attrs (attrid, name, indexed, type) VALUES (?, ?, ?, ?)", &stmt) != 0) goto fail;
// attrs table and attrid_* tables
free(conds);
fail:
glite_jp_db_FreeStmt(&stmt);
+ if (!jpctx->error) glite_jpis_stack_error(ctx->jpctx, EIO, "error during initial filling of the database");
return jpctx->error->code;
}