use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class S3Request method createBucket.
protected int createBucket(String bucket, String userName, String userId, String acl, String encryption, String objectlock) throws GWException {
int result = 0;
try {
setObjManager();
result = objManager.createBucket(bucket, userName, userId, acl, encryption, objectlock);
} catch (ResourceAlreadyExistException e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.BUCKET_ALREADY_EXISTS, s3Parameter);
} catch (ResourceNotFoundException e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
if (result != 0) {
throw new GWException(GWErrorCode.INTERNAL_SERVER_DB_ERROR, s3Parameter);
}
return result;
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class S3Request method initBucketInfo.
protected void initBucketInfo(String bucket) throws GWException {
checkBucket(bucket);
try {
setObjManager();
dstBucket = objManager.getBucket(bucket);
if (dstBucket != null) {
if (!dstBucket.getAcl().startsWith(GWConstants.XML_VERSION)) {
dstBucket.setAcl(GWUtils.makeOriginalXml(dstBucket.getAcl(), s3Parameter));
}
}
} catch (ResourceNotFoundException e) {
throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
if (dstBucket == null) {
logger.info(GWConstants.LOG_BUCKET_IS_NOT_EXIST, bucket);
throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
}
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class Objmanagertest method testVersiong.
static void testVersiong() throws Exception {
String path;
String bucket = "testvol3vers";
String tmp = "parentD1/subDir/test";
String etag = "etag_sample";
String tag = "tag_sample";
String meta = "meta_sample";
String acl = "acl_sample";
String vers;
int ret;
ObjManager om;
om = new ObjManager();
S3ObjectList s3ObjectList = new S3ObjectList();
try {
sleep(3);
} catch (InterruptedException ex) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
try {
try {
om.createBucket(bucket, "legesse1", "legesse1", "acl", "", "");
} catch (ResourceAlreadyExistException ex) {
System.out.println("Bucket already exist!");
}
try {
vers = om.getBucketVersioning(bucket);
if (vers.isEmpty())
om.putBucketVersioning(bucket, "Enabled");
System.out.println("111Versioin ret :> " + vers);
} catch (ResourceNotFoundException | SQLException ex) {
try {
ret = om.putBucketVersioning(bucket, "Enabled");
System.out.println("222Versioin ret :> " + ret);
} catch (SQLException ex1) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex1);
}
}
long startTime = System.nanoTime();
long startTime1m = System.nanoTime();
long diff = 0;
int mcount = 1;
int idx;
Metadata mt;
for (idx = 0; idx < 200; idx++) {
path = tmp + idx;
// to create on round robin osd disk
mt = om.create(bucket, path);
om.close(bucket, path, etag, meta, tag, 0L, acl, mt.getPrimaryDisk().getPath(), mt.isReplicaExist() ? mt.getReplicaDisk().getPath() : "", Long.toString(startTime), "file");
if ((idx + 1) % 1000000 == 0) {
diff = System.nanoTime() - startTime1m;
System.out.println(mcount + ": Millon create excution time : " + diff + "nanosecond");
startTime1m = System.nanoTime();
mcount++;
}
}
diff = System.nanoTime() - startTime;
System.out.println("Total " + idx + " create excution time : " + diff + "nanosecond");
String delimiter = "/";
String startAfter = "";
int maxKeys = 10;
String prefix = "parentD1/subDir";
s3ObjectList.setMaxKeys(String.valueOf(maxKeys));
s3ObjectList.setDelimiter(delimiter);
s3ObjectList.setPrefix(prefix);
s3ObjectList.setStartAfter(startAfter);
s3ObjectList.setVersionIdMarker("");
s3ObjectList.setMarker(prefix);
try {
// om.listObjectsVersion(bucket, delimiter, startAfter, "", maxKeys, prefix);
ObjectListParameter res = om.listObjectVersions(bucket, s3ObjectList);
System.out.println("res >>" + res);
} catch (SQLException ex) {
Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (IOException | InvalidParameterException | AllServiceOfflineException | ResourceNotFoundException ex) {
System.out.println("Error : " + ex.getMessage());
// Logger.getLogger(Objmanagertest.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class DBPerformanceTest method readFileFromDBPerformanceTest.
static void readFileFromDBPerformanceTest(ObjManager om, String name) {
int idx = 0;
String path;
String tmp = bucket + "testDir_" + name + "/test";
try {
// ObjManager om = new ObjManager();
latch.await();
initReadStartTime();
// for (idx = 0; idx < (int) numJobPerT; idx++) { //500000
while ((idx = getIndex(name + "_read")) != -1) {
path = getPath(tmp, idx);
try {
Metadata mt = om.open(bucket, path, "nil");
} catch (ResourceNotFoundException ex) {
countGetEntry();
continue;
}
countGetEntry();
}
// System.out.format("End num_entry : %d idx : %d thread : %s \n", num_entry, idx, name);
} catch (InvalidParameterException ex) {
System.out.println("Error : " + ex.getMessage());
} catch (InterruptedException ex) {
System.out.println("Thread interrupted : " + ex);
}
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class DBPerformanceTest method createFileOnDBPerformanceTest.
static void createFileOnDBPerformanceTest(ObjManager om, String name) {
int idx = 0;
String path;
String tmp = bucket + "testDir_" + name + "/test";
String etag = "etag_sample";
String tag = "tag_sample";
String meta = "meta_sample";
String acl = "acl_sample";
String deleteMarker = "dmarker";
try {
// for (idx = 0; idx < (int) numJobPerT; idx++) { //500000
while ((idx = getIndex(name + "_create")) != -1) {
path = getPath(tmp, idx);
// to create on round robin osd disk
Metadata mt = om.create(bucket, path);
mt.setMeta(meta);
mt.setEtag(etag);
mt.setTag(tag);
mt.setAcl(acl);
mt.setVersionId("nil", deleteMarker, true);
om.close(bucket, path, mt);
// count++;
countEntry();
}
// System.out.format("End num_entry : %d idx : %d thread : %s \n", num_entry, idx, name);
} catch (IOException | InvalidParameterException | AllServiceOfflineException | ResourceNotFoundException ex) {
System.out.println("Error : " + ex.getMessage());
System.out.println("<><><> idx :" + idx + " thread > " + name);
}
/*catch (Exception ex) {
System.out.println(" OBJMANAGER INIT Error : " + ex.getMessage());
Logger.getLogger(DBPerformanceTest.class.getName()).log(Level.SEVERE, null, ex);
}*/
// diff = System.nanoTime() - tm;
// System.out.format(" > name : %s time : %s jobDone : %d\n", name, getInSecond(diff), count);
latch.countDown();
}
Aggregations