Copilot commented on code in PR #6790:
URL: https://github.com/apache/hbase/pull/6790#discussion_r2177736729
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/SnapshotProcedure.java:
##########
@@ -144,12 +145,15 @@ protected Flow executeFromState(MasterProcedureEnv env,
SnapshotState state)
setNextState(SnapshotState.SNAPSHOT_WRITE_SNAPSHOT_INFO);
return Flow.HAS_MORE_STATE;
case SNAPSHOT_WRITE_SNAPSHOT_INFO:
- SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, workingDir,
workingDirFS);
TableState tableState =
env.getMasterServices().getTableStateManager().getTableState(snapshotTable);
if (tableState.isEnabled()) {
+ SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, workingDir,
workingDirFS);
setNextState(SnapshotState.SNAPSHOT_SNAPSHOT_ONLINE_REGIONS);
} else if (tableState.isDisabled()) {
+ // Set the snapshot type to DISABLED as the table is in DISABLED
state
+ snapshot = snapshot.toBuilder().setType(Type.DISABLED).build();
+ SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, workingDir,
workingDirFS);
setNextState(SnapshotState.SNAPSHOT_SNAPSHOT_CLOSED_REGIONS);
}
Review Comment:
[nitpick] Consider refactoring the duplicated call to
SnapshotDescriptionUtils.writeSnapshotInfo, which appears in both the enabled
and disabled branches, into a single invocation after determining the correct
snapshot type.
```suggestion
setNextState(SnapshotState.SNAPSHOT_SNAPSHOT_ONLINE_REGIONS);
} else if (tableState.isDisabled()) {
// Set the snapshot type to DISABLED as the table is in DISABLED
state
snapshot = snapshot.toBuilder().setType(Type.DISABLED).build();
setNextState(SnapshotState.SNAPSHOT_SNAPSHOT_CLOSED_REGIONS);
}
SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, workingDir,
workingDirFS);
```
--
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]