Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set up log recovery in Assise? #16

Open
OmSaran opened this issue Nov 10, 2021 · 4 comments
Open

How to set up log recovery in Assise? #16

OmSaran opened this issue Nov 10, 2021 · 4 comments

Comments

@OmSaran
Copy link
Contributor

OmSaran commented Nov 10, 2021

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
Copy link
Contributor Author

OmSaran commented Nov 11, 2021

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.

@simpeter
Copy link

simpeter commented Nov 12, 2021 via email

@wreda
Copy link
Contributor

wreda commented Nov 13, 2021

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.

@OmSaran
Copy link
Contributor Author

OmSaran commented Nov 15, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants