Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1k
PHOENIX-6200 Add counters for extra index rows, log results to PIT and PIT_RESULT table#995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -91,6 +91,11 @@ public IndexRepairRegionScanner(final RegionScanner innerScanner, | ||
| } | ||
| } | ||
| @Override | ||
| public byte[] getDataTableName() { | ||
| return dataHTable.getName().toBytes(); | ||
| } | ||
| public void prepareExpectedIndexMutations(Result dataRow, Map<byte[], List<Mutation>> expectedIndexMutationMap) throws IOException { | ||
| Put put = null; | ||
| Delete del = null; | ||
| @@ -178,6 +183,28 @@ private Map<byte[], List<Mutation>> populateActualIndexMutationMap(Map<byte[], L | ||
| return actualIndexMutationMap; | ||
| } | ||
| private Map<byte[], List<Mutation>> populateActualIndexMutationMap() throws IOException { | ||
| Map<byte[], List<Mutation>> actualIndexMutationMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); | ||
| Scan indexScan = new Scan(); | ||
| indexScan.setTimeRange(scan.getTimeRange().getMin(), scan.getTimeRange().getMax()); | ||
| indexScan.setRaw(true); | ||
| indexScan.setMaxVersions(); | ||
| indexScan.setCacheBlocks(false); | ||
| try (RegionScanner regionScanner = region.getScanner(indexScan)) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the below code work if there is no index row? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gokceni I am not sure I understood your concern here ? Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the index is truncated for some reason and this code is run, the below do while code, will it work since you seem to be checking the hasMore in the while part of the loop? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gokceni hasMore will be false in that case and the code should exit the loop. This is a standard pattern used in multiple places in the index rebuild code. | ||
| do { | ||
| ungroupedAggregateRegionObserver.checkForRegionClosing(); | ||
| List<Cell> row = new ArrayList<Cell>(); | ||
| hasMore = regionScanner.nextRaw(row); | ||
| if (!row.isEmpty()) { | ||
| populateIndexMutationFromIndexRow(row, actualIndexMutationMap); | ||
| } | ||
| } while (hasMore); | ||
| } catch (Throwable t) { | ||
| ServerUtil.throwIOException(region.getRegionInfo().getRegionNameAsString(), t); | ||
| } | ||
| return actualIndexMutationMap; | ||
| } | ||
| private void repairAndOrVerifyIndexRows(Set<byte[]> dataRowKeys, | ||
| Map<byte[], List<Mutation>> actualIndexMutationMap, | ||
| IndexToolVerificationResult verificationResult) throws IOException { | ||
| @@ -188,7 +215,7 @@ private void repairAndOrVerifyIndexRows(Set<byte[]> dataRowKeys, | ||
| return; | ||
| } | ||
| if (verifyType == IndexTool.IndexVerifyType.ONLY) { | ||
| verifyIndexRows(actualIndexMutationMap, expectedIndexMutationMap, Collections.EMPTY_SET, Collections.EMPTY_LIST, verificationResult.getBefore(), true); | ||
| verifyIndexRows(actualIndexMutationMap, expectedIndexMutationMap, Collections.EMPTY_SET, indexRowsToBeDeleted, verificationResult.getBefore(), true); | ||
| return; | ||
| } | ||
| if (verifyType == IndexTool.IndexVerifyType.BEFORE) { | ||
| @@ -200,11 +227,12 @@ private void repairAndOrVerifyIndexRows(Set<byte[]> dataRowKeys, | ||
| } | ||
| if (verifyType == IndexTool.IndexVerifyType.AFTER) { | ||
| repairIndexRows(expectedIndexMutationMap, Collections.EMPTY_LIST, verificationResult); | ||
| verifyIndexRows(actualIndexMutationMap, expectedIndexMutationMap, Collections.EMPTY_SET, Collections.EMPTY_LIST, verificationResult.getAfter(), false); | ||
| actualIndexMutationMap = populateActualIndexMutationMap(); | ||
| verifyIndexRows(actualIndexMutationMap, expectedIndexMutationMap, Collections.EMPTY_SET, indexRowsToBeDeleted, verificationResult.getAfter(), false); | ||
| return; | ||
| } | ||
| if (verifyType == IndexTool.IndexVerifyType.BOTH) { | ||
| verifyIndexRows(actualIndexMutationMap,expectedIndexMutationMap, Collections.EMPTY_SET, indexRowsToBeDeleted, verificationResult.getBefore(), true); | ||
| verifyIndexRows(actualIndexMutationMap,expectedIndexMutationMap, Collections.EMPTY_SET, indexRowsToBeDeleted, verificationResult.getBefore(), true); | ||
| if (!expectedIndexMutationMap.isEmpty() || !indexRowsToBeDeleted.isEmpty()) { | ||
| repairIndexRows(expectedIndexMutationMap, indexRowsToBeDeleted, verificationResult); | ||
| } | ||
| @@ -215,6 +243,7 @@ private void repairAndOrVerifyIndexRows(Set<byte[]> dataRowKeys, | ||
| } | ||
| } | ||
| private void addRepairAndOrVerifyTask(TaskBatch<Boolean> tasks, | ||
| final Set<byte[]> dataRowKeys, | ||
| final Map<byte[], List<Mutation>> actualIndexMutationMap, | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.