Skip to content

Commit af3976d

Browse files
committed
comment and file cleanup
1 parent 958c187 commit af3976d

7 files changed

Lines changed: 489 additions & 19 deletions

File tree

bigtable-dataflow-parent/bigtable-beam-import/src/main/java/com/google/cloud/bigtable/beam/hbasesnapshots/ImportJobFromHbaseSnapshot.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ static Pipeline buildPipelineWithMultipleSnapshots(
333333
return pipeline;
334334
}
335335
// Read records from hbase region files and write to Bigtable
336-
// PCollection<RegionConfig> hbaseRecords = restoredSnapshots
337-
// .apply("List Regions", new ListRegions());
338336
PCollection<KV<String, Iterable<Mutation>>> hbaseRecords =
339337
restoredSnapshots
340338
.apply("List Regions", new ListRegions())

bigtable-dataflow-parent/bigtable-beam-import/src/main/java/com/google/cloud/bigtable/beam/hbasesnapshots/SnapshotUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ public static Map<String, String> getSnapshotsFromSnapshotPath(
264264
// Build GCS path from given string e.g:
265265
// gs://sym-bucket/snapshots/20220309230526/.hbase-snapshot
266266
GcsPath gcsPath = GcsPath.fromUri(importSnapshotpath);
267-
// LOG.info("GCS Path:" + gcsPath + ";Object:" + gcsPath.getObject());
268267
Map<String, String> snapshots = new HashMap<>();
269268

270269
List<StorageObject> objects =

bigtable-dataflow-parent/bigtable-beam-import/src/main/java/com/google/cloud/bigtable/beam/hbasesnapshots/conf/SnapshotConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public static Builder builder() {
3838

3939
public abstract String getSourceLocation();
4040

41-
// public abstract Path getSourcePath();
4241
@Memoized
4342
public Path getSourcePath() {
4443
return new Path(getSourceLocation());

bigtable-dataflow-parent/bigtable-beam-import/src/main/java/com/google/cloud/bigtable/beam/hbasesnapshots/transforms/ListRegions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private Map<Long, Long> computeRegionSize(SnapshotManifest snapshotManifest) {
6767
regionsSize.put(regionManifest.getRegionInfo().getRegionId(), totalSize);
6868
}
6969

70-
return regionsSize; // (int)Math.ceil((totalSize * 1.0)/GIGA_BYTE);
70+
return regionsSize;
7171
}
7272

7373
/**

bigtable-dataflow-parent/bigtable-beam-import/src/main/java/com/google/cloud/bigtable/beam/hbasesnapshots/transforms/ReadRegions.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package com.google.cloud.bigtable.beam.hbasesnapshots.transforms;
1717

18-
// import com.google.cloud.bigtable.beam.hbasesnapshots.ImportSnapshots;
19-
2018
import com.google.api.core.InternalApi;
2119
import com.google.cloud.bigtable.beam.hbasesnapshots.conf.RegionConfig;
2220
import com.google.cloud.bigtable.beam.hbasesnapshots.conf.SnapshotConfig;
@@ -189,17 +187,14 @@ public void processElement(
189187
boolean hasSplit = false;
190188
try (HBaseRegionScanner scanner = newScanner(regionConfig, tracker.currentRestriction())) {
191189
for (Result result = scanner.next(); result != null; result = scanner.next()) {
192-
// if (flag==0 ) {
193190
if (tracker.tryClaim(ByteKey.copyFrom(result.getRow()))) {
194191
outputReceiver.output(KV.of(regionConfig.getSnapshotConfig(), result));
195192
} else {
196193
hasSplit = true;
197194
break;
198195
}
199-
// }
200196
}
201197
}
202-
// if (!hasSplit)
203198
tracker.tryClaim(ByteKey.EMPTY);
204199
}
205200

@@ -357,21 +352,24 @@ public void processElement(
357352
throws IOException {
358353
if (element.getValue().listCells().isEmpty()) return;
359354
String targetTable = element.getKey().getTableName();
355+
String snapshotName = element.getKey().getSnapshotName();
360356

361357
// Limit the number of mutations per Put (server will reject >= 100k mutations per Put)
362358
byte[] rowKey = element.getValue().getRow();
363359
List<Mutation> mutations = new ArrayList<>();
364360

365361
boolean logAndSkipIncompatibleRowMutations =
366-
verifyRowMutationThresholds(rowKey, element.getValue().listCells(), mutations);
362+
verifyRowMutationThresholds(
363+
rowKey, element.getValue().listCells(), mutations, snapshotName);
367364

368365
if (!logAndSkipIncompatibleRowMutations && mutations.size() > 0) {
369366
outputReceiver.output(KV.of(targetTable, mutations));
370367
}
371368
}
372369

373370
private boolean verifyRowMutationThresholds(
374-
byte[] rowKey, List<Cell> cells, List<Mutation> mutations) throws IOException {
371+
byte[] rowKey, List<Cell> cells, List<Mutation> mutations, String snapshotName)
372+
throws IOException {
375373
boolean logAndSkipIncompatibleRows = false;
376374

377375
Put put = null;
@@ -384,9 +382,10 @@ private boolean verifyRowMutationThresholds(
384382

385383
// handle large cells
386384
if (filterLargeCells && cell.getValueLength() > filterLargeCellThresholdBytes) {
387-
// TODO add config name in log
388385
LOG.warn(
389-
"Dropping mutation, cell value length, "
386+
"For snapshot "
387+
+ snapshotName
388+
+ ": Dropping mutation, cell value length, "
390389
+ cell.getValueLength()
391390
+ ", exceeds filter length, "
392391
+ filterLargeCellThresholdBytes
@@ -407,23 +406,25 @@ private boolean verifyRowMutationThresholds(
407406
cellCount++;
408407
}
409408

410-
// TODO add config name in log
411409
if (filterLargeRows && totalByteSize > filterLargeRowThresholdBytes) {
412410
logAndSkipIncompatibleRows = true;
413411
LOG.warn(
414-
"Dropping row, row length, "
412+
"For snapshot "
413+
+ snapshotName
414+
+ ": Dropping row, row length, "
415415
+ totalByteSize
416416
+ ", exceeds filter length threshold, "
417417
+ filterLargeRowThresholdBytes
418418
+ ", row key: "
419419
+ Bytes.toStringBinary(rowKey));
420420
}
421421

422-
// TODO add config name in log
423422
if (filterLargeRowKeys && rowKey.length > filterLargeRowKeysThresholdBytes) {
424423
logAndSkipIncompatibleRows = true;
425424
LOG.warn(
426-
"Dropping row, row key length, "
425+
"For snapshot "
426+
+ snapshotName
427+
+ ": Dropping row, row key length, "
427428
+ rowKey.length
428429
+ ", exceeds filter length threshold, "
429430
+ filterLargeRowKeysThresholdBytes

bigtable-dataflow-parent/bigtable-beam-import/src/test/java/com/google/cloud/bigtable/beam/hbasesnapshots/SnapshotUtilsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public void testgetSubSetSnapshotsFromSnapshotPath() throws IOException {
225225
getMatchingSnapshotsFromSnapshotPath(snapshotList, ".*attachments.*");
226226
List<String> expectedResult =
227227
snapshotList.stream().filter(e -> e.contains("attachments")).collect(Collectors.toList());
228-
// LOG.info("Matched:{} and expected:{}", snapshots.size(), expectedResult.size());
229228
assertThat(snapshots.size(), is(equalTo(expectedResult.size())));
230229
assertThat(snapshots.keySet(), containsInAnyOrder(expectedResult.toArray(new String[0])));
231230
}

0 commit comments

Comments
 (0)