empiredan commented on code in PR #2078:
URL:
https://github.com/apache/incubator-pegasus/pull/2078#discussion_r1776896543
##########
src/replica/replica_stub.h:
##########
@@ -357,8 +365,36 @@ class replica_stub : public serverlet<replica_stub>,
public ref_counter
bool restore_if_necessary,
bool is_duplication_follower,
const std::string &parent_dir = "");
- // Load an existing replica which is located in 'dn' with 'dir' directory.
- replica *load_replica(dir_node *dn, const char *dir);
+
+ using disk_dirs = std::vector<std::pair<dir_node *,
std::vector<std::string>>>;
+
+ // Get the absolute dirs of all replicas for all disks.
+ disk_dirs get_all_disk_dirs() const;
+
+ // Get the dir name for a replica from a potentially longer path (both
absolute and
+ // relative paths are possible).
+ static std::string get_replica_dir_name(const std::string &dir);
+
+ // Parse app id, partition id and app type from the dir name of a replica.
+ static bool
+ parse_replica_dir_name(const std::string &dir_name, gpid &pid, std::string
&app_type);
+
+ // Load an existing replica which is located in `dn` with `dir`. Usually
each different
+ // `dn` represents a unique disk. `dir` is the absolute path of the
directory for a
+ // replica.
+ virtual replica_ptr load_replica(dir_node *dn, const char *dir);
+
+ // The same as the above `load_replica` function, except that this
function is to load
+ // each replica to `reps` with protection from `reps_lock`.
+ void
+ load_replica(dir_node *dn, const std::string &dir, utils::ex_lock
&reps_lock, replicas &reps);
+
+ // Load all replicas synchronously from all disks to `reps`. This function
would ensure
+ // that data on each disk is loaded more evenly, rather than that a disk
would begin to
+ // be loaded only after another has been finished, in case that there are
too many replicas
+ // on a disk and other disks cannot start loading until this disk is
finished.
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]