8000 Merge branch 'hotfix-1.6.3' · githubcs/orientdb@dd92677 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd92677

Browse files
committed
Merge branch 'hotfix-1.6.3'
2 parents 24be347 + e7289dc commit dd92677

File tree

117 files changed

+2149
-3094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2149
-3094
lines changed

build.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<property environment="env"/>
66
<property name="vendor" value="NuvolaBase Ltd"/>
77
<property name="product" value="OrientDB"/>
8-
<property name="version" value="1.6.2"/>
8+
<property name="version" value="1.6.3"/>
99
<condition property="community.release" value="${releaseHome}/orientdb-community-${version}"
1010
else="../releases/orientdb-community-${version}">
1111
<isset property="releaseHome"/>
@@ -179,9 +179,9 @@
179179
</copy>
180180

181181
<delete dir="${community.release}/databases"/>
182-
<java fork="true" dir="graphdb" classname="com.orientechnologies.orient.graph.blueprints.TestLoadGraph">
182+
<java fork="true" dir="graphdb" classname="com.orientechnologies.orient.graph.blueprints.TestLoadGraph">
183183
<classpath>
184-
<fileset dir="${community.release}/lib" includes="*.jar"/>
184+
<fileset dir="${community.release}/lib" includes="*.jar"/>
185185
</classpath>
186186
</java>
187187

@@ -265,7 +265,7 @@
265265
<tarfileset dir="../releases/orientdb-community-${version}" mode="755">
266266
<include name="**/*.sh"/>
267267
</tarfileset>
268-
</tar>
268+
</tar>
269269
</target>
270270

271271
</project>

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.orientechnologies</groupId>
2626
<artifactId>orientdb-parent</artifactId>
27-
<version>1.6.2</version>
27+
<version>1.6.3</version>
2828
<relativePath>../</relativePath>
2929
</parent>
3030

