Re: [Tracker] how to handle this case (nfs share home directory among two PC)



Hi, Jamie,

For checking remote mounted directory, I wrote a simple prototype function. It uses getmntent in mntent.h to parse /etc/mtab.

If it looks OK, I will wrap it up as patch to use the SkipMountPoint option.

The prototype could compile in ubuntu.


-rick






2. Don't index remote mounted directories by default. We could also add an option for this. User could choose whether to index remote file systems by default.
>> we would need to detect these - any suggestions? parse fstab/msatb?
>> patches welcome





Rick Ju wrote:
Hi, Jamie,

 >> latest svn now has readonly mode so first run one gets read/write and
 >> subsequent ones are readonly only

But this still has some conflicts. For example Machine A runs tracker first and gets write access and indexing e.g. /data_machinA and /etc. And sometime later Machine A shutdown and Machine B gets write access and indexing /data_machineB and /etc.

This means the DB would contains /data_machineA, /data_machineB and /etc. What make it worse is that /etc contains total different data in A and B. So indexing data from different machines would mess up DB.


jamie :
On Tue, 2007-11-06 at 09:59 +0800, Rick Ju wrote:
Hi, Jamie,

Jerry, Halton and I discussed this several times last weeks. Here are some suggestions.

1. Shared NFS home directory issue. In this case, 2+ machines runs tracker with same DB and conflicts. A resolve is tracker use separate preference/DB directory.

 Such as:     ~/.tracker/machine-uuid-34738-34873/trackerDB
latest svn now has readonly mode so first run one gets read/write and
subsequent ones are readonly only

This could not resolve all of course but it could work around many conflict and performance issues.

-rick



jamie wrote:
On Fri, 2007-10-12 at 21:28 +0800, Jerry Tan wrote:
I have two PC, both have its own OS,
but one account share the same home directory by nfs share.

I can run trackerd on one PC,

but can not start trackerd on another PC, because there is a lock.


How can I use tracker  on this PC?


you risk corruption if NFS file locking is broken which is why we
disabled it

we had an option to move lock file to /tmp rather than $Home to allow
multiple sessions from a central NFS home dir to be run - I will
reenable it I suppose shortly


_______________________________________________
tracker-list mailing list
tracker-list gnome org
http://mail.gnome.org/mailman/listinfo/tracker-list
How about this?

when the first trackerd runs from one PC, it own the lock.

if one guy wants to start trackerd from another PC, tracker found the lock is there,
then it will start with noindex option,    it can still handle user request,
then tracker-search-tool can work on it also.
_______________________________________________
tracker-list mailing list
tracker-list gnome org
http://mail.gnome.org/mailman/listinfo/tracker-list
_______________________________________________
tracker-list mailing list
tracker-list gnome org
http://mail.gnome.org/mailman/listinfo/tracker-list

_______________________________________________
tracker-list mailing list
tracker-list gnome org
http://mail.gnome.org/mailman/listinfo/tracker-list

#include <stdio.h>
#include <mntent.h>
#include <string.h>

// XXX always little capital ?
// XXX Any other remote fs type ?
const char * g_remote_fs_type_list[] = {"nfs", "smbfs", NULL};
const char * g_mnt_tab = "/etc/mtab";
// const char * g_mnt_tab = "/etc/mnttab"

bool is_remote_fs_type(const char *_fs_type)
{
  for (int i=0; g_remote_fs_type_list[i]; i++)
  {
     if (0 == strcmp(g_remote_fs_type_list[i], _fs_type))
       return true;
  }

  return false;
}

bool is_remote_directory(const char *_dir, const char *_mnt_tab)
{
  if (!_dir || !_mnt_tab)
    return false;

  FILE *file = setmntent(_mnt_tab, "r");
  if (!file)
    return false;

  bool rtn = false;
  struct mntent * ent =  getmntent(file);
  while(ent)
  {
    if (0 == strcmp(_dir, ent->mnt_dir) && is_remote_fs_type(ent->mnt_type))
    {
      rtn = true;
      break;
    }

    ent = getmntent(file);
  }

  endmntent(file);
  return rtn;
}

int main(void)
{
  bool rtn = false;
  FILE *file = setmntent(g_mnt_tab, "r");
  if (!file)
    return false;

  char tmp[256][2048];
  memset(tmp, 2048*256, 0);

  int i = 0;
  struct mntent * ent = getmntent(file);
  while(ent)
  {
    strcpy(tmp[i], ent->mnt_dir);
    i++;
    ent = getmntent(file);
  }
  endmntent(file);

  i = 0;
  while(tmp[i][0])
  {
    bool is_remote = is_remote_directory(tmp[i], g_mnt_tab);
    printf("Checking %s: ......  %s\n", tmp[i], is_remote?"Remote mounted":"Local mounted");
    i++;
  }
  return rtn;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]