This is an automated email from the ASF dual-hosted git repository. domgarguilo pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 75ad6ff82b Clean up LogEntry class (#3939) 75ad6ff82b is described below commit 75ad6ff82b79de884d01b3165b6144e01a562e10 Author: Dom G <domgargu...@apache.org> AuthorDate: Wed Nov 8 14:56:39 2023 -0500 Clean up LogEntry class (#3939) --- .../accumulo/core/tabletserver/log/LogEntry.java | 114 ++++++++++++----- .../core/metadata/schema/TabletMetadataTest.java | 20 +-- .../core/tabletserver/log/LogEntryTest.java | 139 ++++++++++++++------- .../org/apache/accumulo/server/fs/VolumeUtil.java | 8 +- .../server/manager/state/MetaDataStateStore.java | 2 +- .../server/manager/state/ZooTabletStateStore.java | 7 +- .../server/metadata/TabletMutatorBase.java | 4 +- .../accumulo/server/util/ListVolumesUsed.java | 2 +- .../org/apache/accumulo/tserver/TabletServer.java | 4 +- .../org/apache/accumulo/tserver/tablet/Tablet.java | 2 +- .../test/MissingWalHeaderCompletesRecoveryIT.java | 12 +- .../apache/accumulo/test/manager/MergeStateIT.java | 9 +- 12 files changed, 213 insertions(+), 110 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java b/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java index ae3e6f4621..70c10f4e4b 100644 --- a/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java +++ b/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java @@ -19,67 +19,121 @@ 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) { + throw new IllegalArgumentException( + "Invalid filePath format. The path should at least contain tserver/UUID."); + } + + String tserverPart = parts[parts.length - 2]; + String uuidPart = parts[parts.length - 1]; + + try { + var ignored = HostAndPort.fromString(tserverPart); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException( + "Invalid tserver format in filePath. Expected format: host:port. Found '" + tserverPart + + "'"); + } + + try { + var ignored = UUID.fromString(uuidPart); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Expected valid UUID. Found '" + uuidPart + "'"); + } + } + + /** + * Make a copy of this LogEntry but replace the file path. + * + * @param filePath path to use + */ + public LogEntry switchFile(String filePath) { + return new LogEntry(timestamp, filePath); } @Override public String toString() { - return extent.toMetaRow() + " " + filename; + return filePath; + } + + @Override + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof LogEntry)) { + return false; + } + LogEntry logEntry = (LogEntry) other; + return this.timestamp == logEntry.timestamp && this.filePath.equals(logEntry.filePath); + } + + @Override + public int hashCode() { + return Objects.hash(timestamp, filePath); } public static LogEntry fromMetaWalEntry(Entry<Key,Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); - KeyExtent extent = KeyExtent.fromMetaRow(key.getRow()); - // qualifier.split("/")[0] used to store the server, but this is no longer used, and the - // qualifier can be ignored - // the following line handles old-style log entry values that specify log sets - String[] parts = value.toString().split("\\|")[0].split(";"); - String filename = parts[parts.length - 1]; - long timestamp = key.getTimestamp(); - return new LogEntry(extent, timestamp, filename); - } - public Text getRow() { - return extent.toMetaRow(); - } + String filePath = value.toString(); + + validateFilePath(filePath); - public Text getColumnFamily() { - return LogColumnFamily.NAME; + return new LogEntry(key.getTimestamp(), filePath); } public String getUniqueID() { - String[] parts = filename.split("/"); + String[] parts = filePath.split("/"); return parts[parts.length - 1]; } public Text getColumnQualifier() { - return new Text("-/" + filename); + return new Text("-/" + filePath); } public Value getValue() { - return new Value(filename); + return new Value(filePath); } } diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java index 244271534f..4f1d99f755 100644 --- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java +++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java @@ -39,6 +39,7 @@ import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; +import java.util.UUID; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -56,6 +57,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Cu import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.FutureLocationColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LastLocationColumnFamily; +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.SuspendLocationColumn; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily; @@ -99,12 +101,12 @@ public class TabletMetadataTest { mutation.at().family(LastLocationColumnFamily.NAME).qualifier("s000").put("server2:8555"); - LogEntry le1 = new LogEntry(extent, 55, "lf1"); - mutation.at().family(le1.getColumnFamily()).qualifier(le1.getColumnQualifier()) - .timestamp(le1.timestamp).put(le1.getValue()); - LogEntry le2 = new LogEntry(extent, 57, "lf2"); - mutation.at().family(le2.getColumnFamily()).qualifier(le2.getColumnQualifier()) - .timestamp(le2.timestamp).put(le2.getValue()); + LogEntry le1 = new LogEntry(55, "localhost:8020/" + UUID.randomUUID()); + mutation.at().family(LogColumnFamily.NAME).qualifier(le1.getColumnQualifier()) + .timestamp(le1.getTimestamp()).put(le1.getValue()); + LogEntry le2 = new LogEntry(57, "localhost:8020/" + UUID.randomUUID()); + mutation.at().family(LogColumnFamily.NAME).qualifier(le2.getColumnQualifier()) + .timestamp(le2.getTimestamp()).put(le2.getValue()); StoredTabletFile sf1 = StoredTabletFile.of(new Path("hdfs://nn1/acc/tables/1/t-0001/sf1.rf")); StoredTabletFile sf2 = StoredTabletFile.of(new Path("hdfs://nn1/acc/tables/1/t-0001/sf2.rf")); @@ -134,8 +136,10 @@ public class TabletMetadataTest { assertEquals(HostAndPort.fromParts("server2", 8555), tm.getLast().getHostAndPort()); assertEquals("s000", tm.getLast().getSession()); assertEquals(LocationType.LAST, tm.getLast().getType()); - assertEquals(Set.of(le1.getValue() + " " + le1.timestamp, le2.getValue() + " " + le2.timestamp), - tm.getLogs().stream().map(le -> le.getValue() + " " + le.timestamp).collect(toSet())); + assertEquals( + Set.of(le1.getValue() + " " + le1.getTimestamp(), + le2.getValue() + " " + le2.getTimestamp()), + tm.getLogs().stream().map(le -> le.getValue() + " " + le.getTimestamp()).collect(toSet())); assertEquals(extent.prevEndRow(), tm.getPrevEndRow()); assertEquals(extent.tableId(), tm.getTableId()); assertTrue(tm.sawPrevEndRow()); diff --git a/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java b/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java index cc1b4d5ded..9e4f17cd08 100644 --- a/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java +++ b/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java @@ -18,65 +18,46 @@ */ package org.apache.accumulo.core.tabletserver.log; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; -import java.io.IOException; +import java.nio.file.Path; +import java.util.List; import java.util.Map.Entry; +import java.util.UUID; +import java.util.stream.Stream; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.core.dataImpl.KeyExtent; +import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.hadoop.io.Text; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -public class LogEntryTest { +import com.google.common.net.HostAndPort; - private static void compareLogEntries(LogEntry one, LogEntry two) throws IOException { - assertNotSame(one, two); - assertEquals(one.toString(), two.toString()); - assertEquals(one.getColumnFamily(), two.getColumnFamily()); - assertEquals(one.getColumnQualifier(), two.getColumnQualifier()); - assertEquals(one.getRow(), two.getRow()); - assertEquals(one.getUniqueID(), two.getUniqueID()); - assertEquals(one.getValue(), two.getValue()); - } +public class LogEntryTest { - @Test - public void testPrevRowDoesntMatter() throws IOException { - long ts = 12345678L; - String filename = "default/foo"; - - // with no end row, different prev rows - LogEntry entry1 = - new LogEntry(new KeyExtent(TableId.of("1"), null, new Text("A")), ts, filename); - LogEntry entry2 = - new LogEntry(new KeyExtent(TableId.of("1"), null, new Text("B")), ts, filename); - assertEquals("1< default/foo", entry1.toString()); - compareLogEntries(entry1, entry2); - - // with same end row, different prev rows - LogEntry entry3 = - new LogEntry(new KeyExtent(TableId.of("2"), new Text("same"), new Text("A")), ts, filename); - LogEntry entry4 = - new LogEntry(new KeyExtent(TableId.of("2"), new Text("same"), new Text("B")), ts, filename); - assertEquals("2;same default/foo", entry3.toString()); - compareLogEntries(entry3, entry4); - } + final HostAndPort validHost = HostAndPort.fromParts("default", 8080); + final UUID validUUID = UUID.randomUUID(); + final String validFilename = Path.of(validHost.toString(), validUUID.toString()).toString(); @Test public void test() throws Exception { - KeyExtent extent = new KeyExtent(TableId.of("1"), null, null); long ts = 12345678L; - String filename = "default/foo"; - LogEntry entry = new LogEntry(extent, ts, filename); - assertEquals(extent.toMetaRow(), entry.getRow()); - assertEquals(filename, entry.filename); - assertEquals(ts, entry.timestamp); - assertEquals("1< default/foo", entry.toString()); - assertEquals(new Text("log"), entry.getColumnFamily()); - assertEquals(new Text("-/default/foo"), entry.getColumnQualifier()); + String uuid = UUID.randomUUID().toString(); + String filename = Path.of("default", uuid).toString(); + LogEntry entry = new LogEntry(ts, filename); + + assertEquals(filename, entry.getFilePath()); + assertEquals(ts, entry.getTimestamp()); + assertEquals(filename, entry.toString()); + assertEquals(new Text("log"), MetadataSchema.TabletsSection.LogColumnFamily.NAME); + assertEquals(new Text("-/" + filename), entry.getColumnQualifier()); + Key key = new Key(new Text("1<"), new Text("log"), new Text("localhost:1234/default/foo")); key.setTimestamp(ts); var mapEntry = new Entry<Key,Value>() { @@ -97,10 +78,74 @@ public class LogEntryTest { }; LogEntry copy2 = LogEntry.fromMetaWalEntry(mapEntry); assertEquals(entry.toString(), copy2.toString()); - assertEquals(entry.timestamp, copy2.timestamp); - assertEquals("foo", entry.getUniqueID()); - assertEquals("-/default/foo", entry.getColumnQualifier().toString()); - assertEquals(new Value("default/foo"), entry.getValue()); + assertEquals(entry.getTimestamp(), copy2.getTimestamp()); + assertEquals(uuid, entry.getUniqueID()); + assertEquals("-/" + filename, entry.getColumnQualifier().toString()); + assertEquals(new Value(filename), entry.getValue()); + } + + @Test + public void testEquals() { + long ts = 123456L; + + LogEntry one = new LogEntry(ts, validFilename); + LogEntry two = new LogEntry(ts, validFilename); + + assertNotSame(one, two); + assertEquals(one.toString(), two.toString()); + assertEquals(one.getColumnQualifier(), two.getColumnQualifier()); + assertEquals(one.getUniqueID(), two.getUniqueID()); + assertEquals(one.getValue(), two.getValue()); + assertEquals(one, two); + + assertEquals(one, one); + assertEquals(two, two); + } + + @Nested + class ValidateFilePath { + + @Test + public void testValidPaths() { + Path validPath = Path.of(validHost.toString(), validUUID.toString()); + Path validPath2 = Path.of("dir1", validPath.toString()); + Path validPath3 = Path.of("dir2", validPath2.toString()); + + Stream.of(validPath, validPath2, validPath3).map(Path::toString) + .forEach(validFilePath -> assertDoesNotThrow(() -> new LogEntry(1L, validFilePath))); + } + + @Test + public void testBadPathLength() { + List<String> badFilePaths = List.of("foo", "", validHost.toString()); + + for (String badFilePath : badFilePaths) { + IllegalArgumentException iae = + assertThrows(IllegalArgumentException.class, () -> new LogEntry(1L, badFilePath)); + assertTrue(iae.getMessage().contains("The path should at least contain tserver/UUID.")); + } + } + + @Test + public void testInvalidHostPort() { + final String badHostAndPort = "default:badPort"; + final Path badFilepathHostPort = Path.of(badHostAndPort, validUUID.toString()); + + IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, + () -> new LogEntry(1L, badFilepathHostPort.toString())); + assertTrue( + iae.getMessage().contains("Expected format: host:port. Found '" + badHostAndPort + "'")); + } + + @Test + public void testInvalidUUID() { + final String badUUID = "badUUID"; + String filePathWithBadUUID = Path.of(validHost.toString(), badUUID).toString(); + + IllegalArgumentException iae = + assertThrows(IllegalArgumentException.class, () -> new LogEntry(1L, filePathWithBadUUID)); + assertTrue(iae.getMessage().contains("Expected valid UUID. Found '" + badUUID + "'")); + } } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java index 735ce2eeef..d35a11cfe3 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java @@ -88,14 +88,14 @@ public class VolumeUtil { } private static LogEntry switchVolumes(LogEntry le, List<Pair<Path,Path>> replacements) { - Path switchedPath = switchVolume(new Path(le.filename), FileType.WAL, replacements); + Path switchedPath = switchVolume(new Path(le.getFilePath()), FileType.WAL, replacements); String switchedString; int numSwitched = 0; if (switchedPath != null) { switchedString = switchedPath.toString(); numSwitched++; } else { - switchedString = le.filename; + switchedString = le.getFilePath(); } if (numSwitched == 0) { @@ -155,8 +155,8 @@ public class VolumeUtil { logsToRemove.add(logEntry); logsToAdd.add(switchedLogEntry); ret.logEntries.add(switchedLogEntry); - log.debug("Replacing volume {} : {} -> {}", extent, logEntry.filename, - switchedLogEntry.filename); + log.debug("Replacing volume {} : {} -> {}", extent, logEntry.getFilePath(), + switchedLogEntry.getFilePath()); } else { ret.logEntries.add(logEntry); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/manager/state/MetaDataStateStore.java b/server/base/src/main/java/org/apache/accumulo/server/manager/state/MetaDataStateStore.java index 8c7bc888eb..9a4d166f83 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/manager/state/MetaDataStateStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/manager/state/MetaDataStateStore.java @@ -123,7 +123,7 @@ class MetaDataStateStore implements TabletStateStore { List<Path> logs = logsForDeadServers.get(tls.current.getServerInstance()); if (logs != null) { for (Path log : logs) { - LogEntry entry = new LogEntry(tls.extent, 0, log.toString()); + LogEntry entry = new LogEntry(0, log.toString()); tabletMutator.putWal(entry); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/manager/state/ZooTabletStateStore.java b/server/base/src/main/java/org/apache/accumulo/server/manager/state/ZooTabletStateStore.java index af83f61225..5ea3e8ac15 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/manager/state/ZooTabletStateStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/manager/state/ZooTabletStateStore.java @@ -98,8 +98,8 @@ class ZooTabletStateStore implements TabletStateStore { List<Collection<String>> logs = new ArrayList<>(); rootMeta.getLogs().forEach(logEntry -> { - logs.add(Collections.singleton(logEntry.filename)); - log.debug("root tablet log {}", logEntry.filename); + logs.add(Collections.singleton(logEntry.getFilePath())); + log.debug("root tablet log {}", logEntry.getFilePath()); }); return new TabletLocationState(RootTable.EXTENT, futureSession, currentSession, @@ -176,8 +176,7 @@ class ZooTabletStateStore implements TabletStateStore { List<Path> logs = logsForDeadServers.get(futureOrCurrent); if (logs != null) { for (Path entry : logs) { - LogEntry logEntry = - new LogEntry(RootTable.EXTENT, System.currentTimeMillis(), entry.toString()); + LogEntry logEntry = new LogEntry(System.currentTimeMillis(), entry.toString()); tabletMutator.putWal(logEntry); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/metadata/TabletMutatorBase.java b/server/base/src/main/java/org/apache/accumulo/server/metadata/TabletMutatorBase.java index e647d34321..73776db9b9 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/metadata/TabletMutatorBase.java +++ b/server/base/src/main/java/org/apache/accumulo/server/metadata/TabletMutatorBase.java @@ -175,14 +175,14 @@ public abstract class TabletMutatorBase implements Ample.TabletMutator { @Override public Ample.TabletMutator putWal(LogEntry logEntry) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); - mutation.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue()); + mutation.put(LogColumnFamily.NAME, logEntry.getColumnQualifier(), logEntry.getValue()); return this; } @Override public Ample.TabletMutator deleteWal(LogEntry logEntry) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); - mutation.putDelete(logEntry.getColumnFamily(), logEntry.getColumnQualifier()); + mutation.putDelete(LogColumnFamily.NAME, logEntry.getColumnQualifier()); return this; } diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java b/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java index 489c30bb55..2055d793d4 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java @@ -55,7 +55,7 @@ public class ListVolumesUsed { } private static void getLogURIs(TreeSet<String> volumes, LogEntry logEntry) { - volumes.add(getLogURI(logEntry.filename)); + volumes.add(getLogURI(logEntry.getFilePath())); } private static void listTable(Ample.DataLevel level, ServerContext context) throws Exception { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java index 8795a1b28d..08c6ca9caf 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java @@ -1102,10 +1102,10 @@ public class TabletServer extends AbstractServer implements TabletHostingServer Set<String> tabletFiles, MutationReceiver mutationReceiver) throws IOException { List<Path> recoveryDirs = new ArrayList<>(); List<LogEntry> sorted = new ArrayList<>(logEntries); - sorted.sort((e1, e2) -> (int) (e1.timestamp - e2.timestamp)); + sorted.sort((e1, e2) -> (int) (e1.getTimestamp() - e2.getTimestamp())); for (LogEntry entry : sorted) { Path recovery = null; - Path finished = RecoveryPath.getRecoveryPath(new Path(entry.filename)); + Path finished = RecoveryPath.getRecoveryPath(new Path(entry.getFilePath())); finished = SortedLogState.getFinishedMarkerPath(finished); TabletServer.log.debug("Looking for " + finished); if (fs.exists(finished)) { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index fa1f4c50a8..fc373ae30c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -370,7 +370,7 @@ public class Tablet extends TabletBase { currentLogs = new HashSet<>(); for (LogEntry logEntry : logEntries) { currentLogs.add(new DfsLogger(tabletServer.getContext(), tabletServer.getServerConfig(), - logEntry.filename, logEntry.getColumnQualifier().toString())); + logEntry.getFilePath(), logEntry.getColumnQualifier().toString())); } rebuildReferencedLogs(); diff --git a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java index 87e931b637..d89b77fb00 100644 --- a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java +++ b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java @@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.TableId; -import org.apache.accumulo.core.dataImpl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.security.Authorizations; @@ -138,8 +137,7 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase { TableId tableId = TableId.of(client.tableOperations().tableIdMap().get(tableName)); assertNotNull(tableId, "Table ID was null"); - LogEntry logEntry = - new LogEntry(new KeyExtent(tableId, null, null), 0, emptyWalog.toURI().toString()); + LogEntry logEntry = new LogEntry(0, emptyWalog.toURI().toString()); log.info("Taking {} offline", tableName); client.tableOperations().offline(tableName, true); @@ -148,7 +146,8 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase { Text row = TabletsSection.encodeRow(tableId, null); Mutation m = new Mutation(row); - m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue()); + m.put(TabletsSection.LogColumnFamily.NAME, logEntry.getColumnQualifier(), + logEntry.getValue()); try (BatchWriter bw = client.createBatchWriter(MetadataTable.NAME)) { bw.addMutation(m); @@ -197,7 +196,7 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase { TableId tableId = TableId.of(client.tableOperations().tableIdMap().get(tableName)); assertNotNull(tableId, "Table ID was null"); - LogEntry logEntry = new LogEntry(null, 0, partialHeaderWalog.toURI().toString()); + LogEntry logEntry = new LogEntry(0, partialHeaderWalog.toURI().toString()); log.info("Taking {} offline", tableName); client.tableOperations().offline(tableName, true); @@ -206,7 +205,8 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase { Text row = TabletsSection.encodeRow(tableId, null); Mutation m = new Mutation(row); - m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue()); + m.put(TabletsSection.LogColumnFamily.NAME, logEntry.getColumnQualifier(), + logEntry.getValue()); try (BatchWriter bw = client.createBatchWriter(MetadataTable.NAME)) { bw.addMutation(m); diff --git a/test/src/main/java/org/apache/accumulo/test/manager/MergeStateIT.java b/test/src/main/java/org/apache/accumulo/test/manager/MergeStateIT.java index 1a6252b75e..c5bb29710a 100644 --- a/test/src/main/java/org/apache/accumulo/test/manager/MergeStateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/manager/MergeStateIT.java @@ -41,6 +41,7 @@ import org.apache.accumulo.core.metadata.TServerInstance; import org.apache.accumulo.core.metadata.TabletLocationState; import org.apache.accumulo.core.metadata.schema.Ample.DataLevel; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.CurrentLocationColumnFamily; +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily; import org.apache.accumulo.core.metadata.schema.TabletMetadata.Location; import org.apache.accumulo.core.security.Authorizations; @@ -201,9 +202,9 @@ public class MergeStateIT extends ConfigurableMacBase { // Add a walog which should keep the state from transitioning to MERGING KeyExtent ke = new KeyExtent(tableId, new Text("t"), new Text("p")); m = new Mutation(ke.toMetaRow()); - LogEntry logEntry = new LogEntry(ke, 100, "f1"); - m.at().family(logEntry.getColumnFamily()).qualifier(logEntry.getColumnQualifier()) - .timestamp(logEntry.timestamp).put(logEntry.getValue()); + LogEntry logEntry = new LogEntry(100, "f1"); + m.at().family(LogColumnFamily.NAME).qualifier(logEntry.getColumnQualifier()) + .timestamp(logEntry.getTimestamp()).put(logEntry.getValue()); update(accumuloClient, m); // Verify state is still WAITING_FOR_OFFLINE @@ -213,7 +214,7 @@ public class MergeStateIT extends ConfigurableMacBase { // Delete the walog which will now allow a transition to MERGING m = new Mutation(ke.toMetaRow()); - m.putDelete(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.timestamp); + m.putDelete(LogColumnFamily.NAME, logEntry.getColumnQualifier(), logEntry.getTimestamp()); update(accumuloClient, m); // now we can split