client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -911,10 +911,8 @@ public Object command(final OCommandRequestText iCommand) {
911911
do {
912912

913913
OStorageRemoteThreadLocal.INSTANCE.get().commandExecuting = true;
914+
final OCommandRequestText aquery = iCommand;
914915
try {
915-
916-
final OCommandRequestText aquery = iCommand;
917-
918916
final boolean asynch = iCommand instanceof OCommandRequestAsynch && ((OCommandRequestAsynch) iCommand).isAsynchronous();
919917

920918
try {
@@ -930,6 +928,7 @@ public Object command(final OCommandRequestText iCommand) {
930928
try {
931929
beginResponse(network);
932930

931+
boolean addNextRecord = true;
933932
if (asynch) {
934933
byte status;
935934

@@ -942,19 +941,10 @@ public Object command(final OCommandRequestText iCommand) {
942941
switch (status) {
943942
case 1:
944943
// PUT AS PART OF THE RESULT SET. INVOKE THE LISTENER
945-
try {
946-
if (!aquery.getResultListener().result(record)) {
947-
// EMPTY THE INPUT CHANNEL
948-
while (network.in.available() > 0)
949-
network.in.read();
950-
951-
break;
952-
}
953-
} catch (Throwable t) {
954-
// ABSORBE ALL THE USER EXCEPTIONS
955-
t.printStackTrace();
944+
if (addNextRecord) {
945+
addNextRecord = aquery.getResultListener().result(record);
946+
database.getLevel1Cache().updateRecord(record);
956947
}
957-
database.getLevel1Cache().updateRecord(record);
958948
break;
959949

960950
case 2:
@@ -1010,20 +1000,19 @@ public Object command(final OCommandRequestText iCommand) {
10101000
}
10111001
break;
10121002
} finally {
1013-
if (aquery.getResultListener() != null) {
1014-
aquery.getResultListener().end();
1015-
}
10161003
endResponse(network);
10171004
}
1018-
10191005
} catch (OModificationOperationProhibitedException mope) {
10201006
handleDBFreeze();
10211007
} catch (Exception e) {
10221008
handleException(network, "Error on executing command: " + iCommand, e);
10231009

10241010
} finally {
10251011
OStorageRemoteThreadLocal.INSTANCE.get().commandExecuting = false;
1026-
}
1012+
if (aquery.getResultListener() != null) {
1013+
aquery.getResultListener().end();
1014+
}
1015+
}
10271016
} while (true);
10281017

10291018
return result;
@@ -1809,14 +1798,14 @@ private void removeDeadConnections() {
18091798
// FREE DEAD CONNECTIONS
18101799
int removedDeadConnections = 0;
18111800
for (OChannelBinaryAsynchClient n : new ArrayList<OChannelBinaryAsynchClient>(networkPool)) {
1812-
if (n != null && !n.isConnected()) //Fixed issue with removing of network connections though connection is active.
1801+
if (n != null && !n.isConnected()) // Fixed issue with removing of network connections though connection is active.
18131802
{
18141803
try {
18151804
n.close();
18161805
} catch (Exception e) {
18171806
}
1818-
networkPool.remove(n);
1819-
removedDeadConnections++;
1807+
networkPool.remove(n);
1808+
removedDeadConnections++;
18201809
}
18211810
}
18221811

commons/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.orientechnologies</groupId>
2626
<artifactId>orientdb-parent</artifactId>
27-
<version>1.6.2</version>
27+
<version>1.6.3</version>
2828
<relativePath>../</relativePath>
2929
</parent>
3030

@@ -34,7 +34,9 @@
3434

3535
<properties>
3636
<osgi.export>com.orientechnologies.common.*</osgi.export>
37-
<osgi.import>javax.imageio.spi.*,sun.misc.*;resolution:=optional</osgi.import>
37+
<osgi.import>
38+
javax.imageio.spi.*,sun.misc.*;resolution:=optional,com.orientechnologies.nio;resolution:=optional
39+
</osgi.import>
3840
</properties>
3941

4042
<dependencies>

commons/src/main/java/com/orientechnologies/common/console/ODFACommandStream.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public String nextCommand() {
9898
}
9999
}
100100

101-
final String result;
101+
String result;
102102
if (partialResult.length() > 0) {
103103
if (end > 0) {
104104
result = partialResult.append(buffer.subSequence(start, end + 1).toString()).toString();
@@ -107,7 +107,10 @@ public String nextCommand() {
107107
result = partialResult.toString();
108108
}
109109
} else {
110-
result = buffer.subSequence(start, end + 1).toString();
110+
// DON'T PUT THIS ON ONE LINE ONLY BECAUSE WITH JDK6 subSequence() RETURNS A CHAR CharSequence while JDK7+ RETURNS
111+
// CharBuffer
112+
final CharSequence cs = buffer.subSequence(start, end + 1);
113+
result = cs.toString();
111114
}
112115

113116
buffer.position(buffer.position() + position);

commons/src/main/java/com/orientechnologies/common/directmemory/ODirectMemoryFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ODirectMemoryFactory {
3333
localDirectMemory = null;
3434
else
3535
localDirectMemory = (ODirectMemory) jnaClass.newInstance();
36-
} catch (Exception e) {
36+
} catch (Throwable e) {
3737
// ignore
3838
}
3939

@@ -48,7 +48,7 @@ class ODirectMemoryFactory {
4848
"Sun Unsafe direct memory implementation is going to be used, "
4949
+ "this implementation is not stable so please use JNA version instead.");
5050
}
51-
} catch (Exception e) {
51+
} catch (Throwable e) {
5252
// ignore
5353
}
5454
}

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>com.orientechnologies</groupId>
1919
<artifactId>orientdb-parent</artifactId>
20-
<version>1.6.2</version>
20+
<version>1.6.3</version>
2121
<relativePath>../</relativePath>
2222
</parent>
2323

core/src/main/java/com/orientechnologies/orient/core/OConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.orientechnologies.orient.core;
1717

1818
public class OConstants {
19-
public static final String ORIENT_VERSION = "1.6.2";
19+
public static final String ORIENT_VERSION = "1.6.3";
2020
public static final String ORIENT_URL = "www.orientechnologies.com";
2121

2222
public static String getVersion() {

core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public enum OGlobalConfiguration {
8181
"Maximum size of WAL cache (in amount of WAL pages, each page is 64k) <= 0 means that caching will be switched off.",
8282
Integer.class, 3000),
8383

84-
WAL_MAX_SEGMENT_SIZE("storage.wal.maxSegmentSize", "Maximum size of single WAL segment in megabytes.", Integer.class, 256),
84+
WAL_MAX_SEGMENT_SIZE("storage.wal.maxSegmentSize", "Maximum size of single. WAL segment in megabytes.", Integer.class, 256),
8585

8686
WAL_MAX_SIZE("storage.wal.maxSize", "Maximum size of WAL on disk in megabytes.", Integer.class, 4 * 1024),
8787

@@ -93,6 +93,13 @@ public enum OGlobalConfiguration {
9393
WAL_FUZZY_CHECKPOINT_INTERVAL("storage.wal.fuzzyCheckpointInterval", "Interval between fuzzy checkpoints (in seconds)",
9494
Integer.class, 2592000),
9595

96+
WAL_REPORT_AFTER_OPERATIONS_DURING_RESTORE(
97+
"storage.wal.reportAfterOperationsDuringRestore",
98+
"Amount of processed log operations, after which status of data restore procedure will be printed 0 or negative value, means that status will not be printed",
99+
Integer.class, 10000),
100+
101+
WAL_READ_CACHE_SIZE("storage.wal.readCacheSize", "Size of WAL read cache in amount of pages", Integer.class, 1000),
102+
96103
WAL_FUZZY_CHECKPOINT_SHUTDOWN_TIMEOUT("storage.wal.fuzzyCheckpointShutdownWait",
97104
"Interval which we should wait till shutdown (in seconds)", Integer.class, 60 * 10),
98105

core/src/main/java/com/orientechnologies/orient/core/db/record/ridset/sbtree/OIndexRIDContainer.java

100644100755
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,30 @@ public class OIndexRIDContainer implements Set<OIdentifiable> {
4242
private int bottomThreshold = 60;
4343

4444
public OIndexRIDContainer(String name) {
45+
fileId = resolveFileIdByName(name + INDEX_FILE_EXTENSION);
46+
underlying = new HashSet<OIdentifiable>();
47+
isEmbedded = true;
48+
}
49< 10000 /code>+
50+
public OIndexRIDContainer(String fileName, Set<OIdentifiable> underlying, boolean autoConvert) {
51+
this.fileId = resolveFileIdByName(fileName + INDEX_FILE_EXTENSION);
52+
this.underlying = underlying;
53+
isEmbedded = !(underlying instanceof OIndexRIDContainerSBTree);
54+
if (!autoConvert) {
55+
assert !isEmbedded;
56+
topThreshold = -1;
57+
bottomThreshold = -1;
58+
}
59+
}
60+
61+
private long resolveFileIdByName(String fileName) {
4562
final OStorageLocalAbstract storage = (OStorageLocalAbstract) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage()
4663
.getUnderlying();
4764
try {
48-
fileId = storage.getDiskCache().openFile(name + INDEX_FILE_EXTENSION);
65+
return storage.getDiskCache().openFile(fileName);
4966
} catch (IOException e) {
50-
throw new OSBTreeException("Error creation of sbtree with name" + name, e);
67+
throw new OSBTreeException("Error creation of sbtree with name" + fileName, e);
5168
}
52-
underlying = new HashSet<OIdentifiable>();
53-
isEmbedded = true;
5469
}
5570

5671
public OIndexRIDContainer(long fileId, Set<OIdentifiable> underlying) {
@@ -171,6 +186,14 @@ private void convertToEmbedded() {
171186
isEmbedded = true;
172187
}
173188

189+
/**
190+
* If set is embedded convert it not embedded representation.
191+
*/
192+
public void checkNotEmbedded() {
193+
if (isEmbedded)
194+
convertToSbTree();
195+
}
196+
174197
private void convertToSbTree() {
175198
final OIndexRIDContainerSBTree tree = new OIndexRIDContainerSBTree(fileId);
176199

core/src/main/java/com/orientechnologies/orient/core/db/record/ridset/sbtree/OIndexRIDContainerSBTree.java

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ public void delete() {
189189
tree.delete();
190190
}
191191

192-
public String getFileName() {
193-
return tree.getFileName();
192+
public String getName() {
193+
return tree.getName();
194194
}
195195

196196
private static class TreeKeyIterator implements Iterator<OIdentifiable> {

core/src/main/java/com/orientechnologies/orient/core/db/record/ridset/sbtree/OSBTreeRIDSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @author <a href="mailto:enisher@gmail.com">Artem Orobets</a>
4444
*/
4545
public class OSBTreeRIDSet implements Set<OIdentifiable>, OStringBuilderSerializable, ORecordLazyMultiValue {
46-
private final long fileId;
46+
private final long fileId;
4747
private final OBonsaiBucketPointer rootPointer;
4848
private ORecordInternal<?> owner;
4949
private boolean autoConvertToRecord = true;
@@ -256,7 +256,7 @@ public static OSBTreeRIDSet fromStream(String stream, ORecordInternal<?> owner)
256256
doc.fromString(stream);
257257
final OBonsaiBucketPointer rootIndex = new OBonsaiBucketPointer((Long) doc.field("rootIndex"),
258258
(Integer) doc.field("rootOffset"));
259-
final long fileId = doc.field("fileId");
259+
final long fileId = (Long) doc.field("fileId");
260260

261261
return new OSBTreeRIDSet(owner, fileId, rootIndex);
262262
}

core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseCompare.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,41 @@ public Long call() {
308308
++differences;
309309
}
310310

311+
final ODocument metadataOne = indexOne.getMetadata();
312+
final ODocument metadataTwo = indexTwo.getMetadata();
313+
314+
if (metadataOne == null && metadataTwo != null) {
315+
ok = false;
316+
listener.onMessage("\n- ERR: Metadata for index " + indexOne.getName() + " for DB1 is null but for DB2 is not.");
317+
listener.onMessage("\n");
318+
++differences;
319+
} else if (metadataOne != null && metadataTwo == null) {
320+
ok = false;
321+
listener.onMessage("\n- ERR: Metadata for index " + indexOne.getName() + " for DB1 is not null but for DB2 is null.");
322+
listener.onMessage("\n");
323+
++differences;
324+
} else if (metadataOne != null && metadataTwo != null
325+
&& !ODocumentHelper.hasSameContentOf(metadataOne, databaseDocumentTxOne, metadataTwo, databaseDocumentTxTwo, ridMapper)) {
326+
ok = false;
327+
listener.onMessage("\n- ERR: Metadata for index " + indexOne.getName() + " for DB1 and for DB2 are different.");
328+
makeDbCall(databaseDocumentTxOne, new ODbRelatedCall<Object>() {
329+
@Override
330+
public Object call() {
331+
listener.onMessage("\n--- M1: " + metadataOne);
332+
return null;
333+
}
334+
});
335+
makeDbCall(databaseDocumentTxTwo, new ODbRelatedCall<Object>() {
336+
@Override
337+
public Object call() {
338+
listener.onMessage("\n--- M2: " + metadataTwo);
339+
return null;
340+
}
341+
});
342+
listener.onMessage("\n");
343+
++differences;
344+
}
345+
311346
if (((compareEntriesForAutomaticIndexes && !indexOne.getType().equals("DICTIONARY")) || !indexOne.isAutomatic())) {
312347
final Iterator<Map.Entry<Object, Object>> indexIteratorOne = makeDbCall(databaseDocumentTxOne,
313348
new ODbRelatedCall<Iterator<Map.Entry<Object, Object>>>() {

core/src/main/java/com/orientechnologies/orient/core/db/tool/ODatabaseExport.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
public class ODatabaseExport extends ODatabaseImpExpAbstract {
5959
protected OJSONWriter writer;
6060
protected long recordExported;
61-
public static final int VERSION = 6;
61+
public static final int VERSION = 7;
6262

6363
public ODatabaseExport(final ODatabaseRecord iDatabase, final String iFileName, final OCommandOutputListener iListener)
6464
throws IOException {
@@ -339,6 +339,10 @@ private void exportIndexDefinitions() throws IOException {
339339
writer.endObject(4, true);
340340
}
341341

342+
ODocument metadata = index.getMetadata();
343+
if (metadata != null)
344+
writer.writeAttribute(4, true, "metadata", metadata);
345+
342346
writer.endObject(2, true);
343347
listener.onMessage("OK");
344348
}

0 commit comments

Comments
 (0)
0