keith-turner commented on code in PR #3886:
URL: https://github.com/apache/accumulo/pull/3886#discussion_r1380826500
##########
core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java:
##########
@@ -19,67 +19,124 @@
package org.apache.accumulo.core.tabletserver.log;
import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.UUID;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
-import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
import org.apache.hadoop.io.Text;
+import com.google.common.net.HostAndPort;
+
public class LogEntry {
- private final KeyExtent extent;
- public final long timestamp;
- public final String filename;
- public LogEntry(KeyExtent extent, long timestamp, String filename) {
- // note the prevEndRow in the extent does not matter, and is not used by
LogEntry
- this.extent = extent;
+ private final long timestamp;
+ private final String filePath;
+
+ public LogEntry(long timestamp, String filePath) {
+ validateFilePath(filePath);
this.timestamp = timestamp;
- this.filename = filename;
+ this.filePath = filePath;
+ }
+
+ public long getTimestamp() {
+ return this.timestamp;
}
- // make copy, but with a different filename
- public LogEntry switchFile(String filename) {
- return new LogEntry(extent, timestamp, filename);
+ public String getFilePath() {
+ return this.filePath;
+ }
+
+ /**
+ * Validates the expected format of the file path. We expect the path to
contain a tserver
+ * (host:port) followed by a UUID as the file name. For example,
+ * localhost:1234/927ba659-d109-4bce-b0a5-bcbbcb9942a2 is a valid file path.
+ *
+ * @param filePath path to validate
+ * @throws IllegalArgumentException if the filepath is invalid
+ */
+ private static void validateFilePath(String filePath) {
+ String[] parts = filePath.split("/");
+
+ if (parts.length < 2) {
Review Comment:
> So should paths with nested directories (e.g. dir1/tserver:8020/UUID) not
be allowed?
Nevermind, ignore this comment. I was wrong about this. I was assuming
that full path were not being stored base on a comment in the class that I
misunderstood. I added code to print what is stored and ran an IT that does log
recovery and it is a full path.
--
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]