Add flexibility to attach a Database to a Partition
Description
Environment
Activity
Luiz Fernando TestonJuly 19, 2010 at 4:05 PM
Let N be the number of nodes, L the location where some data will be persisted and H a hashcode of the Partition ID (or Graph Context ID), the problem we have is to choose where the data will be persisted, or, in other words, to find L for a given H and N.
So, L could be found in this way:
L = H % N
So, L will be between 0 and N-1. With the given number we can choose the Location where the data will be persisted.
Alex PorcelliJuly 19, 2010 at 3:23 PM
After talking to feuteston - its clear that the bindings of data <- partition <- database are isolated with guice IoC.
We already have a previous list of static partition that we going to use a config file that will tell us what database is attached to each partition AND to the dynamic case (ie. graph contexts) we going to create a special algorithm that will calculate (hash) wich server we going to provide to that partition.
This dynamic binding should be injected using a guice provider inside our already existent PartitionFactory.
ps: feuteston already sketched an algorithm to apply the dynamic database binding based on number of available database servers.
First of all: its necessary to be clear that a partition and a database is not the same. Should be possible to attach one database for several partitions.
If possible would be nice to enable reload this configuration without reboot the application.