[SPDK] Re: Rocksdb with SPDK

Walker, Benjamin <benjamin.walker at intel.com>
Newsgroups dev.linux.lists.spdk
Message-ID <BYAPR11MB282408E66E3E62D8967C0D14EF300@BYAPR11MB2824.namprd11.prod.outlook.com>
Hi Dimitra

> From: dimitra.giantsidi(a)gmail.com <dimitra.giantsidi(a)gmail.com>> 
> Hi all,
> 
> I am running Rocksdb on top of a blobfs filesystem and I have a couple of
> questions.
> 
> 1. What exactly does the ```sanitize_path()``` function do and why do we need to
> sanitize the path before opening a file? If the fname is /mnt/rocksdb/log, the
> sanitize path returns /log .. What does that means for my application?

Blobfs doesn't actually have a hierarchical directory structure. It stores the file names as string keys. Therefore it is very important that the same file, however it's described via valid POSIX paths, translate into a consistent string name. That's what sanitize_path() is doing.

> 2. the file->Sync() operations fails with a message "Not Implemented". In
> particular, I am having the following code :
> 
> ```
> if (!FLAGS__spdk.empty()) {
>                         FLAGS_env = rocksdb::NewSpdkEnv(FLAGS_env, FLAGS_dir,
> FLAGS__spdk, FLAGS__spdk_bdev, FLAGS__spdk_cache_size);
>                         fprintf(stdout, "Using rocksdb::NewSpdkEnv() environment.\n");
>                         if (FLAGS_env == nullptr) {
>                                 fprintf(stderr, "Could not load SPDK blobfs - check that SPDK
> mkfs was run "
>                                                 "against block device %s.\n",
> FLAGS__spdk_bdev.c_str());
>                                 exit(1);
>                         }
>                 }
> 
>                 unique_ptr<WritableFile> file;
>                 EnvOptions soptions;
> 
>                 rocksdb::Slice data = return_data(FLAGS__value_size);
>                 Status s = FLAGS_env->NewWritableFile(FLAGS_file, &file, soptions);
>                 if (!s.ok()) {
>                         fprintf(stderr, "oops ..\n");
>                         abort();
>                 }
> 
>                 size_t size = 0;
>                 size_t total_size = FLAGS_total_size*1024;
>                 struct timeval start_time, end_time;
>                 gettimeofday(&start_time, NULL);
>                 while (size < total_size) {
>                         s = file->Append(data);
> 
>                         if (s.ok()) {
>                                 s = file->Sync();
>                         }
> 
>                         size += FLAGS__value_size;
> 
>                         if (!s.ok()) {
>                                 fprintf(stdout, "written %d bytes to %s (%s)..\n", size,
> FLAGS_file.c_str(), s.ToString().c_str());
>                                 abort();
>                         }
>                 }
> ```
> 
> However, I am seeing that the rocksdb::SpdkWritableFile::Sync() is implemented

Where is that "Not implemented" message coming from in the code? Is that something from RocksDB? It does look like sync is implemented.

> ..
> Any ideas?
> Thanks for your help :)
> 
> Dimitra
> _______________________________________________
> SPDK mailing list -- spdk(a)lists.01.org
> To unsubscribe send an email to spdk-leave(a)lists.01.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.