private TableACL loadTableACL(String project) throws IOException { TableACL acl = crud.reload(project); if (acl == null) { acl = newTableACL(project); } return acl; }
public HybridInstance reloadHybridInstance(String name) { try (AutoLock l = lock.lockForWrite()) { return crud.reload(name); } }
public DataModelDesc reloadDataModel(String modelName) { try (AutoLock lock = modelMapLock.lockForWrite()) { return crud.reload(modelName); } }
CubeInstance reloadCube(String cubeName) { try (AutoLock lock = cubeMapLock.lockForWrite()) { return crud.reload(cubeName); } }
public CubeDesc reloadCubeDescLocal(String name) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { CubeDesc ndesc = crud.reload(name); clearCuboidCache(name); // Broken CubeDesc is not allowed to be saved and broadcast. if (ndesc.isBroken()) throw new IllegalStateException("CubeDesc " + name + " is broken"); return ndesc; } }
public T save(T entity) throws IOException { Preconditions.checkArgument(entity != null); completeUuidIfNeeded(entity); Preconditions.checkArgument(entityType.isInstance(entity)); String resName = entity.resourceName(); Preconditions.checkArgument(resName != null && resName.length() > 0); if (checkCopyOnWrite) { if (entity.isCachedAndShared() || cache.get(resName) == entity) { throw new IllegalStateException("Copy-on-write violation! The updating entity " + entity + " is a shared object in " + entityType.getSimpleName() + " cache, which should not be."); } } String path = resourcePath(resName); logger.debug("Saving {} at {}", entityType.getSimpleName(), path); store.checkAndPutResource(path, entity, serializer); // just to trigger the event broadcast, the entity won't stay in cache cache.put(resName, entity); // keep the pass-in entity out of cache, the caller may use it for further update // return a reloaded new object return reload(resName); }
private void updateTempStatementWithRetry(TempStatementEntity entity, int retry) throws IOException { try { crud.save(entity); } catch (WriteConflictException ise) { logger.warn("Write conflict to update temp statement" + entity.statementId + " at try " + retry + ", will retry..."); if (retry >= 7) { logger.error("Retried 7 times till got error, abandoning...", ise); throw ise; } TempStatementEntity reload = crud.reload(entity.resourceName()); entity = prepareToOverwrite(entity, reload); updateTempStatementWithRetry(entity, ++retry); } }
cube = crud.reload(cube.getName()); update.setCubeInstance(cube.latestCopyForWrite()); return updateCubeWithRetry(update, ++retry);
/** * the project-specific table desc will be expand by computed columns from the projects' models * when the projects' model list changed, project-specific table should be reset and get expanded * again */ public void resetProjectSpecificTableDesc(String prj) throws IOException { // avoid cyclic locks ProjectInstance project = ProjectManager.getInstance(config).getProject(prj); try (AutoLock lock = srcTableMapLock.lockForWrite()) { for (String tableName : project.getTables()) { String tableIdentity = getTableIdentity(tableName); String key = mapKey(tableIdentity, prj); TableDesc originTableDesc = srcTableMap.get(key); if (originTableDesc == null) { continue; } if (originTableDesc.isBorrowedFromGlobal()) { srcTableMap.removeLocal(key);//delete it so that getProjectSpecificTableDesc will create again } else { srcTableCrud.reload(key); } } } }
public DataModelDesc reloadDataModel(String modelName) { try (AutoLock lock = modelMapLock.lockForWrite()) { return crud.reload(modelName); } }
private TableACL loadTableACL(String project) throws IOException { TableACL acl = crud.reload(project); if (acl == null) { acl = newTableACL(project); } return acl; }
public HybridInstance reloadHybridInstance(String name) { try (AutoLock l = lock.lockForWrite()) { return crud.reload(name); } }
CubeInstance reloadCube(String cubeName) { try (AutoLock lock = cubeMapLock.lockForWrite()) { return crud.reload(cubeName); } }
public CubeDesc reloadCubeDescLocal(String name) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { CubeDesc ndesc = crud.reload(name); clearCuboidCache(name); // Broken CubeDesc is not allowed to be saved and broadcast. if (ndesc.isBroken()) throw new IllegalStateException("CubeDesc " + name + " is broken"); return ndesc; } }
private void updateTempStatementWithRetry(TempStatementEntity entity, int retry) throws IOException { try { crud.save(entity); } catch (WriteConflictException ise) { logger.warn("Write conflict to update temp statement" + entity.statementId + " at try " + retry + ", will retry..."); if (retry >= 7) { logger.error("Retried 7 times till got error, abandoning...", ise); throw ise; } TempStatementEntity reload = crud.reload(entity.resourceName()); entity = prepareToOverwrite(entity, reload); updateTempStatementWithRetry(entity, ++retry); } }
public T save(T entity) throws IOException { Preconditions.checkArgument(entity != null); completeUuidIfNeeded(entity); Preconditions.checkArgument(entityType.isInstance(entity)); String resName = entity.resourceName(); Preconditions.checkArgument(resName != null && resName.length() > 0); if (checkCopyOnWrite) { if (entity.isCachedAndShared() || cache.get(resName) == entity) { throw new IllegalStateException("Copy-on-write violation! The updating entity " + entity + " is a shared object in " + entityType.getSimpleName() + " cache, which should not be."); } } String path = resourcePath(resName); logger.debug("Saving {} at {}", entityType.getSimpleName(), path); store.checkAndPutResource(path, entity, serializer); // just to trigger the event broadcast, the entity won't stay in cache cache.put(resName, entity); // keep the pass-in entity out of cache, the caller may use it for further update // return a reloaded new object return reload(resName); }
cube = crud.reload(cube.getName()); update.setCubeInstance(cube.latestCopyForWrite()); return updateCubeWithRetry(update, ++retry);
/** * the project-specific table desc will be expand by computed columns from the projects' models * when the projects' model list changed, project-specific table should be reset and get expanded * again */ public void resetProjectSpecificTableDesc(String prj) throws IOException { // avoid cyclic locks ProjectInstance project = ProjectManager.getInstance(config).getProject(prj); try (AutoLock lock = srcTableMapLock.lockForWrite()) { for (String tableName : project.getTables()) { String tableIdentity = getTableIdentity(tableName); String key = mapKey(tableIdentity, prj); TableDesc originTableDesc = srcTableMap.get(key); if (originTableDesc == null) { continue; } if (originTableDesc.isBorrowedFromGlobal()) { srcTableMap.removeLocal(key);//delete it so that getProjectSpecificTableDesc will create again } else { srcTableCrud.reload(key); } } } }