-
Notifications
You must be signed in to change notification settings - Fork 1k
PHOENIX-7751 : [SyncTable Tool] Feature to validate table data using PhoenixSyncTable tool b/w source and target cluster #2379
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
3c54c86
connection creation time
c97f7e0
Revert "connection creation time"
53e9a3b
Revert "Revert "connection creation time""
6b75fec
Merge remote-tracking branch 'upstream/master'
6f40ab4
Merge remote-tracking branch 'upstream/master'
7328f93
Merge remote-tracking branch 'upstream/master'
fd46404
ITs changes
58ef6a9
Revert "ITs changes"
6f226f6
Merge remote-tracking branch 'upstream/master'
1ccf4b6
PHOENIX-7751 : [SyncTable Tool] Feature to validate table data using …
e75c6c1
revert other changes
a5060ab
checkstyle fix
cffd2e6
checkstyle fix
2ef30e6
checkstyle fix
dd18dae
adding more ITs
326e792
adding more ITs
b7127cc
misc fix
f588291
code comment
f81aa56
code comment formatting
d60104f
Adding all UT/ITs
359f345
Fix tests
1bcd693
Fix tests
7904c50
Merge remote-tracking branch 'upstream/master' into PHOENIX-7751
b9dfd3c
PhoenixConfigurationUtilTest
6c50f95
Fix build issues
b8c00e4
Some More UTs
d54f970
Address review comments
a951251
Address review comments
6daafa2
address suggestion
05cf3da
Address review comments
9aed71c
Fix tests
050e3ed
spotless apply
0dccd70
remove max size check
a0014a9
fix timeout
e9c0c35
add column encoding
9517708
add compression and TTL attribute
0a9c2ab
fix checkstyle
7083d81
address comment
011f681
add test case
eb5ce88
fix check
b56415c
fix check
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
phoenix-core-client/src/main/java/org/apache/phoenix/util/SHA256DigestUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.phoenix.util; | ||
|
|
||
| import java.io.IOException; | ||
| import org.bouncycastle.crypto.digests.SHA256Digest; | ||
|
|
||
| /** | ||
| * Utility class for SHA-256 digest state serialization and deserialization. We are not using jdk | ||
| * bundled SHA, since their digest can't be serialized/deserialized which is needed for | ||
| * PhoenixSyncTableTool for cross-region hash continuation. | ||
| */ | ||
| public class SHA256DigestUtil { | ||
|
|
||
| private SHA256DigestUtil() { | ||
| } | ||
|
|
||
| /** | ||
| * Encodes a SHA256Digest state to a byte array. | ||
| * @param digest The digest whose state should be encoded | ||
| * @return Byte array containing the raw BouncyCastle encoded state | ||
| */ | ||
| public static byte[] encodeDigestState(SHA256Digest digest) { | ||
| return digest.getEncodedState(); | ||
| } | ||
|
haridsv marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Decodes a SHA256Digest state from a byte array. | ||
| * @param encodedState Byte array containing BouncyCastle encoded digest state | ||
| * @return SHA256Digest restored to the saved state | ||
| * @throws IOException if state is invalid, corrupted | ||
| */ | ||
| public static SHA256Digest decodeDigestState(byte[] encodedState) throws IOException { | ||
| if (encodedState == null || encodedState.length == 0) { | ||
| throw new IllegalArgumentException( | ||
| "Invalid encoded digest state: encodedState is null or empty"); | ||
| } | ||
| return new SHA256Digest(encodedState); | ||
| } | ||
|
|
||
| /** | ||
| * Decodes a digest state and finalizes it to produce the SHA-256 checksum. | ||
| * @param encodedState Serialized BouncyCastle digest state | ||
| * @return 32-byte SHA-256 hash | ||
| * @throws IOException if state decoding fails | ||
| */ | ||
| public static byte[] finalizeDigestToChecksum(byte[] encodedState) throws IOException { | ||
| SHA256Digest digest = decodeDigestState(encodedState); | ||
| return finalizeDigestToChecksum(digest); | ||
| } | ||
|
|
||
| /** | ||
| * Finalizes a SHA256Digest to produce the final checksum. | ||
| * @param digest The digest to finalize | ||
| * @return 32-byte SHA-256 hash | ||
| */ | ||
| public static byte[] finalizeDigestToChecksum(SHA256Digest digest) { | ||
| byte[] hash = new byte[digest.getDigestSize()]; | ||
| digest.doFinal(hash, 0); | ||
| return hash; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all of these instead be named SYNC_TOOL ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used SyncTableTool for user facing class/config. For others, I have used SyncTable, are you recommending to move all Classes and config to SyncTool instead of SyncTable i.e PhoenixSyncTableRegionScanner -> PhoenixSyncToolRegionScanner ?
I felt SyncTable is more self explainable compared to SyncTool, we can also change it to SyncTableTool at all places ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Its okay. Not a big deal. We can stick with the same naming convention.