Skip to content

Commit 40e4a02

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

7 files changed

Lines changed: 481 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: 6 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,22 @@ 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(rowKey, element.getValue().listCells(), mutations, snapshotName);
367363

368364
if (!logAndSkipIncompatibleRowMutations && mutations.size() > 0) {
369365
outputReceiver.output(KV.of(targetTable, mutations));
370366
}
371367
}
372368

373369
private boolean verifyRowMutationThresholds(
374-
byte[] rowKey, List<Cell> cells, List<Mutation> mutations) throws IOException {
370+
byte[] rowKey, List<Cell> cells, List<Mutation> mutations, String snapshotName) throws IOException {
375371
boolean logAndSkipIncompatibleRows = false;
376372

377373
Put put = null;
@@ -384,9 +380,8 @@ private boolean verifyRowMutationThresholds(
384380

385381
// handle large cells
386382
if (filterLargeCells && cell.getValueLength() > filterLargeCellThresholdBytes) {
387-
// TODO add config name in log
388383
LOG.warn(
389-
"Dropping mutation, cell value length, "
384+
"For snapshot " + snapshotName + ": Dropping mutation, cell value length, "
390385
+ cell.getValueLength()
391386
+ ", exceeds filter length, "
392387
+ filterLargeCellThresholdBytes
@@ -407,23 +402,21 @@ private boolean verifyRowMutationThresholds(
407402
cellCount++;
408403
}
409404

410-
// TODO add config name in log
411405
if (filterLargeRows && totalByteSize > filterLargeRowThresholdBytes) {
412406
logAndSkipIncompatibleRows = true;
413407
LOG.warn(
414-
"Dropping row, row length, "
408+
"For snapshot " + snapshotName + ": Dropping row, row length, "
415409
+ totalByteSize
416410
+ ", exceeds filter length threshold, "
417411
+ filterLargeRowThresholdBytes
418412
+ ", row key: "
419413
+ Bytes.toStringBinary(rowKey));
420414
}
421415

422-
// TODO add config name in log
423416
if (filterLargeRowKeys && rowKey.length > filterLargeRowKeysThresholdBytes) {
424417
logAndSkipIncompatibleRows = true;
425418
LOG.warn(
426-
"Dropping row, row key length, "
419+
"For snapshot " + snapshotName + ": Dropping row, row key length, "
427420
+ rowKey.length
428421
+ ", exceeds filter length threshold, "
429422
+ 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)