maria:bb-10.5-svoj-MDEV-17084

Last commit made on 2019-09-20
Get this branch:
git clone -b bb-10.5-svoj-MDEV-17084 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.5-svoj-MDEV-17084
Repository:
lp:maria

Recent commits

7b6ff1f... by Monty <email address hidden>

MDEV-17084 - Optimize append only files for NVDIMM

Minor fixes.

a82c6dd... by Sergey Vojtovich

Fixup: one background thread for all caches

In reply to:
There is one thread per cache. Isn't that a bit overkill as we will have 3-4 caches?

5bdb2ae... by Sergey Vojtovich

Fixup: recreate file on size/n_caches change

In reply to:
If we call it with n_caches > what is in the file, we should flush the old cache and the re-initalize the cache for more files. This is a likely scenario when we add a new store engine that also wants to use the append_cache in which case n_caches can increase for the same server instance

370474b... by Sergey Vojtovich

Fixup: reshuffle code to avoid going negative

In reply to:
Note that as the above is uint, it can never be < 0, so it's easier to just test == 0
/* Wait for preceding concurrent writes completion */
     while ((uint64_t) my_atomic_load64_explicit((int64*) &cache->cached_eof,
                                                 MY_MEMORY_ORDER_RELAXED) <
            start)
       LF_BACKOFF();
Why wait. Can't we start writing to the beginning of the cache buffer up to the last flushed byte?
Isn't the cache a round-buffer? From the code it looks like we write to the end always, then flush and then start from the beginning.
hm.. It's probably right that we test for <= 0 above, but we need to cast the full expression to int or just make avail an int64_t

f5ae90f... by Sergey Vojtovich

Fixup: flush all caches

In reply to:
if we get an error when flushing one file, we should continue flush all the other files!

10b8c5e... by Sergey Vojtovich

Fixup: size_t written

In reply to:
ssize_t written; is sent to my_pwrite which takes size_t. Isn't it better to use size_t to not get warnings about conversions on windows ?

717c470... by Sergey Vojtovich

Fixup: 8k min cache size

In reply to:
Anyway, I think we should have a minumum required cache size to avoid stupid length checking, like at least 8K per chunk.

6b58339... by Sergey Vojtovich

Fixup: 32bit n_caches and magic

In reply to:
Why is n_caches uint64? When reading the code, I would assume that this means it's very big. Why not just uint ?
I can understand you want the header structure aligned, but that is independent of the user interface that is using 'n'
alos, please replace 'n' as a parameter to cache_slot or something more readable
Another thing to think about is to replace argument checking to use assert instead of return...
if (n >= dir->header->n_caches)
   return -1;

8981c2d... by Sergey Vojtovich

Fixup: replaced dir->dummy with !dir->header

In reply to:
In create_directory, shouldn't you start with setting dir->header to 0 to make it easy to check if the structure is unitialized or not?
Better to use header than 'dummy' which doesn't tell the user what it's all about.

e0c4708... by Sergey Vojtovich

Fixup: update magic

In reply to:
+/* PMAC0\0\0\0 */
+static const uint64_t pmem_append_cache_magic= 0x0000003043414d50;
In allmost all mariadb code, we usually have a magic prefix of:
255,255,id,version
The current max id is 12, so you could use 13.
sorry, should be 254,254
For example:
uchar maria_file_magic[]=
{ (uchar) 254, (uchar) 254, (uchar) 9, '\003', };
uchar maria_pack_file_magic[]=
{ (uchar) 254, (uchar) 254, (uchar) 10, '\001', };
most system have updated 'file' to support mariadb files...