Package com.persistit

Examples of com.persistit.Exchange.clear()


        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
        RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);

        Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
        exchange.clear()
            .append(indexStatisticsRowDef.table().getOrdinal())
            .append((long)indexRowDef.getRowDefId())
            .append((long)index.getIndexId());
        if (!exchange.fetch().getValue().isDefined()) {
            return null;
View Full Code Here


    @Override
    public void addOnlineHandledHKey(Session session, int tableID, Key hKey) {
        Exchange ex = onlineHandledHKeyExchange(session, tableID);
        try {
            ex.clear().getKey().appendByteArray(hKey.getEncodedBytes(), 0, hKey.getEncodedSize());
            ex.store();
        } catch(PersistitException | RollbackException e) {
            throw wrapPersistitException(session, e);
        } finally {
            treeService.releaseExchange(session, ex);
View Full Code Here

    @Override
    public Iterator<byte[]> getOnlineHandledHKeyIterator(final Session session, int tableID, Key hKey) {
        final Exchange ex = onlineHandledHKeyExchange(session, tableID);
        if(hKey != null) {
            ex.clear().getKey().appendByteArray(hKey.getEncodedBytes(), 0, hKey.getEncodedSize());
        }
        return new Iterator<byte[]>() {
            private Key.Direction dir = Key.GTEQ;

            @Override
View Full Code Here

    @Override
    public void setOnlineDMLError(Session session, int tableID, String message) {
        OnlineSession onlineSession = getOnlineSession(session, true);
        Exchange ex = schemaTreeExchange(session);
        try {
            ex.clear().append(S_K_ONLINE).append(onlineSession.id).append(S_K_ERROR);
            ex.getValue().putString(message);
            ex.store();
        } catch(PersistitException | RollbackException e) {
            if(ex != null) {
                treeService.releaseExchange(session, ex);
View Full Code Here

    @Override
    public String getOnlineDMLError(Session session) {
        OnlineSession onlineSession = getOnlineSession(session, true);
        Exchange ex = schemaTreeExchange(session);
        try {
            ex.clear().append(S_K_ONLINE).append(onlineSession.id).append(S_K_ERROR);
            ex.fetch();
            // write skew
            ex.lock();
            return ex.getValue().isDefined() ? ex.getValue().getString() : null;
        } catch(PersistitException | RollbackException e) {
View Full Code Here

    public void addOnlineChangeSet(Session session, ChangeSet changeSet) {
        OnlineSession onlineSession = getOnlineSession(session, true);
        onlineSession.tableIDs.add(changeSet.getTableId());
        Exchange ex = schemaTreeExchange(session);
        try {
            ex.clear().append(S_K_ONLINE).append(onlineSession.id).append(S_K_CHANGE).append(changeSet.getTableId());
            ex.getValue().putByteArray(ChangeSetHelper.save(changeSet));
            ex.store();
        } catch(PersistitException | RollbackException e) {
            if(ex != null) {
                treeService.releaseExchange(session, ex);
View Full Code Here

        delayedTreeCount.incrementAndGet();
        Exchange ex = schemaTreeExchange(session);
        try {
            long id = delayedTreeIDGenerator.incrementAndGet();
            long timestamp = System.currentTimeMillis();
            ex.clear().append(S_K_DELAYED).append(id).append(timestamp);
            ex.getValue().setStreamMode(true);
            ex.getValue().put(schema);
            ex.getValue().put(treeName);
            ex.getValue().setStreamMode(false);
            ex.store();
View Full Code Here

            createValidatedShared(session, newAIS, GenValue.NEW, GenMap.NO_PUT);

            for(String schema : schemaNames) {
                ex = schemaTreeExchange(session);
                saveMetaAndDataVersions(ex);
                ex.clear().append(S_K_PROTOBUF).append(schema);
                buffer = storeProtobuf(ex, buffer, newAIS, schema);
                treeService.releaseExchange(session, ex);
                ex = null;
            }
            buildRowDefs(session, newAIS);
View Full Code Here

            getNextGeneration(session);

            saveMetaAndDataVersions(ex);

            // online,cid => generation
            ex.clear().append(S_K_ONLINE).append(onlineSession.id);
            ex.getValue().put(newAIS.getGeneration());
            ex.store();

            // online,cid,protobuf,schema = bytes
            ByteBuffer buffer = null;
View Full Code Here

    @Override
    protected void clearOnlineState(Session session, OnlineSession onlineSession) {
        Exchange ex = schemaTreeExchange(session);
        try {
            ex.clear().append(S_K_ONLINE).append(onlineSession.id);
            ex.remove(Key.GTEQ);
            for(int tid : onlineSession.tableIDs) {
                String treeName = onlineHandledHKeyTreeName(onlineSession.id, tid);
                if(treeService.treeExists(treeName)) {
                    Exchange changeEx = onlineHandledHKeyExchange(session, onlineSession.id, tid);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.