Update of /cvsroot/cweb/bigdata/src/java/com/bigdata/service In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21228/src/java/com/bigdata/service Modified Files: AbstractServer.java IDataService.java MetadataService.java DataService.java MetadataServer.java IMetadataService.java Log Message: Working on registration of scale-out index with the metadata service - commit prior to refactor to use versioning in the MetadataIndex class. Index: DataService.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/DataService.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DataService.java 21 Apr 2007 10:37:16 -0000 1.10 --- DataService.java 23 Apr 2007 17:22:14 -0000 1.11 *************** *** 58,61 **** --- 58,63 ---- import java.util.concurrent.Executors; + import org.apache.log4j.Logger; + import com.bigdata.btree.BatchContains; import com.bigdata.btree.BatchInsert; *************** *** 75,78 **** --- 77,81 ---- import com.bigdata.journal.Journal; import com.bigdata.util.concurrent.DaemonThreadFactory; + import com.sun.corba.se.impl.orbutil.closure.Future; /** *************** *** 102,105 **** --- 105,111 ---- * an NIO interface to the data service. * + * @todo make sure that all service methods that create a {@link Future} do a + * get() so that the will block until the serialized task actually runs. + * * @todo Note that "auto-commit" is provided for unisolated writes. This relies * on two things. First, only the {@link UnisolatedBTree} recoverable from *************** *** 188,191 **** --- 194,200 ---- protected Journal journal; + + public static final transient Logger log = Logger + .getLogger(DataService.class); /** *************** *** 370,382 **** } ! public void registerIndex(String name,UUID indexUUID) { ! journal.serialize(new RegisterIndexTask(name,indexUUID)); } ! public void dropIndex(String name) { ! journal.serialize(new DropIndexTask(name)); } --- 379,400 ---- } ! public void registerIndex(String name,UUID indexUUID) throws IOException, InterruptedException, ExecutionException{ ! journal.serialize(new RegisterIndexTask(name,indexUUID)).get(); } ! public void dropIndex(String name) throws IOException, InterruptedException, ExecutionException { ! journal.serialize(new DropIndexTask(name)).get(); ! ! } ! ! public byte[] lookup(long tx, String name, byte[] key) throws IOException, ! InterruptedException, ExecutionException { ! ! byte[][] vals = batchLookup(tx, name, 1, new byte[][]{key}); ! ! return vals[0]; } *************** *** 632,636 **** * @version $Id$ */ ! private abstract class AbstractIndexManagementTask implements Callable<Object> { protected final String name; --- 650,654 ---- * @version $Id$ */ ! protected abstract class AbstractIndexManagementTask implements Callable<Object> { protected final String name; *************** *** 646,650 **** } ! private class RegisterIndexTask extends AbstractIndexManagementTask { protected final UUID indexUUID; --- 664,668 ---- } ! protected class RegisterIndexTask extends AbstractIndexManagementTask { protected final UUID indexUUID; *************** *** 677,683 **** } ! ndx = journal.registerIndex(name, new UnisolatedBTree(journal, indexUUID)); journal.commit(); return ndx; --- 695,704 ---- } ! ndx = journal.registerIndex(name, new UnisolatedBTree(journal, ! indexUUID)); journal.commit(); + + log.info("registeredIndex: "+name+", indexUUID="+indexUUID); return ndx; *************** *** 687,691 **** } ! private class DropIndexTask extends AbstractIndexManagementTask { public DropIndexTask(String name) { --- 708,712 ---- } ! protected class DropIndexTask extends AbstractIndexManagementTask { public DropIndexTask(String name) { *************** *** 715,719 **** * @version $Id$ */ ! private abstract class AbstractBatchTask implements Callable<Object> { private final String name; --- 736,740 ---- * @version $Id$ */ ! protected abstract class AbstractBatchTask implements Callable<Object> { private final String name; *************** *** 788,792 **** * to block. */ ! private class TxBatchTask extends AbstractBatchTask { private final ITx tx; --- 809,813 ---- * to block. */ ! protected class TxBatchTask extends AbstractBatchTask { private final ITx tx; *************** *** 828,832 **** * @version $Id$ */ ! private class UnisolatedReadBatchTask extends AbstractBatchTask { public UnisolatedReadBatchTask(String name, IBatchOp op) { --- 849,853 ---- * @version $Id$ */ ! protected class UnisolatedReadBatchTask extends AbstractBatchTask { public UnisolatedReadBatchTask(String name, IBatchOp op) { *************** *** 854,858 **** * @version $Id$ */ ! private class UnisolatedBatchReadWriteTask extends UnisolatedReadBatchTask { public UnisolatedBatchReadWriteTask(String name, IBatchOp op) { --- 875,879 ---- * @version $Id$ */ ! protected class UnisolatedBatchReadWriteTask extends UnisolatedReadBatchTask { public UnisolatedBatchReadWriteTask(String name, IBatchOp op) { *************** *** 889,893 **** } ! private class RangeCountTask implements Callable<Object> { // startTime or 0L iff unisolated. --- 910,914 ---- } ! protected class RangeCountTask implements Callable<Object> { // startTime or 0L iff unisolated. *************** *** 970,974 **** } ! private class RangeQueryTask implements Callable<Object> { // startTime or 0L iff unisolated. --- 991,995 ---- } ! protected class RangeQueryTask implements Callable<Object> { // startTime or 0L iff unisolated. *************** *** 1078,1082 **** * @version $Id$ */ ! private abstract class AbstractProcedureTask implements Callable<Object> { protected final IProcedure proc; --- 1099,1103 ---- * @version $Id$ */ ! protected abstract class AbstractProcedureTask implements Callable<Object> { protected final IProcedure proc; *************** *** 1113,1117 **** * to block. */ ! private class TxProcedureTask extends AbstractProcedureTask { private final ITx tx; --- 1134,1138 ---- * to block. */ ! protected class TxProcedureTask extends AbstractProcedureTask { private final ITx tx; *************** *** 1153,1157 **** * @version $Id$ */ ! private class UnisolatedReadProcedureTask extends AbstractProcedureTask { public UnisolatedReadProcedureTask(IProcedure proc) { --- 1174,1178 ---- * @version $Id$ */ ! protected class UnisolatedReadProcedureTask extends AbstractProcedureTask { public UnisolatedReadProcedureTask(IProcedure proc) { *************** *** 1179,1183 **** * @version $Id$ */ ! private class UnisolatedReadWriteProcedureTask extends UnisolatedReadProcedureTask { public UnisolatedReadWriteProcedureTask(IProcedure proc) { --- 1200,1204 ---- * @version $Id$ */ ! protected class UnisolatedReadWriteProcedureTask extends UnisolatedReadProcedureTask { public UnisolatedReadWriteProcedureTask(IProcedure proc) { Index: IDataService.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/IDataService.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** IDataService.java 21 Apr 2007 10:37:16 -0000 1.10 --- IDataService.java 23 Apr 2007 17:22:14 -0000 1.11 *************** *** 143,147 **** * are mapped onto the {@link DataService}. */ ! public void registerIndex(String name,UUID uuid) throws IOException; /** --- 143,148 ---- * are mapped onto the {@link DataService}. */ ! public void registerIndex(String name, UUID uuid) throws IOException, ! InterruptedException, ExecutionException; /** *************** *** 154,159 **** * if <i>name</i> does not identify a registered index. */ ! public void dropIndex(String name) throws IOException; ! /** * <p> --- 155,179 ---- * if <i>name</i> does not identify a registered index. */ ! public void dropIndex(String name) throws IOException, ! InterruptedException, ExecutionException; ! ! /** ! * Point lookup. ! * ! * @param tx ! * @param name ! * @param key ! * @return The value for that key (may be null) and <code>null</code> if ! * there is no value for that key. ! * @throws IOException ! * @throws InterruptedException ! * @throws ExecutionException ! * ! * @todo consider simply encapsulating in the client library since this just ! * wraps a batchLookup operation. ! */ ! public byte[] lookup(long tx, String name, byte[] key) throws IOException, ! InterruptedException, ExecutionException; ! /** * <p> Index: MetadataService.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/MetadataService.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MetadataService.java 23 Apr 2007 13:09:29 -0000 1.5 --- MetadataService.java 23 Apr 2007 17:22:14 -0000 1.6 *************** *** 48,57 **** package com.bigdata.service; ! import java.net.InetSocketAddress; import java.util.Properties; import com.bigdata.journal.Journal; import com.bigdata.scaleup.MasterJournal; import com.bigdata.scaleup.MetadataIndex; /** --- 48,63 ---- package com.bigdata.service; ! import java.io.IOException; import java.util.Properties; + import java.util.UUID; + import java.util.concurrent.ExecutionException; + + import net.jini.core.lookup.ServiceID; + import com.bigdata.btree.BTree; import com.bigdata.journal.Journal; import com.bigdata.scaleup.MasterJournal; import com.bigdata.scaleup.MetadataIndex; + import com.bigdata.scaleup.PartitionMetadata; /** *************** *** 78,101 **** * be able to access the historical state of the metadata index that * corresponds to the commit time of interest for the database.) */ ! public class MetadataService extends DataService implements IMetadataService, IServiceShutdown { /** ! * The name of the journal on which the metadata index is stored. * ! * @todo support two-tier metadata index and reconcile with ! * {@link MetadataIndex} and {@link MasterJournal}. */ ! protected Journal journal; ! public MetadataService(Properties properties) { - super(properties); - } ! public InetSocketAddress getDataService(String name,byte[] key) { ! // TODO Auto-generated method stub ! return null; } --- 84,242 ---- * be able to access the historical state of the metadata index that * corresponds to the commit time of interest for the database.) + * + * @todo support two-tier metadata index and reconcile with + * {@link MetadataIndex} and {@link MasterJournal}. */ ! abstract public class MetadataService extends DataService implements ! IMetadataService, IServiceShutdown { ! ! protected MetadataService(Properties properties) { ! ! super(properties); ! ! } ! ! /* ! * @todo Support creation and management of scale-out indices, including ! * mapping their index partitions to data services. Build out this ! * functionality with a series of test cases that invoke the basic ! * operations (registerIndex, getPartition, getPartitions, movePartition, ! * etc.) and handle the load-balancing later. ! */ /** ! * @todo if if exits already? * ! * @todo index metadata options (unicode support, per-partition counters, ! * etc.) i had been passing in the BTree instance, but that does ! * not work as well in a distributed environment. ! * ! * @todo refactor so that the {@link MetadataIndex} can be used with a ! * normal {@link Journal} ! * ! * @todo create the initial partition and assign to the "least used" data ! * service (the data service impl needs to aggregate events and log ! * them in a manner that gets noticed by the metadata service). */ ! public UUID registerIndex(String name) throws IOException, InterruptedException, ExecutionException { ! ! MetadataIndex mdi = (MetadataIndex) journal.serialize( ! new RegisterMetadataIndexTask(name)).get(); ! ! UUID managedIndexUUID = mdi.getManagedIndexUUID(); ! ! return managedIndexUUID; ! ! } ! /** ! * Return the name of the metadata index. ! * ! * @param indexName ! * The name of the scale-out index. ! * ! * @return The name of the corresponding {@link MetadataIndex} that is used ! * to manage the partitions in the named scale-out index. ! */ ! public static String getMetadataName(String indexName) { ! ! return "metadata-"+indexName; } ! /** ! * Registers a metadata index for a named scale-out index and creates the ! * initial partition for the scale-out index on a {@link DataService}. ! * ! * @author <a href="mailto:tho...@us...">Bryan Thompson</a> ! * @version $Id$ ! */ ! protected class RegisterMetadataIndexTask extends AbstractIndexManagementTask { ! ! public RegisterMetadataIndexTask(String name) { ! ! super(name); ! ! } ! ! public Object call() throws Exception { ! ! // the name of the metadata index itself. ! final String metadataName = getMetadataName(name); ! ! // make sure there is no metadata index for that btree. ! if( journal.getIndex(metadataName) != null ) { ! ! throw new IllegalStateException("Already registered: name=" ! + name); ! ! } ! ! /* ! * Note: there are two UUIDs here - the UUID for the metadata index ! * describing the partitions of the named scale-out index and the UUID ! * of the named scale-out index. The metadata index UUID MUST be used by ! * all B+Tree objects having data for the metadata index (its mutable ! * btrees on journals and its index segments) while the managed named ! * index UUID MUST be used by all B+Tree objects having data for the ! * named index (its mutable btrees on journals and its index segments). ! */ ! ! final UUID metadataIndexUUID = UUID.randomUUID(); ! ! final UUID managedIndexUUID = UUID.randomUUID(); ! ! MetadataIndex mdi = new MetadataIndex(journal, ! BTree.DEFAULT_BRANCHING_FACTOR, metadataIndexUUID, ! managedIndexUUID, name); ! ! /* ! * Setup the initial partition which is able to accept any key. ! */ ! ! ServiceID dataServiceID = getUnderUtilizedDataService(); ! ! UUID dataServiceUUID = new UUID(dataServiceID ! .getMostSignificantBits(), dataServiceID ! .getLeastSignificantBits()); ! ! final UUID[] dataServices = new UUID[]{ ! dataServiceUUID ! }; ! ! mdi.put(new byte[]{}, new PartitionMetadata(0, dataServices )); ! ! journal.commit(); ! ! /* ! * Create the initial partition of the scale-out index on the ! * selected data service. ! * ! * FIXME This must be done using a restart-safe operation such that ! * the partition is either eventually created or the operation is ! * retracted and the partition is created on a different data ! * service. Note that this is a high-latency remote operation and ! * MUST NOT be run inside of the serialized write on the metadata ! * index itself. It is a good question exactly when this operation ! * should be run.... ! */ ! ! IDataService dataService = getDataServiceByID(dataServiceID); ! ! if(dataService==null) { ! ! throw new RuntimeException("Condition is not supported"); ! ! } ! ! /* ! * Register the index on the target data service (remote operation). ! */ ! dataService.registerIndex(name, managedIndexUUID); ! ! return mdi; ! ! } ! } Index: MetadataServer.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/MetadataServer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MetadataServer.java 23 Apr 2007 13:09:29 -0000 1.3 --- MetadataServer.java 23 Apr 2007 17:22:14 -0000 1.4 *************** *** 94,103 **** private ServiceDiscoveryManager serviceDiscoveryManager = null; ! private LookupCache lookupCache = null; private Map<ServiceID, ServiceItem> serviceIdMap = new ConcurrentHashMap<ServiceID, ServiceItem>(); ! protected LookupCache getLookupCache() { ! return lookupCache; } --- 94,103 ---- private ServiceDiscoveryManager serviceDiscoveryManager = null; ! private LookupCache dataServiceLookupCache = null; private Map<ServiceID, ServiceItem> serviceIdMap = new ConcurrentHashMap<ServiceID, ServiceItem>(); ! protected LookupCache getDataServiceLookupCache() { ! return dataServiceLookupCache; } *************** *** 128,132 **** /* ! * Setup a lookupCache that will be populated with all services that match a * filter. This is used to keep track of all data services registered * with any service registrar to which the metadata server is listening. --- 128,132 ---- /* ! * Setup a dataServiceLookupCache that will be populated with all services that match a * filter. This is used to keep track of all data services registered * with any service registrar to which the metadata server is listening. *************** *** 137,141 **** new Class[] { IDataService.class }, null); ! lookupCache = serviceDiscoveryManager .createLookupCache(template, new DataServiceFilter() /* filter */, this /* ServiceDiscoveryListener */); --- 137,141 ---- new Class[] { IDataService.class }, null); ! dataServiceLookupCache = serviceDiscoveryManager .createLookupCache(template, new DataServiceFilter() /* filter */, this /* ServiceDiscoveryListener */); *************** *** 143,147 **** } catch(RemoteException ex) { ! log.error("Could not setup lookup lookupCache", ex); System.exit(1); --- 143,147 ---- } catch(RemoteException ex) { ! log.error("Could not setup lookup dataServiceLookupCache", ex); System.exit(1); *************** *** 285,532 **** } - // /* - // * DiscoveryListener - // */ - // - // /** - // * Extends base implementation to register for notification of - // * {@link DataService} join/leave events - // * - // * @todo this must be a low-latency handler. - // * - // * @todo pay attention iff registrar is for a group that is used by this - // * metadata service as configured. - // * - // * @todo figure out delta in registrars and in group-to-registrar mapping. - // * - // * @todo register for join/leave events for {@link IDataService} on each new - // * registrar. - // * - // * @todo task a worker to query the new registrar(s) for any existing - // * {@link IDataService}s and continue to query until all such - // * services on the registrar have been discovered. This is the pool of - // * {@link DataService}s that are available to the - // * {@link MetadataService} for management. - // */ - // public void discovered(DiscoveryEvent e) { - // - // super.discovered(e); - // - // ServiceRegistrar[] registrars = e.getRegistrars(); - // - // Map<Integer,String[]> registrarToGroups = (Map<Integer,String[]>) e.getGroups(); - // - // final int nregistrars = registrars.length; - // - // log.info("Reported: "+nregistrars+" registrars"); - // - // ServiceTemplate template = new ServiceTemplate(null, - // new Class[] { IDataService.class }, null); - // - // final long leaseDuration = 5000; - // - // final MarshalledObject handbackObject; - // - // try { - // - // handbackObject = new MarshalledObject("handback"); - // - // } catch (IOException ex) { - // - // // the string must be serializable.... - // throw new AssertionError(ex); - // - // } - // - // for(int i=0; i<nregistrars; i++) { - // - // ServiceRegistrar registrar = registrars[i]; - // - // ServiceMatches matches = getDataServices(registrar); - // - // log.info("Reported: "+matches.totalMatches+" data services on registrar"); - // - // /* - // * Note: This is a persistent registration. - // * - // * @todo share a single remote listener object for all registered - // * events? - // * - // * @todo match all appropriate transitions. - // * - // * @todo explore uses for the handback object - should there be one - // * per registrar? it can serve as a key that identifies the - // * registrar.... - // * - // * @todo the last argument is a lease duration. we will have to - // * renew the lease. see what management classes exist to make this - // * easier ( LeaseRenewalManager ). - // */ - // try { - // - // EventRegistration reg = registrar.notify(template, - // ServiceRegistrar.TRANSITION_NOMATCH_MATCH // created. - //// |ServiceRegistrar.TRANSITION_MATCH_MATCH // modified. - // |ServiceRegistrar.TRANSITION_MATCH_NOMATCH // deleted. - // , new NotifyListener(), handbackObject, leaseDuration); - // - // System.err.println("EventRegistration: "+reg); - // - // } catch (RemoteException ex) { - // - // log.error("Could not register for notification", ex); - // - // } - // - // } - // - // } - // - // /** - // * @todo When a registrar is discarded, do we have to do anything? If the - // * registrar was providing redundency, then we can still reach the - // * various data services. If the registrar was the sole resolver for - // * some services then those services are no longer available -- and - // * probably an WARNing should be logged. - // */ - // public void discarded(DiscoveryEvent e) { - // - // super.discarded(e); - // - // } - // - // /** - // * RemoteEventListener - events are generated by our registered persistent - // * notification with one or more service registrars that we use to listen - // * for join/leave of data services. - // * <p> - // * This class extends {@link UnicastRemoteObject} so that it can run in the - // * {@link ServiceRegistrar}. The class MUST be located in the unpacked JAR - // * identified by the <em>codebase</em>. - // * - // * @todo I have not figured out yet how to get the events back to the - // * {@link MetadataServer} - they are being written in the console in - // * which jini is running since they are received remotely and then - // * need to be passed back to the {@link MetadataServer} somehow. - // * - // * @todo perhaps pass in the {@link ServiceRegistrar} or the - // * {@link MarshalledObject} so that we can identify the service for - // * which the event was generated and pass the event to code on the - // * {@link MetadataServer} instance (transient reference?) that will - // * actually handle the event (notice the join/leave of a data - // * service). - // * - // * @see http://archives.java.sun.com/cgi-bin/wa?A2=ind0410&L=jini-users&D=0&P=30410 - // * - // * @see http://archives.java.sun.com/cgi-bin/wa?A2=ind0410&L=jini-users&D=0&P=29391 - // * - // * @see ServiceDiscoveryManager which can encapsulate the entire problem of - // * listening and also enumerating the existing services. However, its - // * use is limited by NAT (it will not cross a filewall). - // */ - // public static class NotifyListener extends UnicastRemoteObject implements RemoteEventListener { - // - // /** - // * - // */ - // private static final long serialVersionUID = -5847172051441883860L; - // - // public NotifyListener() throws RemoteException { - // super(); - // } - // - // public NotifyListener(int port) throws RemoteException { - // super(port); - // } - // - // /** - // * - // * @param e - // * @throws UnknownEventException - // * @throws RemoteException - // */ - // public void notify(RemoteEvent e) throws UnknownEventException, RemoteException { - // - // System.err.println("notify(RemoveEvent:"+e+")"); - // log.info(e.toString()); - // - // } - // - // } - - // /** - // * Return an {@link IMetadataService}. - // * - // * @param registrar - // * A service registrar to query. - // * - // * @return An {@link IMetadataService} if one was found using that - // * registrar. - // */ - // public IMetadataService getMetadataService(ServiceRegistrar registrar) { - // - // Class[] classes = new Class[] {IMetadataService.class}; - // - // ServiceTemplate template = new ServiceTemplate(null, classes, null); - // - // IMetadataService proxy = null; - // - // try { - // - // proxy = (IMetadataService) registrar.lookup(template); - // - // } catch(java.rmi.RemoteException e) { - // - // log.warn(e); - // - // } - // - // return proxy; - // - // } - // - // /** - // * Return the data service(s) matched on this registrar. - // * - // * @param registrar - // * The {@link ServiceRegistrar} to be queried. - // * - // * @return The data service or <code>null</code> if none was matched. - // * - // * @todo we need to describe the services to be discovered by their primary - // * interface and only search within a designated group that - // * corresponds to the bigdata federation of interest - that group is - // * part of the client configuration. - // * - // * @todo we need to filter out matches on {@link MetadataService} since it - // * extends {@link DataService}. - // * - // * @todo how do we ensure that we have seen all data services? If we query - // * each registrar as it is discovered and then register for updates - // * there are two ways in which we could miss some instances: (1) new - // * data services register between the query and the registration for - // * updates; and (2) the query will not return _ALL_ data services - // * registered, but only as match as the match limit. - // */ - // public ServiceMatches getDataServices(ServiceRegistrar registrar) { - // - // Class[] classes = new Class[] {IDataService.class}; - // - // ServiceTemplate template = new ServiceTemplate(null, classes, null); - // - // try { - // - // return registrar.lookup(template,0); - // - // } catch(java.rmi.RemoteException e) { - // - // log.warn(e); - // - // return null; - // - // } - // - // } - // /** * Extends the behavior to terminate {@link LookupCache} and --- 285,288 ---- *************** *** 535,539 **** public void destroy() { ! lookupCache.terminate(); serviceDiscoveryManager.terminate(); --- 291,295 ---- public void destroy() { ! dataServiceLookupCache.terminate(); serviceDiscoveryManager.terminate(); *************** *** 552,561 **** implements Remote, RemoteAdministrable, RemoteDestroyAdmin { ! protected AbstractServer server; /** * @param properties */ ! public AdministrableMetadataService(AbstractServer server, Properties properties) { super(properties); --- 308,317 ---- implements Remote, RemoteAdministrable, RemoteDestroyAdmin { ! protected MetadataServer server; /** * @param properties */ ! public AdministrableMetadataService(MetadataServer server, Properties properties) { super(properties); *************** *** 573,576 **** --- 329,354 ---- } + /** + * Return the UUID of an under utilized data service. + * + * @todo this is just an arbitrary instance and does not consider + * utilization. + */ + public ServiceID getUnderUtilizedDataService() throws IOException { + + ServiceItem item = server.dataServiceLookupCache.lookup(null); + + log.info(item.toString()); + + return item.serviceID; + + } + + public IDataService getDataServiceByID(ServiceID serviceID) throws IOException { + + return (IDataService)server.getDataServiceByID(serviceID).service; + + } + /* * DestroyAdmin Index: AbstractServer.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/AbstractServer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractServer.java 23 Apr 2007 13:09:29 -0000 1.7 --- AbstractServer.java 23 Apr 2007 17:22:13 -0000 1.8 *************** *** 207,215 **** --- 207,219 ---- protected DiscoveryManagement getDiscoveryManagement() { + return discoveryManager; + } protected JoinManager getJoinManager() { + return joinManager; + } *************** *** 519,544 **** public void notify(LeaseRenewalEvent event) { ! log.error("Lease could not be renewed: " + event); } - // /* - // * DiscoveryListener - // */ - // - // /** - // * NOP. - // */ - // public void discovered(DiscoveryEvent arg0) { - // log.info("DiscoveryListener.discovered: "+arg0); - // } - // - // /** - // * NOP. - // */ - // public void discarded(DiscoveryEvent arg0) { - // log.info("DiscoveryListener.discarded: "+arg0); - // } - /** * Shutdown the server taking time only to unregister it from jini. --- 523,530 ---- public void notify(LeaseRenewalEvent event) { ! log.warn("Lease could not be renewed: " + event); } /** * Shutdown the server taking time only to unregister it from jini. *************** *** 794,836 **** abstract protected Remote newService(Properties properties); - // /** - // * The remote service implementation object. This implements the - // * {@link Remote} interface and uses JERI to create a proxy for the remote - // * object and configure and manage the protocol for communications between - // * the client (service proxy) and the remote object (the service - // * implementation). - // * <p> - // * Note: You have to implement {@link JoinAdmin} in order to show up as an - // * administerable service (blue folder) in the jini Service Browser. - // * - // * @version $Id$ - // * @author <a href="mailto:tho...@us...">Bryan Thompson - // * </a> - // */ - // public static class TestServiceImpl implements ITestService - // { - // - // /** - // * Service constructor. - // * - // * @param properties - // */ - // public TestServiceImpl(Properties properties) { - // - // log.info("Created: " + this ); - // - // new Journal(properties); - // - // } - // - // public void invoke() { - // - // log.info("invoked: "+this); - // - // } - // - // } - - /* * Note: You need to extend Remote in order for these APIs to be exported! --- 780,783 ---- Index: IMetadataService.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/service/IMetadataService.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IMetadataService.java 23 Apr 2007 13:09:29 -0000 1.5 --- IMetadataService.java 23 Apr 2007 17:22:14 -0000 1.6 *************** *** 49,54 **** import java.io.IOException; ! import java.net.InetSocketAddress; ! import java.rmi.Remote; /** --- 49,57 ---- import java.io.IOException; ! import java.util.UUID; ! import java.util.concurrent.ExecutionException; ! ! import net.jini.core.lookup.ServiceID; ! import net.jini.core.lookup.ServiceItem; /** *************** *** 68,89 **** public interface IMetadataService extends IDataService { /** ! * Return the address of the {@link IDataService} that has current primary ! * responsibility for the index partition that includes the specified key. ! * ! * @param key ! * The key. * ! * @return The locator for the {@link IDataService} with primary ! * responsibility for the index partition in which that key would be ! * located. * ! * @todo return primary and secondary data service locators with lease. * ! * @todo return primary and secondary data service locators with lease for ! * the index partition that would contain the key plus some number of ! * index partitions surrounding that partition. */ ! public InetSocketAddress getDataService(String name, byte[] key) throws IOException; ! } --- 71,151 ---- public interface IMetadataService extends IDataService { + // /** + // * Return the partition metadata for the index partition that includes the + // * specified key. + // * + // * @param key + // * The key. + // * + // * @return The metadata index partition in which that key is or would be + // * located. + // * + // * @todo return lease for the index partition that would contain the key. + // * + // * @todo abstract away from Jini so that we can support other fabrics + // * (OSGi/SCA). + // * + // * @todo Either the client or the metadata service should support + // * pre-caching of some number of index partitions surrounding that + // * partition. + // * + // * @todo do a variant that supports a key range - this should really just be + // * the same as + // * {@link IDataService#rangeQuery(long, String, byte[], byte[], int, int)} + // * with the client addressing the metadata index rather than the data + // * index (likewise for this method as well). + // * + // * @todo update the {@link PartitionMetadata} data model to reflect a single + // * point of responsibility with a media replication chain for + // * failover. Either this method or a variant method needs to return + // * the partition metadata itself so that {@link DataService}s can + // * configure their downstream media replication pipelines. + // */ + // public PartitionMetadata getPartition(String name, byte[] key) throws IOException; + // + + /* + * methods that require access to the metadata server for their + * implementations. + */ + /** ! * Return the UUID of an under utilized data service. ! */ ! public ServiceID getUnderUtilizedDataService() throws IOException; ! ! /** ! * Return the proxy for a {@link IDataService} from the local cache. * ! * @param serviceID ! * The {@link ServiceID} for the {@link DataService}. ! * ! * @return The proxy or <code>null</code> if the {@link ServiceID} is not ! * mapped to a {@link ServiceItem} for a known {@link DataService} ! * by the local cache. ! * ! * @throws IOException ! */ ! public IDataService getDataServiceByID(ServiceID serviceID) ! throws IOException; ! ! /* ! * methods that do not require direct access to the metadata server for ! * their implementation. ! */ ! ! /** ! * Register a scale-out index. The index will automatically be assigned to a ! * {@link DataService} for its initial partition. As the index grows, the ! * initial partition will be split and the various partitions may be ! * re-distributed among the available {@link DataService}s. * ! * @param name ! * The index name. * ! * @return The UUID for that index. */ ! public UUID registerIndex(String name) throws IOException, ! InterruptedException, ExecutionException; ! } |