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-5018 Index mutations created by UPSERT SELECT will have wrong… #434

Closed
wants to merge 1 commit into from
Closed

PHOENIX-5018 Index mutations created by UPSERT SELECT will have wrong… #434

wants to merge 1 commit into from

Conversation

kadirozde
Copy link
Contributor

… timestamps

Copy link
Contributor

@gokceni gokceni left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for adding extra comments, that is really helpful. Please rebase on top of my changes which should go in this week. I would also wait for Geoffrey's approval since I am new.


ResultSet rs = conn.createStatement().executeQuery(selectSql);
assertTrue (rs.next());
assertTrue(rs.unwrap(PhoenixResultSet.class).getCurrentRow().getValue(0).getTimestamp() >= clock1.initialTime());
Copy link
Contributor

Choose a reason for hiding this comment

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

@kadirozde - maybe I'm misunderstanding the test, but shouldn't this be checking against an upper bound to make sure that the index was populated with the initial timestamp of 'abc' (and in the second check 'bcd')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx for noticing it. I will correct it.

final Job job = Job.getInstance(configuration, jobName);
job.setJarByClass(IndexTool.class);
job.setMapOutputKeyClass(ImmutableBytesWritable.class);
FileOutputFormat.setOutputPath(job, outputPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can dispense with the output path, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I remove the code for setting the output path, there is always one other test failing. There are total of 120 tests. I tried restructuring the IndexTool code so that the output path is set only when bulk loading is enabled but did not help. So, I will leave the code as it is.

@@ -211,23 +211,14 @@ public Void run() throws Exception {

// we should be able to read the data from another index as well to which we have not given any access to
// this user
verifyAllowed(createIndex(indexName2, phoenixTableName), unprivilegedUser);
Copy link
Contributor

Choose a reason for hiding this comment

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

@kadirozde - I'm curious what the purpose of these changes are. Have DDL permissions changed? If not, and your changes somehow break the existing test, is there a way to modify the test logic to keep the same test coverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently global indexes are built by using UPSERT SELECT, i..e, by reading mutations from the data table and writing the corresponding mutations to the index table. The user does not need to have the write privilege on the data table in order to build an index table. However, in the new approach, an index table is built by replaying the existing mutations back on the data table again (without actually applying them to the data table) for the purpose of reconstructing the index mutations. Such replay attempts are allowed only when the user has the write privilege. Therefore, I had to delete the scenarios that are not applicable anymore.


String dataTableFullName = SchemaUtil.getTableName(
tableRef.getTable().getSchemaName().getString(),
tableRef.getTable().getTableName().getString());
Copy link
Contributor

Choose a reason for hiding this comment

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

@kadirozde - curious why the refresh is needed here? The tableRef only seems to be used to get the base table name to give to the ServerBuildIndexDDLCompiler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed this for the initial version of the compiler where the index table was searched in the index list of the PTable for the data table. MetadataClient constructs the PTable object for the data table before the index table is created and thus the object does have a reference to the newly created index. The complier has changed and this search was eliminated. So there is no need to refresh the PTable object anymore. I will remove the refresh code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explaining, @kadirozde . Once the refresh code gets removed, I think this is ready to go so I'll +1 and commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gjacoby126, I have removed the refresh code. Thank you for discovering this issue, helping me understand the code, and reviewing the patch!

@gjacoby126 gjacoby126 closed this Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants