Skip to contentSkip to conversation

ceph.git branch master updated. v0.27.1-331-gd9ea95f

ceph-commit Gregory Farnum 4 participants 5 messages May 9, 2011 – May 10, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.
-Greg

Quoted 168 lines · Colin McCabe

The branch, master has been updated
      via  d9ea95f25feadec912297fce7a5031022ad493cd (commit) from  1cb611a057492d6aae9e0f2e7ef2bbeb2dedb064 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

http://ceph.newdream.net/git/?p=ceph.git;a=commit;h=d9ea95f25feadec912297fce7a5031022ad493cd

- Log ----------------------------------------------------------------- commit d9ea95f25feadec912297fce7a5031022ad493cd
Author: Colin Patrick McCabe <[email protected]>
Date:   Mon May 9 08:02:25 2011 -0700

   rados tool: remove import/export

   rados_sync replaces rados import / rados export

---

 src/rados.cc |  120 ----------------------------------------------------------

 1 files changed, 0 insertions(+), 120 deletions(-)
src/rados.cc +0 -100
index 468b667..a4c8699 100644
@@ -67,8 +67,6 @@ void usage()
   cerr << "   mksnap <snap-name>               create snap <snap-name>\n";
   cerr << "   rmsnap <snap-name>               remove snap <snap-name>\n";
   cerr << "   rollback <obj-name> <snap-name>  roll back object to snap <snap-name>\n\n";
-  cerr << "   import <dir>                     import pool from a directory\n";
-  cerr << "   export <dir>                     export pool into a directory\n";
   cerr << "   bench <seconds> write|seq|rand [-t concurrent_operations]\n";
   cerr << "                                    default is 16 concurrent IOs and 4 MB op size\n\n";
 
@@ -158,104 +156,6 @@ static int do_put(IoCtx& io_ctx, const char *objname, const char *infile, int op
   return 0;
  }
 
-static int import_dir(IoCtx& io_ctx, string path, const char *name, int prefix_len, int op_size)
-{
-  string dir_str;
-  if (!path.empty())
-    dir_str = path + "/";
-  dir_str += name;
-
-  DIR *dir = opendir(dir_str.c_str());
-  if (!dir) {
-    int err = -errno;
-    generic_dout(0) << "couldn't open " << dir_str << ": " << strerror(-err) << dendl;
-    return -errno;
-  }
-
-  struct dirent *dent;
-  dent = readdir(dir);
-  while (dent) {
-    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
-      goto next;
-    char buf[dir_str.size() + 1 + strlen(dent->d_name) + 1];
-    sprintf(buf, "%s/%s", dir_str.c_str(), dent->d_name);
-    generic_dout(0) << buf << dendl;
-    struct stat s;
-    if (stat(buf, &s) < 0) {
-      int err = -errno;
-      generic_dout(0) << "WARNING: failed to stat " << buf << ": " << strerror(-err) << dendl;
-    }
-    if (s.st_mode & S_IFDIR) {
-      import_dir(io_ctx, dir_str, dent->d_name, prefix_len, op_size);
-    } else {
-      const char *oid = buf + prefix_len + 1; // cut out the the dir name from the object name
-      do_put(io_ctx, oid, buf, op_size, false);
-    }
-next:
-    dent = readdir(dir);
-  }
-  closedir(dir);
-  return 0;
-}
-
-static int do_import(IoCtx& io_ctx, const char *dir_name, int op_size)
-{
-  string empty;
-  return import_dir(io_ctx, empty, dir_name, strlen(dir_name), op_size);
-}
-
-static int do_export(IoCtx& io_ctx, const char *dir_name)
-{
-  map<string, bool> dircache;
-  map<string, bool>::iterator iter;
-  string path = dir_name;
-  path += "/";
-
-  bool skip;
-  librados::ObjectIterator i = io_ctx.objects_begin();
-  librados::ObjectIterator i_end = io_ctx.objects_end();
-  int r = mkdir(dir_name, 0700);
-  if (r < 0) {
-    r = -errno;
-    if (r != -EEXIST)
-      return r;
-  }
-  for (; i != i_end; ++i) {
-    string name = *i;
-    int start = 0;
-    int pos = name.find('/');
-    skip = false;
-    while (pos >= 0) {
-      string dest = path;
-      dest += name.substr(0, pos);
-      if (dest.compare("..") == 0) {
-        skip = true;
-        break;
-      }
-      iter = dircache.find(dest);
-      if (iter == dircache.end()) {
-        generic_dout(0) << "mkdir: " << dest << dendl;
-        mkdir(dest.c_str(), 0700);
-        dircache[dest] = true;
-      }
-      start = pos + 1;
-      if ((size_t)start < name.size())
-        pos = name.find('/', start);
-      else
-        break;
-    }
-    if (skip)
-      continue;
-    if ((size_t)start == name.size())
-      continue;
-    string newfile = path + name;
-    generic_dout(0) << "exporting " << name << " => " << newfile << dendl;
-    do_get(io_ctx, name.c_str(), newfile.c_str(), false);
-  }
-
-  return 0;
-}
-
  /**********************************************
 
  **********************************************/
