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

Save term info in snapshot filename #296

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

lzydmxy
Copy link
Contributor

@lzydmxy lzydmxy commented Jun 4, 2024

Which issues of this PR fixes:

This PR try to fix #4

Change log:

update SNAPSHOT_FILE_NAME from snapshot_{create_time}{last_log_index}{object_id} to snapshot_{create_time}{last_log_term}{last_log_index}_{object_id}

@JackyWoo JackyWoo added this to the Release v2.1.0 milestone Jun 5, 2024
@JackyWoo JackyWoo added the bug Something isn't working label Jun 5, 2024
@JackyWoo
Copy link
Contributor

JackyWoo commented Jun 5, 2024

LGTM, except some code styles

@JackyWoo
Copy link
Contributor

JackyWoo commented Jun 5, 2024

Please remove SnapshotVersion:V3 for you do not use it.

V3 = 3, /// Add last_log_term to file name

#include <fcntl.h>
#include <filesystem>
#include <stdio.h>
#include <unistd.h>

#include "common/find_symbols.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use <>

continue;
}

auto key = static_cast<uint128_t>(s_obj.log_last_term) << 64 | s_obj.log_last_index;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use getSnapshotStoreMapKey

/// create_time, last_log_term, last_log_index, object_id
static constexpr char SNAPSHOT_FILE_NAME_V1[] = "snapshot_{}_{}_{}_{}";

String time_str;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_time

@lzydmxy lzydmxy force-pushed the add_term_info_for_snapshot branch from c2fc175 to bef2a74 Compare June 5, 2024 09:52
@JackyWoo JackyWoo merged commit 9a57a66 into JDRaftKeeper:master Jun 5, 2024
14 checks passed
@lzydmxy lzydmxy mentioned this pull request Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapshot should keep last log term.
2 participants