yaz_log(log_level, "zebra_flush_reg");
zebraExplain_flush (zh->reg->zei, zh);
extract_flushWriteKeys (zh, 1 /* final */);
zebra_index_merge (zh );
yaz_log(log_level, "zebra_flush_reg");
zebraExplain_flush (zh->reg->zei, zh);
extract_flushWriteKeys (zh, 1 /* final */);
zebra_index_merge (zh );
zh->path_root = res_get (zh->global_res, "root");
zh->nmem = nmem_create();
zh->record_classes = recTypeClass_create (zh->global_res, zh->nmem);
zh->path_root = res_get (zh->global_res, "root");
zh->nmem = nmem_create();
zh->record_classes = recTypeClass_create (zh->global_res, zh->nmem);
yaz_log (YLOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s",
rw, useshadow, reg, name, reg_path ? reg_path : "(none)");
yaz_log (YLOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s",
rw, useshadow, reg, name, reg_path ? reg_path : "(none)");
data1_set_tabroot (reg->dh, reg_path);
reg->recTypes = recTypes_init (zs->record_classes, reg->dh);
data1_set_tabroot (reg->dh, reg_path);
reg->recTypes = recTypes_init (zs->record_classes, reg->dh);
zebraRankInstall (reg, rank_1_class);
zebraRankInstall (reg, rank_zv_class);
zebraRankInstall (reg, rank_1_class);
zebraRankInstall (reg, rank_zv_class);
zebraRankInstall (reg, rank_static_class);
recordCompression = res_get_def (res, "recordCompression", "none");
zebraRankInstall (reg, rank_static_class);
recordCompression = res_get_def (res, "recordCompression", "none");
if (!strcmp (recordCompression, "bzip2"))
record_compression = REC_COMPRESS_BZIP2;
if (!strcmp (recordCompression, "bzip2"))
record_compression = REC_COMPRESS_BZIP2;
+ if (1)
+ {
+ const char *index_fname = res_get_def(res, "index", "default.idx");
+ if (index_fname && *index_fname)
+ {
+ if (zebra_maps_read_file(reg->zebra_maps, index_fname) != ZEBRA_OK)
+ ret = ZEBRA_FAIL;
+ }
+ }
+
if (!(reg->records = rec_open (reg->bfs, rw, record_compression)))
{
yaz_log (YLOG_WARN, "rec_open failed");
if (!(reg->records = rec_open (reg->bfs, rw, record_compression)))
{
yaz_log (YLOG_WARN, "rec_open failed");
if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res)))
{
yaz_log (YLOG_WARN, "dict_open failed");
if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res)))
{
yaz_log (YLOG_WARN, "dict_open failed");
}
if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw)))
{
yaz_log (YLOG_WARN, "sortIdx_open failed");
}
if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw)))
{
yaz_log (YLOG_WARN, "sortIdx_open failed");
}
if (res_get_match (res, "isam", "s", ISAM_DEFAULT))
{
}
if (res_get_match (res, "isam", "s", ISAM_DEFAULT))
{
key_isams_m(res, &isams_m))))
{
yaz_log (YLOG_WARN, "isams_open failed");
key_isams_m(res, &isams_m))))
{
yaz_log (YLOG_WARN, "isams_open failed");
}
}
if (res_get_match (res, "isam", "c", ISAM_DEFAULT))
}
}
if (res_get_match (res, "isam", "c", ISAM_DEFAULT))
rw, key_isamc_m(res, &isamc_m))))
{
yaz_log (YLOG_WARN, "isamc_open failed");
rw, key_isamc_m(res, &isamc_m))))
{
yaz_log (YLOG_WARN, "isamc_open failed");
}
}
if (res_get_match (res, "isam", "b", ISAM_DEFAULT))
}
}
if (res_get_match (res, "isam", "b", ISAM_DEFAULT))
rw, key_isamc_m(res, &isamc_m), 0)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
rw, key_isamc_m(res, &isamc_m), 0)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
}
}
if (res_get_match (res, "isam", "bc", ISAM_DEFAULT))
}
}
if (res_get_match (res, "isam", "bc", ISAM_DEFAULT))
rw, key_isamc_m(res, &isamc_m), 1)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
rw, key_isamc_m(res, &isamc_m), 1)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
}
}
if (res_get_match (res, "isam", "null", ISAM_DEFAULT))
}
}
if (res_get_match (res, "isam", "null", ISAM_DEFAULT))
rw, key_isamc_m(res, &isamc_m), -1)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
rw, key_isamc_m(res, &isamc_m), -1)))
{
yaz_log (YLOG_WARN, "isamb_open failed");
- yaz_log (YLOG_WARN, "Cannot obtain EXPLAIN information");
+ reg->zei = zebraExplain_open(reg->records, reg->dh,
+ res, rw, reg,
+ explain_extract);
+ if (!reg->zei)
+ {
+ yaz_log (YLOG_WARN, "Cannot obtain EXPLAIN information");
+ ret = ZEBRA_FAIL;
+ }
+ }
+
+ if (ret != ZEBRA_OK)
+ {
+ zebra_register_close(zs, reg);
yaz_log (YLOG_DEBUG, "zebra_register_open ok p=%p", reg);
return reg;
}
ZEBRA_RES zebra_admin_shutdown (ZebraHandle zh)
{
yaz_log (YLOG_DEBUG, "zebra_register_open ok p=%p", reg);
return reg;
}
ZEBRA_RES zebra_admin_shutdown (ZebraHandle zh)
{
yaz_log(log_level, "zebra_admin_shutdown");
zebra_mutex_cond_lock (&zh->service->session_lock);
yaz_log(log_level, "zebra_admin_shutdown");
zebra_mutex_cond_lock (&zh->service->session_lock);
yaz_log(log_level, "zebra_admin_start");
zs = zh->service;
zebra_mutex_cond_lock (&zs->session_lock);
yaz_log(log_level, "zebra_admin_start");
zs = zh->service;
zebra_mutex_cond_lock (&zs->session_lock);
- if (reg->records)
- {
- zebraExplain_close (reg->zei);
- dict_close (reg->dict);
- if (reg->matchDict)
- dict_close (reg->matchDict);
- sortIdx_close (reg->sortIdx);
- if (reg->isams)
- isams_close (reg->isams);
- if (reg->isamc)
- isamc_close (reg->isamc);
- if (reg->isamb)
- isamb_close (reg->isamb);
- rec_close (®->records);
- }
+
+ zebraExplain_close (reg->zei);
+ dict_close (reg->dict);
+ if (reg->matchDict)
+ dict_close (reg->matchDict);
+ sortIdx_close (reg->sortIdx);
+ if (reg->isams)
+ isams_close (reg->isams);
+ if (reg->isamc)
+ isamc_close (reg->isamc);
+ if (reg->isamb)
+ isamb_close (reg->isamb);
+ rec_close (®->records);
resultSetDestroy (zh, -1, 0, 0);
if (zh->reg)
resultSetDestroy (zh, -1, 0, 0);
if (zh->reg)
{
if (res_get_int(zh->res, "staticrank", &zh->m_staticrank) == ZEBRA_OK)
yaz_log(YLOG_LOG, "static rank set and is %d", zh->m_staticrank);
{
if (res_get_int(zh->res, "staticrank", &zh->m_staticrank) == ZEBRA_OK)
yaz_log(YLOG_LOG, "static rank set and is %d", zh->m_staticrank);
yaz_log(log_level, "zebra_select_database %s",basename);
assert(basename);
return zebra_select_databases (zh, 1, &basename);
yaz_log(log_level, "zebra_select_database %s",basename);
assert(basename);
return zebra_select_databases (zh, 1, &basename);
sprintf(u, "perm.%.30s", user ? user : "anonymous");
p = res_get(zs->global_res, u);
sprintf(u, "perm.%.30s", user ? user : "anonymous");
p = res_get(zs->global_res, u);
yaz_log(log_level, "zebra_admin_import_begin db=%s rt=%s",
database, record_type);
if (zebra_select_database(zh, database) == ZEBRA_FAIL)
yaz_log(log_level, "zebra_admin_import_begin db=%s rt=%s",
database, record_type);
if (zebra_select_database(zh, database) == ZEBRA_FAIL)
yaz_log(log_level, "zebra_admin_import_end");
return zebra_end_trans(zh);
}
yaz_log(log_level, "zebra_admin_import_end");
return zebra_end_trans(zh);
}
yaz_log(log_level, "zebra_admin_import_segment");
for (i = 0; i<segment->num_segmentRecords; i++)
yaz_log(log_level, "zebra_admin_import_segment");
for (i = 0; i<segment->num_segmentRecords; i++)
zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED,
"Cannot insert record: already exist");
return ZEBRA_FAIL;
zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED,
"Cannot insert record: already exist");
return ZEBRA_FAIL;
zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED,
"Cannot delete/update record: does not exist");
return ZEBRA_FAIL;
zebra_setError(zh, YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED,
"Cannot delete/update record: does not exist");
return ZEBRA_FAIL;
ZEBRA_RES zebra_drop_database(ZebraHandle zh, const char *db)
{
ZEBRA_RES ret = ZEBRA_OK;
ZEBRA_RES zebra_drop_database(ZebraHandle zh, const char *db)
{
ZEBRA_RES ret = ZEBRA_OK;
zebra_lock_r (zh->lock_shadow);
bfs = bfs_create (res_get (zh->res, "register"), zh->path_reg);
zebra_lock_r (zh->lock_shadow);
bfs = bfs_create (res_get (zh->res, "register"), zh->path_reg);
+
+ zebra_unlock (zh->lock_shadow);
+ zebra_unlock (zh->lock_normal);
+
+ zebra_lock_w(zh->lock_shadow);
+ bf_commitClean (bfs, rval);
+ zebra_unlock (zh->lock_normal);
return zebra_commit_ex(zh, 1);
}
ZEBRA_RES zebra_commit(ZebraHandle zh)
{
return zebra_commit_ex(zh, 1);
}
ZEBRA_RES zebra_commit(ZebraHandle zh)
{
assert(name);
assert(value);
yaz_log(log_level, "zebra_set_resource %s:%s", name, value);
assert(name);
assert(value);
yaz_log(log_level, "zebra_set_resource %s:%s", name, value);
return zh->shadow_enable;
}
void zebra_set_shadow_enable (ZebraHandle zh, int value)
{
return zh->shadow_enable;
}
void zebra_set_shadow_enable (ZebraHandle zh, int value)
{
- yaz_log(log_level, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno);
+ yaz_log(log_level, "zebra_delete_record");
+ if (sysno)
+ yaz_log(log_level, " sysno=" ZINT_FORMAT, *sysno);
zebra_limit_destroy(zh->m_limit);
zh->m_limit = zebra_limit_create(complement_flag, ids);
return ZEBRA_OK;
zebra_limit_destroy(zh->m_limit);
zh->m_limit = zebra_limit_create(complement_flag, ids);
return ZEBRA_OK;
zh->errCode = code;
nmem_reset(zh->nmem_error);
zh->errString = addinfo ? nmem_strdup(zh->nmem_error, addinfo) : 0;
zh->errCode = code;
nmem_reset(zh->nmem_error);
zh->errString = addinfo ? nmem_strdup(zh->nmem_error, addinfo) : 0;