@@ -728,26 +628,6 @@ int main(int argc, const char **argv)

    cout << "rolled back pool " << pool_name << " to snapshot " << nargs[2] << std::endl; }
-  else if (strcmp(nargs[0], "import") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();

src/rados.cc +0 -17
-
-    ret = do_import(io_ctx, nargs[1], op_size);
-    if (ret < 0) {
-      cerr << "error importing " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
-  else if (strcmp(nargs[0], "export") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();
-
-    ret = do_export(io_ctx, nargs[1]);
-    if (ret < 0) {
-      cerr << "error exporting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
Quoted 8 lines

  else if (strcmp(nargs[0], "bench") == 0) {
    if (!pool_name || nargs.size() < 3)
      usage();
_______________________________________________
Ceph-commit mailing list
[email protected]
http://lists.ceph.newdream.net/listinfo.cgi/ceph-commit-ceph.newdream.net

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 3 lines · Gregory Farnum

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.

The main difference with sync is that it does incremental updates (skips dup items).

As an aside I we should move that into the rados tool, though ('rados sync' instead of 'rados_sync')...

Quoted 186 lines

-Greg

Quoted 168 lines · Colin McCabe

The branch, master has been updated
      via  d9ea95f25feadec912297fce7a5031022ad493cd (commit) from  1cb611a057492d6aae9e0f2e7ef2bbeb2dedb064 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

http://ceph.newdream.net/git/?p=ceph.git;a=commit;h=d9ea95f25feadec912297fce7a5031022ad493cd

- Log ----------------------------------------------------------------- commit d9ea95f25feadec912297fce7a5031022ad493cd
Author: Colin Patrick McCabe <[email protected]>
Date:   Mon May 9 08:02:25 2011 -0700

   rados tool: remove import/export

   rados_sync replaces rados import / rados export

---

 src/rados.cc |  120 ----------------------------------------------------------

 1 files changed, 0 insertions(+), 120 deletions(-)
src/rados.cc +0 -100
index 468b667..a4c8699 100644
@@ -67,8 +67,6 @@ void usage()
   cerr << "   mksnap <snap-name>               create snap <snap-name>\n";
   cerr << "   rmsnap <snap-name>               remove snap <snap-name>\n";
   cerr << "   rollback <obj-name> <snap-name>  roll back object to snap <snap-name>\n\n";
-  cerr << "   import <dir>                     import pool from a directory\n";
-  cerr << "   export <dir>                     export pool into a directory\n";
   cerr << "   bench <seconds> write|seq|rand [-t concurrent_operations]\n";
   cerr << "                                    default is 16 concurrent IOs and 4 MB op size\n\n";
 
@@ -158,104 +156,6 @@ static int do_put(IoCtx& io_ctx, const char *objname, const char *infile, int op
   return 0;
  }
 
-static int import_dir(IoCtx& io_ctx, string path, const char *name, int prefix_len, int op_size)
-{
-  string dir_str;
-  if (!path.empty())
-    dir_str = path + "/";
-  dir_str += name;
-
-  DIR *dir = opendir(dir_str.c_str());
-  if (!dir) {
-    int err = -errno;
-    generic_dout(0) << "couldn't open " << dir_str << ": " << strerror(-err) << dendl;
-    return -errno;
-  }
-
-  struct dirent *dent;
-  dent = readdir(dir);
-  while (dent) {
-    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
-      goto next;
-    char buf[dir_str.size() + 1 + strlen(dent->d_name) + 1];
-    sprintf(buf, "%s/%s", dir_str.c_str(), dent->d_name);
-    generic_dout(0) << buf << dendl;
-    struct stat s;
-    if (stat(buf, &s) < 0) {
-      int err = -errno;
-      generic_dout(0) << "WARNING: failed to stat " << buf << ": " << strerror(-err) << dendl;
-    }
-    if (s.st_mode & S_IFDIR) {
-      import_dir(io_ctx, dir_str, dent->d_name, prefix_len, op_size);
-    } else {
-      const char *oid = buf + prefix_len + 1; // cut out the the dir name from the object name
-      do_put(io_ctx, oid, buf, op_size, false);
-    }
-next:
-    dent = readdir(dir);
-  }
-  closedir(dir);
-  return 0;
-}
-
-static int do_import(IoCtx& io_ctx, const char *dir_name, int op_size)
-{
-  string empty;
-  return import_dir(io_ctx, empty, dir_name, strlen(dir_name), op_size);
-}
-
-static int do_export(IoCtx& io_ctx, const char *dir_name)
-{
-  map<string, bool> dircache;
-  map<string, bool>::iterator iter;
-  string path = dir_name;
-  path += "/";
-
-  bool skip;
-  librados::ObjectIterator i = io_ctx.objects_begin();
-  librados::ObjectIterator i_end = io_ctx.objects_end();
-  int r = mkdir(dir_name, 0700);
-  if (r < 0) {
-    r = -errno;
-    if (r != -EEXIST)
-      return r;
-  }
-  for (; i != i_end; ++i) {
-    string name = *i;
-    int start = 0;
-    int pos = name.find('/');
-    skip = false;
-    while (pos >= 0) {
-      string dest = path;
-      dest += name.substr(0, pos);
-      if (dest.compare("..") == 0) {
-        skip = true;
-        break;
-      }
-      iter = dircache.find(dest);
-      if (iter == dircache.end()) {
-        generic_dout(0) << "mkdir: " << dest << dendl;
-        mkdir(dest.c_str(), 0700);
-        dircache[dest] = true;
-      }
-      start = pos + 1;
-      if ((size_t)start < name.size())
-        pos = name.find('/', start);
-      else
-        break;
-    }
-    if (skip)
-      continue;
-    if ((size_t)start == name.size())
-      continue;
-    string newfile = path + name;
-    generic_dout(0) << "exporting " << name << " => " << newfile << dendl;
-    do_get(io_ctx, name.c_str(), newfile.c_str(), false);
-  }
-
-  return 0;
-}
-
  /**********************************************
 
  **********************************************/
@@ -728,26 +628,6 @@ int main(int argc, const char **argv)

    cout << "rolled back pool " << pool_name << " to snapshot " << nargs[2] << std::endl; }
-  else if (strcmp(nargs[0], "import") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();

src/rados.cc +0 -17
-
-    ret = do_import(io_ctx, nargs[1], op_size);
-    if (ret < 0) {
-      cerr << "error importing " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
-  else if (strcmp(nargs[0], "export") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();
-
-    ret = do_export(io_ctx, nargs[1]);
-    if (ret < 0) {
-      cerr << "error exporting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
Quoted 8 lines

  else if (strcmp(nargs[0], "bench") == 0) {
    if (!pool_name || nargs.size() < 3)
      usage();
_______________________________________________
Ceph-commit mailing list
[email protected]
http://lists.ceph.newdream.net/listinfo.cgi/ceph-commit-ceph.newdream.net

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.
-Greg

Quoted 168 lines · Colin McCabe

The branch, master has been updated
      via  d9ea95f25feadec912297fce7a5031022ad493cd (commit) from  1cb611a057492d6aae9e0f2e7ef2bbeb2dedb064 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

http://ceph.newdream.net/git/?p=ceph.git;a=commit;h=d9ea95f25feadec912297fce7a5031022ad493cd

- Log ----------------------------------------------------------------- commit d9ea95f25feadec912297fce7a5031022ad493cd
Author: Colin Patrick McCabe <[email protected]>
Date:   Mon May 9 08:02:25 2011 -0700

   rados tool: remove import/export

   rados_sync replaces rados import / rados export

---

 src/rados.cc |  120 ----------------------------------------------------------

 1 files changed, 0 insertions(+), 120 deletions(-)
src/rados.cc +0 -100
index 468b667..a4c8699 100644
@@ -67,8 +67,6 @@ void usage()
   cerr << "   mksnap <snap-name>               create snap <snap-name>\n";
   cerr << "   rmsnap <snap-name>               remove snap <snap-name>\n";
   cerr << "   rollback <obj-name> <snap-name>  roll back object to snap <snap-name>\n\n";
-  cerr << "   import <dir>                     import pool from a directory\n";
-  cerr << "   export <dir>                     export pool into a directory\n";
   cerr << "   bench <seconds> write|seq|rand [-t concurrent_operations]\n";
   cerr << "                                    default is 16 concurrent IOs and 4 MB op size\n\n";
 
@@ -158,104 +156,6 @@ static int do_put(IoCtx& io_ctx, const char *objname, const char *infile, int op
   return 0;
  }
 
-static int import_dir(IoCtx& io_ctx, string path, const char *name, int prefix_len, int op_size)
-{
-  string dir_str;
-  if (!path.empty())
-    dir_str = path + "/";
-  dir_str += name;
-
-  DIR *dir = opendir(dir_str.c_str());
-  if (!dir) {
-    int err = -errno;
-    generic_dout(0) << "couldn't open " << dir_str << ": " << strerror(-err) << dendl;
-    return -errno;
-  }
-
-  struct dirent *dent;
-  dent = readdir(dir);
-  while (dent) {
-    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
-      goto next;
-    char buf[dir_str.size() + 1 + strlen(dent->d_name) + 1];
-    sprintf(buf, "%s/%s", dir_str.c_str(), dent->d_name);
-    generic_dout(0) << buf << dendl;
-    struct stat s;
-    if (stat(buf, &s) < 0) {
-      int err = -errno;
-      generic_dout(0) << "WARNING: failed to stat " << buf << ": " << strerror(-err) << dendl;
-    }
-    if (s.st_mode & S_IFDIR) {
-      import_dir(io_ctx, dir_str, dent->d_name, prefix_len, op_size);
-    } else {
-      const char *oid = buf + prefix_len + 1; // cut out the the dir name from the object name
-      do_put(io_ctx, oid, buf, op_size, false);
-    }
-next:
-    dent = readdir(dir);
-  }
-  closedir(dir);
-  return 0;
-}
-
-static int do_import(IoCtx& io_ctx, const char *dir_name, int op_size)
-{
-  string empty;
-  return import_dir(io_ctx, empty, dir_name, strlen(dir_name), op_size);
-}
-
-static int do_export(IoCtx& io_ctx, const char *dir_name)
-{
-  map<string, bool> dircache;
-  map<string, bool>::iterator iter;
-  string path = dir_name;
-  path += "/";
-
-  bool skip;
-  librados::ObjectIterator i = io_ctx.objects_begin();
-  librados::ObjectIterator i_end = io_ctx.objects_end();
-  int r = mkdir(dir_name, 0700);
-  if (r < 0) {
-    r = -errno;
-    if (r != -EEXIST)
-      return r;
-  }
-  for (; i != i_end; ++i) {
-    string name = *i;
-    int start = 0;
-    int pos = name.find('/');
-    skip = false;
-    while (pos >= 0) {
-      string dest = path;
-      dest += name.substr(0, pos);
-      if (dest.compare("..") == 0) {
-        skip = true;
-        break;
-      }
-      iter = dircache.find(dest);
-      if (iter == dircache.end()) {
-        generic_dout(0) << "mkdir: " << dest << dendl;
-        mkdir(dest.c_str(), 0700);
-        dircache[dest] = true;
-      }
-      start = pos + 1;
-      if ((size_t)start < name.size())
-        pos = name.find('/', start);
-      else
-        break;
-    }
-    if (skip)
-      continue;
-    if ((size_t)start == name.size())
-      continue;
-    string newfile = path + name;
-    generic_dout(0) << "exporting " << name << " => " << newfile << dendl;
-    do_get(io_ctx, name.c_str(), newfile.c_str(), false);
-  }
-
-  return 0;
-}
-
  /**********************************************
 
  **********************************************/
@@ -728,26 +628,6 @@ int main(int argc, const char **argv)

    cout << "rolled back pool " << pool_name << " to snapshot " << nargs[2] << std::endl; }
-  else if (strcmp(nargs[0], "import") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();

src/rados.cc +0 -17
-
-    ret = do_import(io_ctx, nargs[1], op_size);
-    if (ret < 0) {
-      cerr << "error importing " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
-  else if (strcmp(nargs[0], "export") == 0) {
-    if (!pool_name || nargs.size() < 2)
-      usage();
-
-    ret = do_export(io_ctx, nargs[1]);
-    if (ret < 0) {
-      cerr << "error exporting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
-      return 1;
-    }
-  }
Quoted 8 lines

  else if (strcmp(nargs[0], "bench") == 0) {
    if (!pool_name || nargs.size() < 3)
      usage();
_______________________________________________
Ceph-commit mailing list
[email protected]
http://lists.ceph.newdream.net/listinfo.cgi/ceph-commit-ceph.newdream.net

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 4 lines · Gregory Farnum

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.
-Greg

Sorry, Gmail got confused so I resent! :(

Quoted 10 lines · Sage Weil
Quoted 3 lines · Gregory Farnum

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.

The main difference with sync is that it does incremental updates (skips dup items).

As an aside I we should move that into the rados tool, though ('rados sync' instead of 'rados_sync')...

If it's that simple a syntax change, I agree. I thought rados_sync would require an empty directory if you just want to pull an object out, which was my main concern.
-Greg

#5 lore raw

Hi all.

As we noted earlier, "rados get" and "rados put" do gets and puts, respectively. This is different from "export" and "import" which have always synchronized whole pools.

I guess we can have syntax like this for the import and export:
rados sync [import|export] <options> <src> <dst>

I will implement that in a branch called wip-merge-radostool-with-radossync and you can evaluate whether you like it better than having a separate binary or not.

Colin

Quoted 20 lines · Gregory Farnum
Quoted 4 lines · Gregory Farnum

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.
-Greg

Sorry, Gmail got confused so I resent! :(

Quoted 10 lines · Sage Weil
Quoted 3 lines · Gregory Farnum

Ermm, doesn't rados sync do a whole tree sync or something? I think we want to maintain a simple get/set object capability and the rados tool is a pretty logical place for that.

The main difference with sync is that it does incremental updates (skips dup items).

As an aside I we should move that into the rados tool, though ('rados sync' instead of 'rados_sync')...

Quoted 9 lines

If it's that simple a syntax change, I agree. I thought rados_sync would require an empty directory if you just want to pull an object out, which was my main concern.
-Greg
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html