junegunn commented on code in PR #8030:
URL: https://github.com/apache/hbase/pull/8030#discussion_r3212928816
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java:
##########
@@ -302,6 +303,35 @@ private static Path getDefaultWorkingSnapshotDir(final
Path rootDir) {
*/
public static SnapshotDescription validate(SnapshotDescription snapshot,
Configuration conf)
throws IllegalArgumentException, IOException {
+ // Fail fast on the basic invariant before paying the cost of creating a
Connection (which
+ // involves a ZK session and, in Kerberos environments, a TGS request to
the KDC). This also
+ // preserves the prior behavior of this overload, which callers (including
unit tests with
+ // stub Configurations) rely on to throw without performing any I/O.
+ if (!snapshot.hasTable()) {
+ throw new IllegalArgumentException(
+ "Descriptor doesn't apply to a table, so we can't build it.");
+ }
Review Comment:
1. Let's extract the `hasTable` check to avoid duplication.
2. Drop the comment at lines 306-309; it over-explains.
--
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]