ctubbsii commented on code in PR #3954:
URL: https://github.com/apache/accumulo/pull/3954#discussion_r1402539351
##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java:
##########
@@ -84,111 +91,102 @@ public void upgradeZookeeper(@NonNull ServerContext
context) {
public void upgradeRoot(@NonNull ServerContext context) {
log.debug("Upgrade root: upgrading to data version {}",
METADATA_FILE_JSON_ENCODING);
var rootName = Ample.DataLevel.METADATA.metaTable();
- processReferences(context, rootName);
+ // not using ample to avoid StoredTabletFile because old file ref is
incompatible
+ try (AccumuloClient c =
Accumulo.newClient().from(context.getProperties()).build();
+ BatchWriter batchWriter = c.createBatchWriter(rootName); Scanner
scanner =
Review Comment:
context is already an an instance of AccumuloClient. You don't need to
create a new one. I see this is an issue with the existing upgrader code prior
to this PR, but it should still be fixed. Funny thing is that the scanner is
already created this way.
```suggestion
try (var batchWriter = context.createBatchWriter(rootName); var scanner =
```
##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java:
##########
@@ -84,111 +91,102 @@ public void upgradeZookeeper(@NonNull ServerContext
context) {
public void upgradeRoot(@NonNull ServerContext context) {
log.debug("Upgrade root: upgrading to data version {}",
METADATA_FILE_JSON_ENCODING);
var rootName = Ample.DataLevel.METADATA.metaTable();
- processReferences(context, rootName);
+ // not using ample to avoid StoredTabletFile because old file ref is
incompatible
+ try (AccumuloClient c =
Accumulo.newClient().from(context.getProperties()).build();
+ BatchWriter batchWriter = c.createBatchWriter(rootName); Scanner
scanner =
+ new IsolatedScanner(context.createScanner(rootName,
Authorizations.EMPTY))) {
+ processReferences(batchWriter, scanner, rootName);
+ } catch (TableNotFoundException ex) {
+ throw new IllegalStateException("Failed to find table " + rootName, ex);
+ } catch (MutationsRejectedException mex) {
+ log.warn("Failed to update reference for table: " + rootName);
+ log.warn("Constraint violations: {}",
mex.getConstraintViolationSummaries());
+ throw new IllegalStateException("Failed to process table: " + rootName,
mex);
+ }
}
@Override
public void upgradeMetadata(@NonNull ServerContext context) {
log.debug("Upgrade metadata: upgrading to data version {}",
METADATA_FILE_JSON_ENCODING);
var metaName = Ample.DataLevel.USER.metaTable();
- processReferences(context, metaName);
+ try (AccumuloClient c =
Accumulo.newClient().from(context.getProperties()).build();
+ BatchWriter batchWriter = c.createBatchWriter(metaName); Scanner
scanner =
Review Comment:
```suggestion
try (var batchWriter = context.createBatchWriter(metaName); var scanner =
```
--
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]