Package voldemort

Examples of voldemort.VoldemortException


                throw new IllegalStateException("Expected to find only a single store, but found multiple!");
            this.storeDef = storeDefs.get(0);

            this.numChunks = conf.getInt("num.chunks", -1);
            if(this.numChunks < 1)
                throw new VoldemortException("num.chunks not specified in the job conf.");

            this.saveKeys = conf.getBoolean("save.keys", false);
            this.reducerPerBucket = conf.getBoolean("reducer.per.bucket", false);
            this.conf = job;
            this.outputDir = job.get("final.output.dir");
View Full Code Here


            // If we have multiple values for this md5 that is a collision,
            // throw an exception--either the data itself has duplicates, there
            // are trillions of keys, or someone is attempting something
            // malicious ( We obviously expect collisions when we save keys )
            if(!getSaveKeys() && numTuples > 1)
                throw new VoldemortException("Duplicate keys detected for md5 sum "
                                             + ByteUtils.toHexString(ByteUtils.copy(key.get(),
                                                                                    0,
                                                                                    key.getSize())));

        }

        if(numTuples < 0) {
            // Overflow
            throw new VoldemortException("Found too many collisions: chunk " + chunkId
                                         + " has exceeded " + Short.MAX_VALUE + " collisions.");
        } else if(numTuples > 1) {
            // Update number of collisions + max keys per collision
            reporter.incrCounter(CollisionCounter.NUM_COLLISIONS, 1);

            long numCollisions = reporter.getCounter(CollisionCounter.MAX_COLLISIONS).getCounter();
            if(numTuples > numCollisions) {
                reporter.incrCounter(CollisionCounter.MAX_COLLISIONS, numTuples - numCollisions);
            }
        }

        // Flush the value
        valueStream.flush();
        byte[] value = stream.toByteArray();

        // Start writing to file now
        // First, if save keys flag set the number of keys
        if(getSaveKeys()) {

            this.valueFileStream[chunkId].writeShort(numTuples);
            this.position[chunkId] += ByteUtils.SIZE_OF_SHORT;

            if(this.checkSumDigestValue[chunkId] != null) {
                this.checkSumDigestValue[chunkId].update(numTuples);
            }
        }

        this.valueFileStream[chunkId].write(value);
        this.position[chunkId] += value.length;

        if(this.checkSumDigestValue[chunkId] != null) {
            this.checkSumDigestValue[chunkId].update(value);
        }

        if(this.position[chunkId] < 0)
            throw new VoldemortException("Chunk overflow exception: chunk " + chunkId
                                         + " has exceeded " + Integer.MAX_VALUE + " bytes.");

    }
View Full Code Here

        return storeDef.getName();
    }

    private final void checkNotNull(Object o) {
        if(o == null)
            throw new VoldemortException("Not configured yet!");
    }
View Full Code Here

                }
                if(exception.getResponse().getStatus() == NOT_FOUND.getCode()) {
                    return false;
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
        } catch(InterruptedException e) {
            if(logger.isDebugEnabled()) {
                logger.debug("Operation interrupted : " + e.getMessage());
            }
            throw new VoldemortException("Operation Interrupted: " + e.getMessage(), e);
        } catch(URISyntaxException e) {
            throw new VoldemortException("Illegal HTTP URL" + e.getMessage(), e);
        }
        return true;
    }
View Full Code Here

                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
        } catch(InterruptedException e) {
            if(logger.isDebugEnabled()) {
                logger.debug("Operation interrupted : " + e.getMessage(), e);
            }
            throw new VoldemortException("Operation interrupted exception: " + e.getMessage(), e);
        } catch(URISyntaxException e) {
            throw new VoldemortException("Illegal HTTP URL" + e.getMessage(), e);
        }

        return resultList;
    }
View Full Code Here

                results.add(new Versioned<byte[]>(bodyPartBytes, clock));

            }

        } catch(MessagingException e) {
            throw new VoldemortException("Messaging exception while trying to parse GET response "
                                         + e.getMessage(), e);
        } catch(JsonParseException e) {
            throw new VoldemortException("JSON parsing exception while trying to parse GET response "
                                                 + e.getMessage(),
                                         e);
        } catch(JsonMappingException e) {
            throw new VoldemortException("JSON mapping exception while trying to parse GET response "
                                                 + e.getMessage(),
                                         e);
        } catch(IOException e) {
            throw new VoldemortException("IO exception while trying to parse GET response "
                                         + e.getMessage(), e);
        }
        return results;

    }
View Full Code Here

                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
        } catch(InterruptedException e) {
            if(logger.isDebugEnabled()) {
                logger.debug("Operation interrupted : " + e.getMessage(), e);
            }
            throw new VoldemortException("Operation interrupted exception: " + e.getMessage(), e);
        } catch(URISyntaxException e) {
            throw new VoldemortException("Illegal HTTP URL" + e.getMessage(), e);
        } catch(UnsupportedEncodingException e) {
            throw new VoldemortException("Unsupported Encoding exception while encoding the key"
                                         + e.getMessage(), e);
        }
        return null;
    }
View Full Code Here

                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

                int httpErrorStatus = exception.getResponse().getStatus();
                if(httpErrorStatus == BAD_REQUEST.getCode()) {
                    throw new VoldemortException("Bad request: " + e.getMessage(), e);
                } else if(httpErrorStatus == PRECONDITION_FAILED.getCode()) {
                    throw new ObsoleteVersionException(e.getMessage());
                } else if(httpErrorStatus == REQUEST_TIMEOUT.getCode()
                          || httpErrorStatus == INTERNAL_SERVER_ERROR.getCode()) {
                    throw new InsufficientOperationalNodesException(e.getMessage());
                }
            }
            throw new VoldemortException("Unknown HTTP request execution exception: "
                                         + e.getMessage(), e);

        } catch(InterruptedException e) {
            if(logger.isDebugEnabled()) {
                logger.debug("Operation interrupted : " + e.getMessage());
            }
            throw new VoldemortException("Unknown Voldemort exception: " + e.getMessage());
        } catch(URISyntaxException e) {
            throw new VoldemortException("Illegal HTTP URL" + e.getMessage());
        }
    }
View Full Code Here

                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
        } catch(InterruptedException e) {
            if(logger.isDebugEnabled()) {
                logger.debug("Operation interrupted : " + e.getMessage(), e);
            }
            throw new VoldemortException("Operation interrupted exception: " + e.getMessage(), e);
        } catch(URISyntaxException e) {
            throw new VoldemortException("Illegal HTTP URL" + e.getMessage(), e);
        }

        return resultMap;
    }
View Full Code Here

                }
                results.put(key, valueResultList);
            }

        } catch(MessagingException e) {
            throw new VoldemortException("Messaging exception while trying to parse GET response "
                                         + e.getMessage(), e);
        } catch(JsonParseException e) {
            throw new VoldemortException("JSON parsing exception while trying to parse GET response "
                                                 + e.getMessage(),
                                         e);
        } catch(JsonMappingException e) {
            throw new VoldemortException("JSON mapping exception while trying to parse GET response "
                                                 + e.getMessage(),
                                         e);
        } catch(IOException e) {
            throw new VoldemortException("IO exception while trying to parse GET response "
                                         + e.getMessage(), e);
        }
        return results;

    }
View Full Code Here

TOP

Related Classes of voldemort.VoldemortException

Copyright © 2018 www.massapicom. 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.