@@ -166,23 +166,21 @@ Multimap<TableName, String> getSnapshotsToComputeSize() throws IOException {
166
166
Set <TableName > tablesToFetchSnapshotsFrom = new HashSet <>();
167
167
QuotaFilter filter = new QuotaFilter ();
168
168
filter .addTypeFilter (QuotaType .SPACE );
169
- try (Admin admin = conn .getAdmin ()) {
169
+ try (Admin admin = conn .getAdmin (); QuotaRetriever qr = new QuotaRetriever ( conn , filter ) ) {
170
170
// Pull all of the tables that have quotas (direct, or from namespace)
171
- try (QuotaRetriever qr = new QuotaRetriever (conn , filter )) {
172
- for (QuotaSettings qs : qr ) {
173
- if (qs .getQuotaType () == QuotaType .SPACE ) {
174
- String ns = qs .getNamespace ();
175
- TableName tn = qs .getTableName ();
176
- if ((null == ns && null == tn ) || (null != ns && null != tn )) {
177
- throw new IllegalStateException (
178
- "Expected either one of namespace and tablename to be null but not both" );
179
- }
180
- // Collect either the table name itself, or all of the tables in the namespace
181
- if (null != ns ) {
182
- tablesToFetchSnapshotsFrom .addAll (Arrays .asList (admin .listTableNamesByNamespace (ns )));
183
- } else {
184
- tablesToFetchSnapshotsFrom .add (tn );
185
- }
171
+ for (QuotaSettings qs : qr ) {
172
+ if (qs .getQuotaType () == QuotaType .SPACE ) {
173
+ String ns = qs .getNamespace ();
174
+ TableName tn = qs .getTableName ();
175
+ if ((null == ns && null == tn ) || (null != ns && null != tn )) {
176
+ throw new IllegalStateException (
177
+ "Expected either one of namespace and tablename to be null but not both" );
178
+ }
179
+ // Collect either the table name itself, or all of the tables in the namespace
180
+ if (null != ns ) {
181
+ tablesToFetchSnapshotsFrom .addAll (Arrays .asList (admin .listTableNamesByNamespace (ns )));
182
+ } else {
183
+ tablesToFetchSnapshotsFrom .add (tn );
186
184
}
187
185
}
188
186
}
0 commit comments