acelyc111 commented on code in PR #1594:
URL: 
https://github.com/apache/incubator-pegasus/pull/1594#discussion_r1329716016


##########
src/replica/replica_stub.h:
##########
@@ -361,6 +364,30 @@ class replica_stub : public serverlet<replica_stub>, 
public ref_counter
     replica_life_cycle get_replica_life_cycle(gpid id);
     void on_gc_replica(replica_stub_ptr this_, gpid id);
 
+    struct replica_gc_info
+    {
+        replica_ptr rep;
+        partition_status::type status;
+        mutation_log_ptr plog;
+        decree last_durable_decree;
+        int64_t init_offset_in_shared_log;
+    };
+    using replica_gc_info_map = std::unordered_map<gpid, replica_gc_info>;
+
+    // Try to remove obsolete files of shared log for garbage collection 
according to the provided
+    // states of all replicas. The purpose is to remove all of the files of 
shared log, since it
+    // has been deprecated, and would not be appended any more.
+    void gc_slog(const replica_gc_info_map &replica_gc_map);
+
+    // The number of flushed replicas for the garbage collection of shared log 
at a time should be
+    // limited.
+    void limit_flush_replicas_for_slog_gc(size_t prevent_gc_replica_count);

Review Comment:
   Why add this limitation, what will happen if not limit it?



##########
src/replica/replica_stub.h:
##########
@@ -361,6 +364,30 @@ class replica_stub : public serverlet<replica_stub>, 
public ref_counter
     replica_life_cycle get_replica_life_cycle(gpid id);
     void on_gc_replica(replica_stub_ptr this_, gpid id);
 
+    struct replica_gc_info
+    {
+        replica_ptr rep;
+        partition_status::type status;
+        mutation_log_ptr plog;
+        decree last_durable_decree;
+        int64_t init_offset_in_shared_log;
+    };
+    using replica_gc_info_map = std::unordered_map<gpid, replica_gc_info>;
+
+    // Try to remove obsolete files of shared log for garbage collection 
according to the provided
+    // states of all replicas. The purpose is to remove all of the files of 
shared log, since it
+    // has been deprecated, and would not be appended any more.
+    void gc_slog(const replica_gc_info_map &replica_gc_map);
+
+    // The number of flushed replicas for the garbage collection of shared log 
at a time should be
+    // limited.
+    void limit_flush_replicas_for_slog_gc(size_t prevent_gc_replica_count);
+
+    // Flush rocksdb data to sst files for replicas to facilitate garbage 
collection of more files
+    // of shared log.
+    void flush_replicas_for_slog_gc(const replica_gc_info_map &replica_gc_map,

Review Comment:
   What does the second parameter `prevent_gc_replicas` means?



##########
src/replica/replica_stub.h:
##########
@@ -436,6 +464,15 @@ class replica_stub : public serverlet<replica_stub>, 
public ref_counter
     closing_replicas _closing_replicas;
     closed_replicas _closed_replicas;
 
+    // The number of replicas that prevent slog files from being removed for 
gc at last round.

Review Comment:
   ```suggestion
       // The number of replicas that prevent slog files from being removed for 
gc at the last round.
   ```



-- 
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]

Reply via email to