Search in sources :

Example 1 with SystemInfo

use of org.smartdata.model.SystemInfo in project SSM by Intel-bigdata.

the class AlluxioEntryFetchAndApplyTask method run.

@Override
public void run() {
    LOG.trace("AlluxioEntryFetchAndApplyTask run at " + new Date());
    try {
        JournalEntry journalEntry = journalReader.read();
        while (journalEntry != null) {
            entryApplier.apply(journalEntry);
            lastSn.getAndSet(journalEntry.getSequenceNumber());
            metaStore.updateAndInsertIfNotExist(new SystemInfo(SmartConstants.SMART_ALLUXIO_LAST_ENTRY_SN, String.valueOf(lastSn.get())));
            journalEntry = journalReader.read();
        }
    } catch (Throwable t) {
        LOG.error("Alluxio Entry Apply Events error", t);
    }
}
Also used : SystemInfo(org.smartdata.model.SystemInfo) JournalEntry(alluxio.proto.journal.Journal.JournalEntry) Date(java.util.Date)

Example 2 with SystemInfo

use of org.smartdata.model.SystemInfo in project SSM by Intel-bigdata.

the class TestMetaStore method testInsertSystemInfo.

@Test
public void testInsertSystemInfo() throws MetaStoreException {
    SystemInfo systemInfo = new SystemInfo("test", "test");
    metaStore.insertSystemInfo(systemInfo);
    Assert.assertTrue(metaStore.getSystemInfoByProperty("test").equals(systemInfo));
}
Also used : SystemInfo(org.smartdata.model.SystemInfo) Test(org.junit.Test)

Example 3 with SystemInfo

use of org.smartdata.model.SystemInfo in project SSM by Intel-bigdata.

the class TestMetaStore method testDeleteSystemInfo.

@Test
public void testDeleteSystemInfo() throws MetaStoreException {
    SystemInfo systemInfo = new SystemInfo("test", "test");
    metaStore.insertSystemInfo(systemInfo);
    metaStore.deleteSystemInfo("test");
    Assert.assertTrue(metaStore.listAllSystemInfo().size() == 0);
}
Also used : SystemInfo(org.smartdata.model.SystemInfo) Test(org.junit.Test)

Example 4 with SystemInfo

use of org.smartdata.model.SystemInfo in project SSM by Intel-bigdata.

the class InotifyFetchAndApplyTask method run.

@Override
public void run() {
    LOG.trace("InotifyFetchAndApplyTask run at " + new Date());
    try {
        EventBatch eventBatch = inotifyEventInputStream.poll();
        while (eventBatch != null) {
            applier.apply(eventBatch.getEvents());
            lastId.getAndSet(eventBatch.getTxid());
            metaStore.updateAndInsertIfNotExist(new SystemInfo(SmartConstants.SMART_HDFS_LAST_INOTIFY_TXID, String.valueOf(lastId.get())));
            eventBatch = inotifyEventInputStream.poll();
        }
    } catch (Throwable t) {
        LOG.error("Inotify Apply Events error", t);
    }
}
Also used : SystemInfo(org.smartdata.model.SystemInfo) EventBatch(org.apache.hadoop.hdfs.inotify.EventBatch) Date(java.util.Date)

Example 5 with SystemInfo

use of org.smartdata.model.SystemInfo in project SSM by Intel-bigdata.

the class TestMetaStore method testUpdateAndInsertSystemInfo.

@Test
public void testUpdateAndInsertSystemInfo() throws MetaStoreException {
    SystemInfo systemInfo = new SystemInfo("test", "test");
    metaStore.updateAndInsertIfNotExist(systemInfo);
    Assert.assertTrue(metaStore.containSystemInfo("test"));
    Assert.assertTrue(metaStore.getSystemInfoByProperty("test").equals(systemInfo));
}
Also used : SystemInfo(org.smartdata.model.SystemInfo) Test(org.junit.Test)

Aggregations

SystemInfo (org.smartdata.model.SystemInfo)9 Test (org.junit.Test)7 Date (java.util.Date)2 JournalEntry (alluxio.proto.journal.Journal.JournalEntry)1 EventBatch (org.apache.hadoop.hdfs.inotify.EventBatch)1