milleruntime commented on a change in pull request #2117:
URL: https://github.com/apache/accumulo/pull/2117#discussion_r646735312



##########
File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogFileKey.java
##########
@@ -189,4 +195,90 @@ public String toString() {
     }
     throw new RuntimeException("Unknown type of entry: " + event);
   }
+
+  /**
+   * Converts LogFileKey to Key. Creates a Key containing all of the 
LogFileKey fields. The fields
+   * are stored so the Key sorts maintaining the legacy sort order. The row of 
the Key is composed
+   * of 3 fields: EventNum + tabletID + seq (separated by underscore). The 
EventNum is the integer
+   * returned by eventType(). The column family is always the event. The 
column qualifier is
+   * dependent of the type of event and could be empty.
+   *
+   * <pre>
+   *     Key Schema:
+   *     Row = EventNum_tabletID_seq
+   *     Family = event
+   *     Qualifier = tserverSession OR filename OR KeyExtent
+   * </pre>
+   */
+  public Key toKey() throws IOException {
+    String row = "";
+    int eventNum = eventType(event);
+    String family = event.name();
+    String qual = "";
+    switch (event) {
+      case OPEN:
+        row = formatRow(eventNum, 0, 0);
+        qual = tserverSession;
+        break;
+      case COMPACTION_START:
+        row = formatRow(eventNum, tabletId, seq);
+        if (filename != null)

Review comment:
       I agree but I was using the minKey and maxKey methods in 
`SortedLogRecovery`. I guess I could set the filename to a dummy value to 
create the range. Otherwise I would have to create the start and end keys for 
the range manually. I wanted to use the same `toKey()` method for consistency.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to