This change makes it possible to have register and shadow as same
directory. The size limits is only counted for each file type (so if
shadow is 10M and register is 20M the total size of directory is 30M).
-/* $Id: bfile.c,v 1.52 2006-11-14 08:12:06 adam Exp $
+/* $Id: bfile.c,v 1.53 2006-12-03 16:05:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Copyright (C) 1995-2006
Index Data ApS
struct BFiles_struct {
MFile_area commit_area;
struct BFiles_struct {
MFile_area commit_area;
- MFile_area_struct *register_area;
+ MFile_area register_area;
char *base;
char *cache_fname;
};
char *base;
char *cache_fname;
};
bfs->cache_fname = 0;
if (base)
bfs->base = xstrdup(base);
bfs->cache_fname = 0;
if (base)
bfs->base = xstrdup(base);
- bfs->register_area = mf_init("register", spec, base);
+ bfs->register_area = mf_init("register", spec, base, 0);
if (!bfs->register_area)
{
bfs_destroy(bfs);
if (!bfs->register_area)
{
bfs_destroy(bfs);
{
yaz_log(YLOG_LOG, "enabling shadow spec=%s", spec);
if (!bfs->commit_area)
{
yaz_log(YLOG_LOG, "enabling shadow spec=%s", spec);
if (!bfs->commit_area)
- bfs->commit_area = mf_init("shadow", spec, bfs->base);
+ bfs->commit_area = mf_init("shadow", spec, bfs->base, 1);
if (bfs->commit_area)
{
bfs->cache_fname = xmalloc(strlen(bfs->commit_area->dirs->name)+
if (bfs->commit_area)
{
bfs->cache_fname = xmalloc(strlen(bfs->commit_area->dirs->name)+
-/* $Id: mfile.c,v 1.71 2006-11-14 08:12:06 adam Exp $
+/* $Id: mfile.c,v 1.72 2006-12-03 16:05:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Copyright (C) 1995-2006
Index Data ApS
-MFile_area mf_init(const char *name, const char *spec, const char *base)
+MFile_area mf_init(const char *name, const char *spec, const char *base,
+ int only_shadow_files)
{
MFile_area ma = (MFile_area) xmalloc(sizeof(*ma));
mf_dir *dirp;
{
MFile_area ma = (MFile_area) xmalloc(sizeof(*ma));
mf_dir *dirp;
memcpy(metaname, dent->d_name, cp - dent->d_name);
metaname[ cp - dent->d_name] = '\0';
memcpy(metaname, dent->d_name, cp - dent->d_name);
metaname[ cp - dent->d_name] = '\0';
+ /* only files such as file-i-0.mf and file-i-b-0.mf, bug #739 */
+ if (only_shadow_files && cp[-2] != '-')
+ continue;
+ if (!only_shadow_files && cp[-2] == '-')
+ continue;
for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next)
{
/* known metafile */
for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next)
{
/* known metafile */
-/* $Id: mfile.h,v 1.10 2006-11-14 12:41:19 adam Exp $
+/* $Id: mfile.h,v 1.11 2006-12-03 16:05:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Copyright (C) 1995-2006
Index Data ApS
\param name of area (does not show up on disk - purely for notation)
\param spec area specification (e.g. "/a:1G dir /b:2000M"
\param base base directory (NULL for no base)
\param name of area (does not show up on disk - purely for notation)
\param spec area specification (e.g. "/a:1G dir /b:2000M"
\param base base directory (NULL for no base)
+ \param only_shadow_files only consider shadow files in area
\returns metafile area handle or NULL if error occurs
*/
\returns metafile area handle or NULL if error occurs
*/
-MFile_area mf_init(const char *name, const char *spec, const char *base)
+MFile_area mf_init(const char *name, const char *spec, const char *base,
+ int only_shadow_files)
ZEBRA_GCC_ATTR((warn_unused_result));
ZEBRA_GCC_ATTR((warn_unused_result));
/** \brief destroys metafile area handle
\param ma metafile area handle
*/
/** \brief destroys metafile area handle
\param ma metafile area handle
*/
-/* $Id: tstmfile1.c,v 1.1 2006-11-14 12:41:19 adam Exp $
+/* $Id: tstmfile1.c,v 1.2 2006-12-03 16:05:13 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Copyright (C) 1995-2006
Index Data ApS
- MFile_area a = mf_init("main", 0 /* spec */, 0 /* base */);
+ MFile_area a = mf_init("main", 0 /* spec */, 0 /* base */, 0 /* only sh */);
YAZ_CHECK(a);
mf_destroy(a);
}
YAZ_CHECK(a);
mf_destroy(a);
}
void tst2(void)
{
char buf[BLOCK_SIZE];
void tst2(void)
{
char buf[BLOCK_SIZE];
- MFile_area a = mf_init("main", 0 /* spec */, 0 /* base */);
+ MFile_area a = mf_init("main", 0 /* spec */, 0 /* base */, 0 /* only sh */);