assise icon indicating copy to clipboard operation
assise copied to clipboard

How to set up log recovery in Assise?

Open OmSaran opened this issue 4 years ago • 4 comments

I am trying to do a simple crash consistency test for Assise in local mode (i.e., non distributed) and using only NVMs.

Here's what the test does:

do_crash.c

  1. Create a file
  2. _exit(0) // so that exit handlers are not invoked (thus not digested). (Note that we do not call fsync)

check_crash.c

  1. Execute access call to check if file created in do_crash.c is present

The check_crash.c does not seem to be passing i.e., it says the file is absent. The test passes if a clean exit is done (by commenting out _exit(0))

I believe this is because the log recovery is not enabled. How do I set it up to test this crash consistency? I tried adding a digest call in the init_log() of LibFS, but the n_digest value loaded does not seem to reflect the correct value. I may be wrong here, but the n_digest value seems to be stored in dram rather than NVM? This operation does not seem to be updated in the NVM, only updated in DRAM after transaction completion. I don't have a deep understanding of the codebase, so I guess I'm probably missing something here.

It would be great if you could help me in setting it up. I believe this scenario is similar to the OS fail-over experiment described in the paper.

I've also included the do_crash.c and check_crash.c programs here for reference.

Thanks in advance for your help!

do_crash.c

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>

#define FILE_NAME "/mlfs/foo"

int main() {
    int ret;
    int child;
    int wstatus;
    int fd;


    if(remove(FILE_NAME) == 0) {
        printf("Deleted file successfully!\n");
    } else {
        printf("Deletion of file unsuccessful, probably does not exist!\n");
    }

    printf("Tring to open\n");
    fd = open(FILE_NAME, O_CREAT | O_RDWR, 0644);
    assert(fd >=0 );
    printf("Open completed\n");
    _exit(0);  // Commenting this line ensures remaining logs are digested due to invocation of Assise's exit handler

    close(fd);
}

check_crash.c

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>

#define FILE_NAME "/mlfs/foo"

int main() {
    int ret;

    ret = access(FILE_NAME, F_OK);
    printf("The return value is: %d\n",ret);
    assert(ret == 0);
    printf("The file is present!\n");

    return 0;
}

OmSaran avatar Nov 10 '21 19:11 OmSaran

I'm able to make the test pass now after making code changes

Here's what I did:

  1. After this line, I added the following call: write_log_superblock((struct log_superblock *)g_log_sb);
  2. After this line, I added the following call: shutdown_log();

It would be great if you can let me know if this is the correct way to do it, because adding write_log_superblock((struct log_superblock *)g_log_sb);, I believe would impact performance of all operations (wrapped in a transaction) in the filesystem.

OmSaran avatar Nov 11 '21 04:11 OmSaran

Waleed, Henry, does this seem correct to you? Is there perhaps some log recovery code missing in the public Assise repo?

On Wed, Nov 10, 2021 at 10:13 PM Om Saran @.***> wrote:

I'm able to make the test pass now:

Here's what I did:

  1. After this line https://github.com/ut-osa/assise/blob/6f4aec82747d4d828c5c27b62b27c92b60fea79e/libfs/src/log/log.c#L1201, I added the following call: write_log_superblock((struct log_superblock *)g_log_sb);
  2. After this line https://github.com/ut-osa/assise/blob/6f4aec82747d4d828c5c27b62b27c92b60fea79e/libfs/src/log/log.c#L146, I added the following call: shutdown_log();

It would be great if you can let me know if this is the correct way to do it, because adding write_log_superblock((struct log_superblock *)g_log_sb);, I believe would impact performance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ut-osa/assise/issues/16#issuecomment-965972199, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHQBMWN5CEDVFRSVJS3QPDULM7FFANCNFSM5HYVSHXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

simpeter avatar Nov 12 '21 20:11 simpeter

Our artifact currently doesn't include a generalized implementation of log recovery. Your workaround should be okay for the test programs you shared. The added "write_log_superblock" call will affect write performance, as you said, but I don't expect it'll have a significant impact since the log superblock is only 40 bytes in size.

wreda avatar Nov 13 '21 15:11 wreda

Thanks for the confirmation. I will try this out and see if it works for some other programs too.

OmSaran avatar Nov 15 '21 01:11 OmSaran