private void checkpointUpdate(final boolean cleanup) throws IOException { checkpointLock.writeLock().lock(); try { this.indexLock.writeLock().lock(); try { Set<Integer> filesToGc = pageFile.tx().execute(new Transaction.CallableClosure<Set<Integer>, IOException>() { @Override public Set<Integer> execute(Transaction tx) throws IOException { return checkpointUpdate(tx, cleanup); } }); pageFile.flush(); // after the index update such that partial removal does not leave dangling references in the index. journal.removeDataFiles(filesToGc); } finally { this.indexLock.writeLock().unlock(); } } finally { checkpointLock.writeLock().unlock(); } }
private void loadPageFile() throws IOException { synchronized (indexMutex) { final PageFile pageFile = getPageFile(); pageFile.load(); pageFile.tx().execute(new Transaction.Closure<IOException>() { public void execute(Transaction tx) throws IOException { destinations = new BTreeIndex<String, StoredDestination>(pageFile, tx.allocate().getPageId()); destinations.setKeyMarshaller(StringMarshaller.INSTANCE); destinations.setValueMarshaller(new StoredDestinationMarshaller()); destinations.load(tx); } }); pageFile.flush(); storedDestinations.clear(); } }
pageFile.flush(); } finally { this.indexLock.writeLock().unlock();
@Override public JobScheduler getJobScheduler(final String name) throws Exception { this.indexLock.writeLock().lock(); try { JobSchedulerImpl result = this.schedulers.get(name); if (result == null) { final JobSchedulerImpl js = new JobSchedulerImpl(this); js.setName(name); getPageFile().tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { js.createIndexes(tx); js.load(tx); metaData.getJobSchedulers().put(tx, name, js); } }); result = js; this.schedulers.put(name, js); if (isStarted()) { result.start(); } this.pageFile.flush(); } return result; } finally { this.indexLock.writeLock().unlock(); } }
metaData.setState(KahaDBMetaData.OPEN_STATE); tx.store(metaData.getPage(), metaDataMarshaller, true); pageFile.flush();
pageFile.flush(); } finally { this.indexLock.writeLock().unlock();
flush(); try { stopWriter();
this.pageFile.flush(); LOG.info(this + " started");
this.pageFile.flush();
private void checkpointUpdate(final boolean cleanup) throws IOException { checkpointLock.writeLock().lock(); try { this.indexLock.writeLock().lock(); try { Set<Integer> filesToGc = pageFile.tx().execute(new Transaction.CallableClosure<Set<Integer>, IOException>() { @Override public Set<Integer> execute(Transaction tx) throws IOException { return checkpointUpdate(tx, cleanup); } }); pageFile.flush(); // after the index update such that partial removal does not leave dangling references in the index. journal.removeDataFiles(filesToGc); } finally { this.indexLock.writeLock().unlock(); } } finally { checkpointLock.writeLock().unlock(); } }
private void checkpointUpdate(final boolean cleanup) throws IOException { checkpointLock.writeLock().lock(); try { this.indexLock.writeLock().lock(); try { Set<Integer> filesToGc = pageFile.tx().execute(new Transaction.CallableClosure<Set<Integer>, IOException>() { @Override public Set<Integer> execute(Transaction tx) throws IOException { return checkpointUpdate(tx, cleanup); } }); pageFile.flush(); // after the index update such that partial removal does not leave dangling references in the index. journal.removeDataFiles(filesToGc); } finally { this.indexLock.writeLock().unlock(); } } finally { checkpointLock.writeLock().unlock(); } }
private void checkpointUpdate(final boolean cleanup) throws IOException { checkpointLock.writeLock().lock(); try { this.indexLock.writeLock().lock(); try { Set<Integer> filesToGc = pageFile.tx().execute(new Transaction.CallableClosure<Set<Integer>, IOException>() { @Override public Set<Integer> execute(Transaction tx) throws IOException { return checkpointUpdate(tx, cleanup); } }); pageFile.flush(); // after the index update such that partial removal does not leave dangling references in the index. journal.removeDataFiles(filesToGc); } finally { this.indexLock.writeLock().unlock(); } } finally { checkpointLock.writeLock().unlock(); } }
private void loadPageFile() throws IOException { synchronized (indexMutex) { final PageFile pageFile = getPageFile(); pageFile.load(); pageFile.tx().execute(new Transaction.Closure<IOException>() { public void execute(Transaction tx) throws IOException { destinations = new BTreeIndex<String, StoredDestination>(pageFile, tx.allocate().getPageId()); destinations.setKeyMarshaller(StringMarshaller.INSTANCE); destinations.setValueMarshaller(new StoredDestinationMarshaller()); destinations.load(tx); } }); pageFile.flush(); storedDestinations.clear(); } }
private void loadPageFile() throws IOException { synchronized (indexMutex) { final PageFile pageFile = getPageFile(); pageFile.load(); pageFile.tx().execute(new Transaction.Closure<IOException>() { public void execute(Transaction tx) throws IOException { destinations = new BTreeIndex<String, StoredDestination>(pageFile, tx.allocate().getPageId()); destinations.setKeyMarshaller(StringMarshaller.INSTANCE); destinations.setValueMarshaller(new StoredDestinationMarshaller()); destinations.load(tx); } }); pageFile.flush(); storedDestinations.clear(); } }
pageFile.flush(); } finally { this.indexLock.writeLock().unlock();
private void loadPageFile() throws IOException { synchronized (indexMutex) { final PageFile pageFile = getPageFile(); pageFile.load(); pageFile.tx().execute(new Transaction.Closure<IOException>() { public void execute(Transaction tx) throws IOException { destinations = new BTreeIndex<String, StoredDestination>(pageFile, tx.allocate().getPageId()); destinations.setKeyMarshaller(StringMarshaller.INSTANCE); destinations.setValueMarshaller(new StoredDestinationMarshaller()); destinations.load(tx); } }); pageFile.flush(); storedDestinations.clear(); } }
@Override public JobScheduler getJobScheduler(final String name) throws Exception { this.indexLock.writeLock().lock(); try { JobSchedulerImpl result = this.schedulers.get(name); if (result == null) { final JobSchedulerImpl js = new JobSchedulerImpl(this); js.setName(name); getPageFile().tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { js.createIndexes(tx); js.load(tx); metaData.getJobSchedulers().put(tx, name, js); } }); result = js; this.schedulers.put(name, js); if (isStarted()) { result.start(); } this.pageFile.flush(); } return result; } finally { this.indexLock.writeLock().unlock(); } }
@Override public JobScheduler getJobScheduler(final String name) throws Exception { this.indexLock.writeLock().lock(); try { JobSchedulerImpl result = this.schedulers.get(name); if (result == null) { final JobSchedulerImpl js = new JobSchedulerImpl(this); js.setName(name); getPageFile().tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { js.createIndexes(tx); js.load(tx); metaData.getJobSchedulers().put(tx, name, js); } }); result = js; this.schedulers.put(name, js); if (isStarted()) { result.start(); } this.pageFile.flush(); } return result; } finally { this.indexLock.writeLock().unlock(); } }
@Override public JobScheduler getJobScheduler(final String name) throws Exception { this.indexLock.writeLock().lock(); try { JobSchedulerImpl result = this.schedulers.get(name); if (result == null) { final JobSchedulerImpl js = new JobSchedulerImpl(this); js.setName(name); getPageFile().tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { js.createIndexes(tx); js.load(tx); metaData.getJobSchedulers().put(tx, name, js); } }); result = js; this.schedulers.put(name, js); if (isStarted()) { result.start(); } this.pageFile.flush(); } return result; } finally { this.indexLock.writeLock().unlock(); } }
this.pageFile.flush(); LOG.info(this + " started");