empiredan commented on code in PR #1667:
URL:
https://github.com/apache/incubator-pegasus/pull/1667#discussion_r1382774733
##########
src/replica/disk_cleaner.cpp:
##########
@@ -70,6 +75,91 @@ const std::string kFolderSuffixBak = ".bak";
const std::string kFolderSuffixOri = ".ori";
const std::string kFolderSuffixTmp = ".tmp";
+namespace {
+
+bool get_expiration_seconds_by_last_write_time(const std::string &path,
+ uint64_t delay_seconds,
+ uint64_t &expiration_seconds)
+{
+ time_t last_write_seconds;
+ if (!dsn::utils::filesystem::last_write_time(path, last_write_seconds)) {
+ LOG_WARNING("gc_disk: failed to get last write time of {}", path);
+ return false;
+ }
+
+ expiration_seconds = static_cast<uint64_t>(last_write_seconds) +
delay_seconds;
+ return true;
+}
+
+// Unix timestamp in microseconds for 2010-01-01 00:00:00.
+// This timestamp could be used as the minimum, since it's far earlier than
the time when
+// Pegasus was born.
+#define MIN_TIMESTAMP_US 1262275200000000
+#define MIN_TIMESTAMP_US_LENGTH (sizeof(STRINGIFY(MIN_TIMESTAMP_US)) - 1)
+
+bool parse_timestamp_us(const std::string &name, size_t suffix_size, uint64_t
×tamp_us)
+{
+ // Examples of the directory names of faulty or dropped replicas could be:
+ // 1.1.pegasus.1698843209235962.err
+ // 2.1.pegasus.1698843214240709.gar
Review Comment:
OK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]