use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.
the class ZooKeeperLockingTest method testZooKeeperLockingByTryingToAcquire2Locks.
@Test
public void testZooKeeperLockingByTryingToAcquire2Locks() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
final CarbonProperties cp = CarbonProperties.getInstance();
new NonStrictExpectations(cp) {
{
cp.getProperty("/CarbonLocks");
result = "/carbontests";
cp.getProperty("spark.deploy.zookeeper.url");
result = "127.0.0.1:" + freePort;
}
};
ZookeeperInit zki = ZookeeperInit.getInstance("127.0.0.1:" + freePort);
CarbonTableIdentifier tableIdentifier = new CarbonTableIdentifier("dbName", "tableName", "tableId");
ZooKeeperLocking zkl = new ZooKeeperLocking(tableIdentifier, LockUsage.METADATA_LOCK);
Assert.assertTrue(zkl.lock());
ZooKeeperLocking zk2 = new ZooKeeperLocking(tableIdentifier, LockUsage.METADATA_LOCK);
Assert.assertTrue(!zk2.lock());
Assert.assertTrue(zkl.unlock());
Assert.assertTrue(zk2.lock());
Assert.assertTrue(zk2.unlock());
}
use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.
the class TableBlockUniqueIdentifier method getUniqueTableBlockName.
/**
* returns the String value to uniquely identify a block
*
* @return
*/
public String getUniqueTableBlockName() {
BlockInfo blockInfo = new BlockInfo(this.tableBlockInfo);
CarbonTableIdentifier carbonTableIdentifier = this.absoluteTableIdentifier.getCarbonTableIdentifier();
return carbonTableIdentifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + carbonTableIdentifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + this.tableBlockInfo.getSegmentId() + CarbonCommonConstants.FILE_SEPARATOR + blockInfo.hashCode();
}
use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.
the class DataConverterProcessorStepImpl method close.
@Override
public void close() {
if (!closed) {
if (null != badRecordLogger) {
badRecordLogger.closeStreams();
// rename the bad record in progress to normal
CarbonTableIdentifier identifier = configuration.getTableIdentifier().getCarbonTableIdentifier();
CarbonDataProcessorUtil.renameBadRecordsFromInProgressToNormal(identifier.getDatabaseName() + File.separator + identifier.getTableName() + File.separator + configuration.getSegmentId() + File.separator + configuration.getTaskNo());
}
super.close();
if (converters != null) {
for (RowConverter converter : converters) {
converter.finish();
}
}
}
}
use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.
the class DataConverterProcessorStepImpl method createBadRecordLogger.
private BadRecordsLogger createBadRecordLogger() {
boolean badRecordsLogRedirect = false;
boolean badRecordConvertNullDisable = false;
boolean isDataLoadFail = false;
boolean badRecordsLoggerEnable = Boolean.parseBoolean(configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ENABLE).toString());
Object bad_records_action = configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ACTION).toString();
if (null != bad_records_action) {
LoggerAction loggerAction = null;
try {
loggerAction = LoggerAction.valueOf(bad_records_action.toString().toUpperCase());
} catch (IllegalArgumentException e) {
loggerAction = LoggerAction.FORCE;
}
switch(loggerAction) {
case FORCE:
badRecordConvertNullDisable = false;
break;
case REDIRECT:
badRecordsLogRedirect = true;
badRecordConvertNullDisable = true;
break;
case IGNORE:
badRecordsLogRedirect = false;
badRecordConvertNullDisable = true;
break;
case FAIL:
isDataLoadFail = true;
break;
}
}
CarbonTableIdentifier identifier = configuration.getTableIdentifier().getCarbonTableIdentifier();
return new BadRecordsLogger(identifier.getBadRecordLoggerKey(), identifier.getTableName() + '_' + System.currentTimeMillis(), getBadLogStoreLocation(identifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + identifier.getTableName() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getSegmentId() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getTaskNo()), badRecordsLogRedirect, badRecordsLoggerEnable, badRecordConvertNullDisable, isDataLoadFail);
}
use of org.apache.carbondata.core.metadata.CarbonTableIdentifier in project carbondata by apache.
the class DataConverterProcessorWithBucketingStepImpl method createBadRecordLogger.
private BadRecordsLogger createBadRecordLogger() {
boolean badRecordsLogRedirect = false;
boolean badRecordConvertNullDisable = false;
boolean isDataLoadFail = false;
boolean badRecordsLoggerEnable = Boolean.parseBoolean(configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ENABLE).toString());
Object bad_records_action = configuration.getDataLoadProperty(DataLoadProcessorConstants.BAD_RECORDS_LOGGER_ACTION).toString();
if (null != bad_records_action) {
LoggerAction loggerAction = null;
try {
loggerAction = LoggerAction.valueOf(bad_records_action.toString().toUpperCase());
} catch (IllegalArgumentException e) {
loggerAction = LoggerAction.FORCE;
}
switch(loggerAction) {
case FORCE:
badRecordConvertNullDisable = false;
break;
case REDIRECT:
badRecordsLogRedirect = true;
badRecordConvertNullDisable = true;
break;
case IGNORE:
badRecordsLogRedirect = false;
badRecordConvertNullDisable = true;
break;
case FAIL:
isDataLoadFail = true;
break;
}
}
CarbonTableIdentifier identifier = configuration.getTableIdentifier().getCarbonTableIdentifier();
return new BadRecordsLogger(identifier.getBadRecordLoggerKey(), identifier.getTableName() + '_' + System.currentTimeMillis(), getBadLogStoreLocation(identifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + identifier.getTableName() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getSegmentId() + CarbonCommonConstants.FILE_SEPARATOR + configuration.getTaskNo()), badRecordsLogRedirect, badRecordsLoggerEnable, badRecordConvertNullDisable, isDataLoadFail);
}
Aggregations