Skip to content
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

PHOENIX-4997 Phoenix MR on snapshots can produce duplicate rows #397

Closed
wants to merge 0 commits into from

Conversation

karanmehta93
Copy link
Member

@akshita-malhotra @gjacoby126
Could you please review?


@BeforeClass
public static void doSetup() throws Exception {
Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}

@Test
public void testMapReduceSnapshots() throws Exception {
@Before
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring done to move common code to before method.

conn.commit();
}

public void deleteSnapshot(String tableName) throws Exception {
private void splitTableSync(Admin admin, TableName hbaseTableName,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't use the method provided in BaseTest.java since enabling/disabling the table causes the snapshot manifest file to not contain the offline regions.
The bug is caused because the snapshot manifest file on a regular production table can contain information about regions that are split or offline, which should ideally be ignored when restoring snapshot.

@karanmehta93
Copy link
Member Author

@BinShi-SecularBird

}

// Exclude offline split parent regions
private boolean isValidRegion(RegionInfo hri) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract this to a util since its used in two classes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, however they don't have any classes in common and the implementations of these methods are slightly different. I agree that this is duplicate code and should not exist this way but I couldn't think of a better way for this.

if (inputQuery == null)
inputQuery = selectQuery.toString();

ResultSet rs = DriverManager.getConnection(getUrl(), props).createStatement().executeQuery(inputQuery);

for (List<Object> r : result) {
assertTrue("No data stored in the table!", rs.next());
if (rs.next() == false) {
System.out.println("Placeholder");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@gjacoby126
Copy link
Contributor

lgtm.

@karanmehta93
Copy link
Member Author

Thanks @twdsilva and @gjacoby126 for the review. Will push it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants