MCPcopy Create free account
hub / github.com/e2wugui/zeze / recoverSplitting

Method recoverSplitting

ZezeJava/ZezeJava/src/main/java/Zeze/Dbh2/Dbh2.java:488–508  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

486 }
487
488 private void recoverSplitting() throws Exception {
489 if (!raft.isLeader())
490 return;
491
492 stateMachine.setLoadSwitch(true);
493 var bucket = stateMachine.getBucket();
494 if (null != bucket.getSplittingMeta()) {
495 var bucketKeyFirst = bucket.getSplittingMeta().getKeyFirst();
496 boolean isMove = bucketKeyFirst.size() == 0; // keyFirst 为空肯定是move
497 if (!isMove) {
498 // keyFirst不为空,还不能确认就是split,需要进一步判断keyFirst确实是第一条数据。
499 try (var it = bucket.getData().iterator()) {
500 it.seekToFirst();
501 // keyFirst 就是第一条数据,那么当前还是move。
502 //noinspection EqualsBetweenInconvertibleTypes
503 isMove = it.isValid() && bucketKeyFirst.equals(it.key());
504 }
505 }
506 startSplit(isMove);
507 }
508 }
509
510 private volatile long splitSerialNo;
511 private volatile Dbh2Agent dbh2Splitting;

Callers 1

onCommitBatchMethod · 0.95

Calls 12

startSplitMethod · 0.95
setLoadSwitchMethod · 0.80
getBucketMethod · 0.80
getSplittingMetaMethod · 0.80
isValidMethod · 0.80
getKeyFirstMethod · 0.65
sizeMethod · 0.65
getDataMethod · 0.65
equalsMethod · 0.65
keyMethod · 0.65
isLeaderMethod · 0.45
iteratorMethod · 0.45

Tested by

no test coverage detected