Examples of ObsoleteVersionException


Examples of voldemort.versioning.ObsoleteVersionException

    public E setById(int id, Versioned<E> element) {
        VListKey<K> key = new VListKey<K>(_key, id);
        UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element);

        if(!_storeClient.applyUpdate(updateElementAction))
            throw new ObsoleteVersionException("update failed");

        return updateElementAction.getResult();
    }
View Full Code Here

Examples of voldemort.versioning.ObsoleteVersionException

        if(nodeMap == null)
            throw new IndexOutOfBoundsException("invalid id " + _key.getId());
        Version version = (_version != null) ? _version : nodeMap.getVersion();
        VListNode<E> listNode = VListNode.valueOf(nodeMap.getValue());
        if(!listNode.isStable()) {
            throw new ObsoleteVersionException("node " + _key.getId() + " not stable.");
        }
        _result = listNode.getValue();
        VListNode<E> newNode = new VListNode<E>(_element,
                                                listNode.getId(),
                                                listNode.getPreviousId(),
View Full Code Here

Examples of voldemort.versioning.ObsoleteVersionException

            results = select.executeQuery();
            while(results.next()) {
                VectorClock version = new VectorClock(results.getBytes("version_"));
                Occurred occurred = value.getVersion().compare(version);
                if(occurred == Occurred.BEFORE)
                    throw new ObsoleteVersionException("Attempt to put version "
                                                       + value.getVersion()
                                                       + " which is superceeded by " + version
                                                       + ".");
                else if(occurred == Occurred.AFTER)
                    delete(conn, key.get(), version.toBytes());
            }

            // Okay, cool, now put the value
            insert = conn.prepareStatement(insertSql);
            insert.setBytes(1, key.get());
            VectorClock clock = (VectorClock) value.getVersion();
            insert.setBytes(2, clock.toBytes());
            insert.setBytes(3, value.getValue());
            insert.executeUpdate();
            doCommit = true;
        } catch(SQLException e) {
            if(e.getErrorCode() == MYSQL_ERR_DUP_KEY || e.getErrorCode() == MYSQL_ERR_DUP_ENTRY) {
                throw new ObsoleteVersionException("Key or value already used.");
            } else {
                throw new PersistenceFailureException("Fix me!", e);
            }
        } finally {
            if(conn != null) {
View Full Code Here

Examples of voldemort.versioning.ObsoleteVersionException

    public VoldemortException mapResponseCodeToError(int responseCode, String message) {
        // 200 range response code is okay!
        if(responseCode >= 200 && responseCode < 300)
            return null;
        else if(responseCode == HttpURLConnection.HTTP_CONFLICT)
            throw new ObsoleteVersionException(message);
        else
            throw new UnknownFailure("Unknown failure occured in HTTP operation: " + responseCode
                                     + " - " + message);
    }
View Full Code Here

Examples of voldemort.versioning.ObsoleteVersionException

                Iterator<Versioned<byte[]>> iter = vals.iterator();
                while(iter.hasNext()) {
                    Versioned<byte[]> curr = iter.next();
                    Occurred occurred = value.getVersion().compare(curr.getVersion());
                    if(occurred == Occurred.BEFORE)
                        throw new ObsoleteVersionException("Key "
                                                           + new String(hexCodec.encode(key.get()))
                                                           + " "
                                                           + value.getVersion().toString()
                                                           + " is obsolete, it is no greater than the current version of "
                                                           + curr.getVersion().toString() + ".");
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.