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第一次我被卡住了很長時間沒有想到原因! –