@Override public boolean isSaveable() { return delegate.isSaveable(); }
private boolean refreshSourceNames() throws NamespaceException { final Set<NamespaceKey> foundKeys = Sets.newHashSet(systemUserNamespaceService.getAllDatasets(sourceKey)); boolean changed = false; try { for (SourceTableDefinition accessor : plugin.get() .getDatasets(SYSTEM_USERNAME, msp.getDefaultRetrievalOptions())) { // names only added, never removed. Removal can be done by the full refresh (refreshSource()) if (!foundKeys.contains(accessor.getName()) && accessor.isSaveable()) { try { saver.shallowSave(accessor); changed = true; } catch (ConcurrentModificationException ex) { logger.debug("Concurrent update, ignoring.", ex); } } } // persist last refresh for across restarts. SourceInternalData srcData = sourceDataStore.get(sourceKey); if(srcData == null) { srcData = new SourceInternalData(); srcData.setName(sourceKey.getRoot()); } srcData.setLastNameRefreshDateMs(System.currentTimeMillis()); sourceDataStore.put(sourceKey, srcData); } catch (Exception ex){ logger.warn("Failure while attempting to update metadata for source {}. Terminating update of this source.", sourceKey, ex); } return changed; }
if(!accessor.isSaveable()){ continue;
private static SourceTableDefinition newDataset(final String dsPath) { final List<String> path = SqlUtils.parseSchemaPath(dsPath); SourceTableDefinition ret = mock(SourceTableDefinition.class); NamespaceKey datasetName = new NamespaceKey(path); when(ret.getName()).thenReturn(datasetName); BatchSchema schema = BatchSchema.newBuilder() .addField(new Field("string", FieldType.nullable(ArrowType.Utf8.INSTANCE), null)) .build(); DatasetConfig dsConfig = new DatasetConfig() .setName(Util.last(path)) .setFullPathList(path) .setType(DatasetType.PHYSICAL_DATASET_SOURCE_FILE) .setRecordSchema(ByteString.EMPTY) .setPhysicalDataset( new PhysicalDataset() .setFormatSettings(null)) .setSchemaVersion(DatasetHelper.CURRENT_VERSION) .setRecordSchema(schema.toByteString()) .setReadDefinition(new ReadDefinition()); try { when(ret.getDataset()).thenReturn(dsConfig); } catch (Exception ignored) { } when(ret.getType()).thenReturn(DatasetType.PHYSICAL_DATASET_SOURCE_FILE); when(ret.isSaveable()).thenReturn(true); return ret; }
if(tableDefinition.isSaveable()) { plugin.getSaver().completeSave(newDatasetConfig, splits);