Skip to content

Commit 9e54d62

Browse files
authored
Fixed error caused during merge of #5355 to main (#5360)
When merging #5355 to main the FILES column ended up not being fetched for the tablet metadata because the Loader.pauseLimit variable had not been set. This variable was set in the call to Loader.start, which happens after the TabletsMetadata is configured
1 parent f09116d commit 9e54d62

File tree

2 files changed

+37
-16
lines changed
  • server/manager/src

2 files changed

+37
-16
lines changed

server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/LoadFiles.java

+16-10
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.List;
3535
import java.util.Map;
3636
import java.util.NoSuchElementException;
37+
import java.util.Objects;
3738
import java.util.Set;
3839
import java.util.concurrent.atomic.AtomicBoolean;
3940
import java.util.stream.Collectors;
@@ -115,7 +116,7 @@ public long isReady(FateId fateId, Manager manager) throws Exception {
115116
try (LoadMappingIterator lmi =
116117
BulkSerialize.getUpdatedLoadMapping(bulkDir.toString(), bulkInfo.tableId, fs::open)) {
117118

118-
Loader loader = new Loader();
119+
Loader loader = new Loader(manager, bulkInfo.tableId);
119120

120121
List<ColumnType> fetchCols = new ArrayList<>(List.of(PREV_ROW, LOCATION, LOADED, TIME));
121122
if (loader.pauseLimit > 0) {
@@ -137,27 +138,32 @@ public Repo<Manager> call(final FateId fateId, final Manager manager) {
137138

138139
// visible for testing
139140
public static class Loader {
140-
protected Path bulkDir;
141-
protected Manager manager;
142-
protected FateId fateId;
143-
protected boolean setTime;
141+
private final Manager manager;
142+
private final long pauseLimit;
143+
144+
private Path bulkDir;
145+
private FateId fateId;
146+
private boolean setTime;
144147
Ample.ConditionalTabletsMutator conditionalMutator;
145148
private Map<KeyExtent,List<TabletFile>> loadingFiles;
146-
147149
private long skipped = 0;
148-
private long pauseLimit;
150+
151+
public Loader(Manager manager, TableId tableId) {
152+
Objects.requireNonNull(manager, "Manager must be supplied");
153+
Objects.requireNonNull(tableId, "Table ID must be supplied");
154+
this.manager = manager;
155+
this.pauseLimit =
156+
manager.getContext().getTableConfiguration(tableId).getCount(Property.TABLE_FILE_PAUSE);
157+
}
149158

150159
void start(Path bulkDir, Manager manager, TableId tableId, FateId fateId, boolean setTime)
151160
throws Exception {
152161
this.bulkDir = bulkDir;
153-
this.manager = manager;
154162
this.fateId = fateId;
155163
this.setTime = setTime;
156164
conditionalMutator = manager.getContext().getAmple().conditionallyMutateTablets();
157165
this.skipped = 0;
158166
this.loadingFiles = new HashMap<>();
159-
this.pauseLimit =
160-
manager.getContext().getTableConfiguration(tableId).getCount(Property.TABLE_FILE_PAUSE);
161167
}
162168

163169
void load(List<TabletMetadata> tablets, Files files) {

server/manager/src/test/java/org/apache/accumulo/manager/tableOps/bulkVer2/LoadFilesTest.java

+21-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.accumulo.core.clientImpl.bulk.Bulk.FileInfo;
3434
import org.apache.accumulo.core.clientImpl.bulk.Bulk.Files;
3535
import org.apache.accumulo.core.clientImpl.bulk.LoadMappingIterator;
36+
import org.apache.accumulo.core.conf.Property;
3637
import org.apache.accumulo.core.data.TableId;
3738
import org.apache.accumulo.core.dataImpl.KeyExtent;
3839
import org.apache.accumulo.core.fate.FateId;
@@ -42,6 +43,8 @@
4243
import org.apache.accumulo.manager.Manager;
4344
import org.apache.accumulo.manager.tableOps.bulkVer2.LoadFiles.ImportTimingStats;
4445
import org.apache.accumulo.manager.tableOps.bulkVer2.LoadFiles.TabletsMetadataFactory;
46+
import org.apache.accumulo.server.ServerContext;
47+
import org.apache.accumulo.server.conf.TableConfiguration;
4548
import org.apache.hadoop.fs.Path;
4649
import org.apache.hadoop.io.Text;
4750
import org.easymock.EasyMock;
@@ -60,6 +63,10 @@ public TestTabletsMetadata(AutoCloseable closeable, Iterable<TabletMetadata> tmi
6063

6164
private static class CaptureLoader extends LoadFiles.Loader {
6265

66+
public CaptureLoader(Manager manager, TableId tableId) {
67+
super(manager, tableId);
68+
}
69+
6370
private static class LoadResult {
6471
private final List<TabletMetadata> tablets;
6572
private final Files files;
@@ -159,19 +166,27 @@ public void testFindOverlappingFiles() {
159166
private Map<String,HashSet<KeyExtent>> runLoadFilesLoad(Map<KeyExtent,String> loadRanges)
160167
throws Exception {
161168

169+
Manager manager = EasyMock.createMock(Manager.class);
170+
ServerContext ctx = EasyMock.createMock(ServerContext.class);
171+
TableConfiguration tconf = EasyMock.createMock(TableConfiguration.class);
172+
173+
EasyMock.expect(manager.getContext()).andReturn(ctx).anyTimes();
174+
EasyMock.expect(ctx.getTableConfiguration(tid)).andReturn(tconf).anyTimes();
175+
EasyMock.expect(tconf.getCount(Property.TABLE_FILE_PAUSE))
176+
.andReturn(Integer.parseInt(Property.TABLE_FILE_PAUSE.getDefaultValue())).anyTimes();
177+
178+
Path bulkDir = EasyMock.createMock(Path.class);
179+
EasyMock.replay(manager, ctx, tconf, bulkDir);
180+
162181
TabletsMetadata tabletMeta = new TestTabletsMetadata(null, tm);
163182
LoadMappingIterator lmi = PrepBulkImportTest.createLoadMappingIter(loadRanges);
164-
CaptureLoader cl = new CaptureLoader();
183+
CaptureLoader cl = new CaptureLoader(manager, tid);
165184
BulkInfo info = new BulkInfo();
166185
TabletsMetadataFactory tmf = (startRow) -> tabletMeta;
167186
FateId txid = FateId.from(FateInstanceType.USER, UUID.randomUUID());
168187

169-
Manager manager = EasyMock.createMock(Manager.class);
170-
Path bulkDir = EasyMock.createMock(Path.class);
171-
EasyMock.replay(manager, bulkDir);
172-
173188
LoadFiles.loadFiles(cl, info, bulkDir, lmi, tmf, manager, txid);
174-
EasyMock.verify(manager, bulkDir);
189+
EasyMock.verify(manager, ctx, tconf, bulkDir);
175190
List<CaptureLoader.LoadResult> results = cl.getLoadResults();
176191
assertEquals(loadRanges.size(), results.size());
177192

0 commit comments

Comments
 (0)