Ich möchte einen neuen Schlüssel-Wert für die aktuelle Zeile in BaseRegionObserver.postBatchMutate, aber ich steckte in MVCC und ein Deadlock auftritt. Hier ist mein Code:in Coprozessor setzen postBatchMutate
@Override
public void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
for (int i = 0 ; i < miniBatchOp.size(); i ++) {
Put put = null;
Mutation op = miniBatchOp.getOperation(i);
if (! (op instanceof Put))
continue;
put = (Put) miniBatchOp.getOperation(0);
if (put.has(Bytes.toBytes("m"), Bytes.toBytes("id")))
return;
Put put1 = new Put(put.getRow());
put1.addColumn(Bytes.toBytes("m"), Bytes.toBytes("id"),
Bytes.toBytes(String.valueOf(UUID.randomUUID())));
c.getEnvironment().getRegion().put(put1);
}
}
können Sie finden diese in der Ausgabe WARN Nachricht wiederholen:
regionserver.MultiVersionConcurrencyControl WARNEN: STUCK: MultiVersionConcurrencyControl {readPoint = 3, writePoint = 5}
Mein Problem war auf postBatchMutate. Es scheint, dass ich mit postPut kein Problem habe. – Malemi