1
使用机制的文档我用的“块” 列表它们存储在ID为3文件在集群:默认情况下都不可删除
群集名为default如果我要这样的块存储我的BLOB SELECT COUNT(*)从3:1,我得到1
然后我申请 删除#3:1我的回报:1从3号返回0
并再次 SELECT COUNT(*) 1
如何删除此文档以及为何删除不适用?
块创建:
private ODocument save(OrientGraph graph, byte[] content) throws IOException {
graph.getRawGraph().declareIntent(new OIntentMassiveInsert());
List<ORID> chunks = new ArrayList<ORID>();
InputStream in = new BufferedInputStream(new ByteArrayInputStream(content));
while (in.available() > 0) {
final ORecordBytes chunk = new ORecordBytes();
chunk.fromInputStream(in, BLOCK_SIZE);
graph.getRawGraph().save(chunk);
chunks.add(chunk.getIdentity());
}
ODocument record = new ODocument();
record.field(Resource.RESOURCE_FIELD_CHUNKS, chunks);
log.debug("Splitted file to {}", chunks.size());
graph.getRawGraph().save(record);
graph.getRawGraph().declareIntent(null);
return record;
}
然后阅读是确定与
ORecordLazyList blocks = doc.field(Resource.RESOURCE_FIELD_CONTENT);
if (blocks == null) {
log.error("No data content for {}", rid);
return;
}
for (OIdentifiable id : (List<OIdentifiable>) blocks) {
ORecordBytes chunk = (ORecordBytes) id.getRecord();
chunk.toOutputStream(out);
chunk.unload();
}
但使用SQL创建删除命令返回0 ,并尝试进行遍历各地删除返回一个空的对象
String selectChunks = String.format("select %s from %s ",
Resource.RESOURCE_FIELD_CONTENT, resourceID);
Get(selectChunks, graph).forEach(ids -> {
OrientVertex rs = (OrientVertex) ids.getProperty(Resource.RESOURCE_FIELD_CONTENT);
OrientElementIterable chunks = rs.getProperty(Resource.RESOURCE_FIELD_CHUNKS);
chunks.forEach(chunk -> {
CHUNK IS NULL !!!! no delete()
});
});
使用
String selectChunks = String.format("select %[email protected]() from %s ",
Resource.RESOURCE_FIELD_CONTENT + "." + Resource.RESOURCE_FIELD_CHUNKS, resourceID);
将返回ID但结合SQL命令返回0修改的条目。
嗨@Robert哪个版本您使用的?你能发布代码吗? –
我已经完成了这个问题谢谢@MichelaBonizzi第一次我被卡住了很长时间没有想到原因! –