--
You received this message because you are subscribed to the Google Groups "Alfresco Bulk Filesystem Import" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-bulk-filesys...@googlegroups.com.
To post to this group, send email to alfresco-bulk-f...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-bulk-filesystem-import?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
G'day Colin,The importer uses the concept of an importable item [1] that ends up being a single node in the repository. So if you have a file on disk with associated metadata and version files (whether content versions, metadata versions or both), all of those files are grouped together into a single importable item object.Batching occurs after these importable item objects are constructed, and takes the "weight" of each importable item into account. Weight is a crude approximation of the cost of writing that importable item in the repository, and is calculated as the number of files on disk that make up that importable item (see here [2] and here [3]), regardless of whether they're a content file or a metadata file. It's not a precise metric, but it's good enough to allow the importer to create batches of approximately equal size (which is the entire point). It's also efficient. ;-)Batching, then, becomes very simple - the importer simply reads importable items off the queue until their accumulated weight is equal to or greater than the batch weight (which is 100 by default [4]). At that point that batch gets imported into the repository in a single transaction. Note that this means a node always gets imported once, in a single transaction - it's impossible for it to be "split" between transactions (in fact this is a critical design requirement, since otherwise it wouldn't be practical to provide the no-replacement option).Multithreading occurs at a higher level than batching. Basically each thread is given units of work [5], which correspond to directories on disk. The thread is then responsible for all of the work involved in importing that one directory, including the analysis phase (the part that constructs importable items from the files on disk), batching (the part that splits those importable items up, if needed) and finally writing the batches into the repository. The thread is also responsible for submitting new units of work for any subdirectories that that directory contains - it doesn't itself import the contents of those subdirectories however - they go onto the work queue and may be picked up by any of the threads in the pool.Here's a worked example. Assuming:
- there are 2 directories, one underneath the other
- the parent directory has 10 files in it, representing 5 nodes. 2 of those nodes have metadata and 1 of them has 3 content versions (for a total of 10 files on disk)
- the child directory has 402 files in it, representing 2 nodes, each of which has 100 versions of both metadata and content
Here's how the importer would handle this import:
- User initiates the tool using the directory path of the parent directory
- The import tool constructs a unit of work for that directory and sticks it on the work queue
- One of the worker threads (nondeterminate which one) is woken up and handed the unit of work
- That thread performs analysis i.e. it lists the parent directory and constructs 6 importable items based on what it finds (5 nodes + 1 subdirectory)
- That thread performs batching i.e. it creates a single batch because the combined weight of the 6 importable items is less than the the batch size (100)
- That threads starts an Alfresco transaction, imports all 6 items (5 content nodes + 1 folder node) then commits the transaction
- That thread constructs a unit of work for the child directory and sticks it on the work queue
- One of the worker threads (nondeterminate which one - may or may not be the same as the previous one) is woken up and handed the unit of work
- This thread performs analysis i.e. it lists the child directory and constructs 2 importable items based on what it finds (2 nodes)
- This thread performs batching i.e. it creates two batches, because each importable item has a weight (201) greater than the batch size (100)