Skip to content

Commit

Permalink
Merge branch 'hotfix-1.6.2' of https://github.com/orientechnologies/o…
Browse files Browse the repository at this point in the history
…rientdb into hotfix-1.6.2
  • Loading branch information
lvca committed Dec 4, 2013
2 parents c2b009e + 41d51ef commit dcf71e1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ LRUList getA1in() {
@Override
public long openFile(final String fileName) throws IOException {
synchronized (syncObject) {
final long fileId = writeCache.openFile(fileName);
long fileId = writeCache.isOpen(fileName);
if (fileId >= 0)
return fileId;

fileId = writeCache.openFile(fileName);
filePages.put(fileId, new HashSet<Long>());

return fileId;
Expand All @@ -115,6 +119,9 @@ public long openFile(final String fileName) throws IOException {
@Override
public void openFile(final long fileId) throws IOException {
synchronized (syncObject) {
if (writeCache.isOpen(fileId))
return;

writeCache.openFile(fileId);
filePages.put(fileId, new HashSet<Long>());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,22 @@ public boolean isOpen(long fileId) {
}
}

public long isOpen(String fileName) throws IOException {
synchronized (syncObject) {
initNameIdMapping();

final Long fileId = nameIdMap.get(fileName);
if (fileId == null)
return -1;

final OFileClassic fileClassic = files.get(fileId);
if (fileClassic == null || !fileClassic.isOpen())
return -1;

return fileId;
}
}

public void setSoftlyClosed(long fileId, boolean softlyClosed) throws IOException {
synchronized (syncObject) {
OFileClassic fileClassic = files.get(fileId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ public static int[] readableClusters(final ODatabaseRecord iDatabase, final int[
iDatabase.checkSecurity(ODatabaseSecurityResources.CLUSTER, ORole.PERMISSION_READ, clusterName);
listOfReadableIds.add(clusterId);
} catch (OSecurityAccessException securityException) {
all = false;
// if the cluster is inaccessible it's simply not processed in the list.add
}
}
Expand Down

0 comments on commit dcf71e1

Please sign in to comment.