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

prototype of bulk import v2 distributed file examination #4898

Draft
wants to merge 7 commits into
base: 2.1
Choose a base branch
from

Conversation

keith-turner
Copy link
Contributor

This is prototype for a few new APIs that allow distributing the examination of files for bulk import v2. Any feedback would be appreciated.

For a given bulk import directory with N files this would support a use case like the following.

  1. For eack file a task is spun up on a remote server that calls the new LoadPlan.compute() API to determine what tablets the file overlaps. Then the new LoadPlan.toJson() method is called to serialize the load plan and send it to a central place.
  2. All the load plans from the remote servers are deserialized calling the new LoadPlan.fromJson() method and merged into a single load plan that is used to do the bulk import.

Another use case these new APIs could support is running this new code in the map reduce job that generates bulk import data.

  1. In each reducer after it produces an rfile it could then call the new LoadPlan.compute(), then call LoadPlan.toJson() and save the result to a file. So after the map reduce job completes each rfile would have corresponding file with a load plan for that file.
  2. Another process that runs after the map reduce job can load all the load plans from files and merge them using the new LoadPlan.fromJson() method. Then the merged LoadPlan can be used to do the bulk import.

BulkNewIT.testComputeLoadPlan() simulates this map reduce use case by going through the steps in code that a map reduce job would. This tests the new APIs and shows what using it would look like.

Both of these use cases avoid doing the analysis of files on a single machine doing the bulk import. Bulk import V1 had this functionality and would ask random tservers to do the file analysis. This could cause unexpected load on those tservers. Bulk V1 would interleave analyzing files and adding them to tablets. This could lead to odd situations where files are partially imported to some tablets and analysis fails, leaving the file partially imported. Bulk v2 does all analysis before any files are added to tablets, however it lacks this distributed analysis capability. This is an initial attempt to offer that functionality in bulk v2.

This is prototype for a few new APIs that allow distributing the
examination of files for bulk import.

For a given bulk import directory with N files this would support a use
case like the following.

 1. For eack file a task is spun up on a remote server that calls the new
    LoadPlan.compute() API to determine what tablets the file overlaps.
    Then the new LoadPlan.toJson() method is called to serialize the
    load plan and send it to a central place.
 2. All the load plans from the remote servers are deserialized calling
    the new LoadPlan.fromJson() method and merged into a single load
    plan that is used to do the bulk import.

Another use case these new APIs could support is running this new code
in the map reduce job that generates bulk import data.

  1. In each reducer after it produces an rfile it could then call the
     new LoadPlan.compute(), then call LoadPlan.toJson() and save the
     result to a file.  So after the map reduce job completes each rfile
     would have  corresponding file with a load plan for that file.
  2. Another process that runs after the map reduce job can load all the
     load plans from files and merge them using the new
     LoadPlan.fromJson() method.  Then the merged LoadPlan can be used
     to do the bulk import.

BulkNewIT.testComputeLoadPlan() simulates this map reduce use case by
going through the steps in code that a map reduce job would.  This tests
the new APIs and shows what using it would look like.

Both of these use cases avoid doing the analysis of files on a single
machine doing the bulk import.  Bulk import V1 had this functionality
and would ask random tservers to do the file analysis.  This could cause
unexpected load on those tservers.  Bulk V1 would interleave analyzing
files and adding them to tablets.  This could lead to odd situations
where files are partially imported to some tablets and analysis fails,
leaving the file partially imported.  Bulk v2 does all analysis before
any files are added to tablets, however it lacks this distributed
analysis capability.  This is an initial attempt to offer that
functionality in bulk v2.
// TODO javadoc
public static LoadPlan compute(URI file, SortedSet<Text> splits) throws IOException {

// TODO if the files needed a crypto service how could it be instantiated? Was trying to make
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure of the best way forward here. As a design goal was attempting to make this compute method independent of something like an accumulo client and a client context, however ran into a problem with that design goal with the crypto service.

Copy link
Member

Choose a reason for hiding this comment

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

You can look at how the rfile PrintInfo command does this. It calls:

       CryptoService cs = CryptoFactoryLoader.getServiceForClient(CryptoEnvironment.Scope.TABLE,
           siteConfig.getAllCryptoProperties());

As a server-side utility, you could make certain assumptions that it has the ability to read the accumulo properties file on the server side, like that utility does. However, as a purely client-side API, you may need to just pass in the CryptoService directly, or pass in other options, so it can set up the right config (crypto, compression, etc.) to be able to read the files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made an update in 9ef0bcf to pass in a map of props which is passed to the Rfile api which internally calls CryptoFactoryLoader.getServiceForClient using that map of properties.

Copy link
Member

Choose a reason for hiding this comment

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

That could work, since it's a static entry point to building a load plan. If it was dangling off AccumuloClient, users might expect client properties to be passed. But for the static entry point, I think it's reasonable to require them to be provided explicitly.

I like how you were able to use the existing RFile.newScanner() code.

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

Successfully merging this pull request may close these issues.

2 participants