This is an automated email from the ASF dual-hosted git repository.
daim pushed a commit to branch DetailedGC/OAK-10199
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/DetailedGC/OAK-10199 by this
push:
new 39bc511ebd merged trunk to detailedGC branch : fixed unit cases
failures
39bc511ebd is described below
commit 39bc511ebd43367761259145b09e8da3a0b601a1
Author: Rishabh Kumar <[email protected]>
AuthorDate: Fri Jan 26 01:56:06 2024 +0530
merged trunk to detailedGC branch : fixed unit cases failures
---
.../oak/plugins/document/NodeDocument.java | 4 --
.../oak/plugins/document/rdb/RDBDocumentStore.java | 62 +++++++++-------------
.../plugins/document/rdb/RDBDocumentStoreJDBC.java | 21 ++++----
3 files changed, 35 insertions(+), 52 deletions(-)
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
index d3dc518a95..8f0cfa6d80 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
@@ -1662,16 +1662,12 @@ public final class NodeDocument extends Document {
/**
* Returns name of all the properties on this document
-<<<<<<< HEAD
* <p>
* Note: property names returned are escaped
*
* @return Set of all property names (escaped)
* @see Utils#unescapePropertyName(String)
* @see Utils#escapePropertyName(String)
-=======
- * @return Set of all property names
->>>>>>> 710308b51a (OAK-10199 : override getModifiedDocs() for RDB and added
unit cases for deletedProps)
*/
@NotNull
Set<String> getPropertyNames() {
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
index 3a9ef2d95d..24137fb480 100755
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
@@ -99,7 +99,7 @@ import org.apache.jackrabbit.guava.common.collect.Sets;
/**
* Implementation of {@link DocumentStore} for relational databases.
- *
+ *
* <h3 id="apidocs.supported-databases">Supported Databases</h3>
* <p>
* The code is supposed to be sufficiently generic to run with a variety of
@@ -115,7 +115,7 @@ import org.apache.jackrabbit.guava.common.collect.Sets;
* <li>Microsoft SQL Server</li>
* <li>Oracle</li>
* </ul>
- *
+ *
* <h3 id="apidocs.table-layout">Table Layout</h3>
* <p>
* Data for each of the DocumentStore's {@link Collection}s is stored in its
own
@@ -237,11 +237,11 @@ import org.apache.jackrabbit.guava.common.collect.Sets;
* create them "manually". The oak-run "<a
href="https://jackrabbit.apache.org/oak/docs/nodestore/document/rdb-document-store.html#rdbddldump"><code>rdbddldump</code></a>"
* command can be used to print out the DDL statements that would have been
used for auto-creation
* and/or automatic schema updates.
- *
+ *
* <h3>Caching</h3>
* <p>
* The cache borrows heavily from the {@link MongoDocumentStore}
implementation.
- *
+ *
* <h3>Queries</h3>
* <p>
* The implementation currently supports only three indexed properties: "_bin",
@@ -290,7 +290,7 @@ public class RDBDocumentStore implements DocumentStore {
@NotNull
@Override
public <T extends Document> List<T> query(Collection<T> collection, String
fromKey, String toKey, String indexedProperty,
- long startValue, int limit) {
+ long startValue, int limit) {
List<QueryCondition> conditions = Collections.emptyList();
if (indexedProperty != null) {
conditions = Collections.singletonList(new
QueryCondition(indexedProperty, ">=", startValue));
@@ -300,7 +300,7 @@ public class RDBDocumentStore implements DocumentStore {
@NotNull
protected <T extends Document> List<T> query(Collection<T> collection,
String fromKey, String toKey,
- List<String> excludeKeyPatterns, List<QueryCondition> conditions,
int limit) {
+ List<String>
excludeKeyPatterns, List<QueryCondition> conditions, int limit) {
return internalQuery(collection, fromKey, toKey, excludeKeyPatterns,
conditions, limit);
}
@@ -971,8 +971,8 @@ public class RDBDocumentStore implements DocumentStore {
public static String VERSIONPROP = "__version";
// set of supported indexed properties
- private static final Set<String> INDEXEDPROPERTIES = new
HashSet<>(Arrays.asList(MODIFIED,
- NodeDocument.HAS_BINARY_FLAG, NodeDocument.DELETED_ONCE,
NodeDocument.SD_TYPE, NodeDocument.SD_MAX_REV_TIME_IN_SECS, VERSIONPROP, ID));
+ private static final Set<String> INDEXEDPROPERTIES = new
HashSet<String>(Arrays.asList(new String[] { MODIFIED,
+ NodeDocument.HAS_BINARY_FLAG, NodeDocument.DELETED_ONCE,
NodeDocument.SD_TYPE, NodeDocument.SD_MAX_REV_TIME_IN_SECS, VERSIONPROP }));
// set of required table columns
private static final Set<String> REQUIREDCOLUMNS =
Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
@@ -1269,7 +1269,7 @@ public class RDBDocumentStore implements DocumentStore {
}
return result;
}
-
+
private static class IndexInformation {
public Map<Integer, String> fields;
public boolean nonunique;
@@ -1282,7 +1282,7 @@ public class RDBDocumentStore implements DocumentStore {
}
private void createTableFor(Connection con, Collection<? extends Document>
col, RDBTableMetaData tmd, List<String> tablesCreated,
- List<String> tablesPresent, int initialSchema, int
upgradeToSchema) throws SQLException {
+ List<String> tablesPresent, int initialSchema,
int upgradeToSchema) throws SQLException {
String dbname = this.dbInfo.toString();
if (con.getMetaData().getURL() != null) {
@@ -1473,7 +1473,7 @@ public class RDBDocumentStore implements DocumentStore {
return wasChanged;
}
-
+
private static void getTableMetaData(Connection con, Collection<? extends
Document> col, RDBTableMetaData tmd) throws SQLException {
Statement checkStatement = null;
ResultSet checkResultSet = null;
@@ -1612,7 +1612,7 @@ public class RDBDocumentStore implements DocumentStore {
@Nullable
private <T extends Document> T internalCreateOrUpdate(Collection<T>
collection, UpdateOp update, boolean allowCreate,
- boolean checkConditions, int retries) {
+ boolean
checkConditions, int retries) {
T oldDoc = readDocumentCached(collection, update.getId(),
Integer.MAX_VALUE);
if (oldDoc == null) {
@@ -1655,9 +1655,9 @@ public class RDBDocumentStore implements DocumentStore {
result = internalCreateOrUpdate(collection, update,
allowCreate, checkConditions, retries - 1);
}
else {
- LOG.error("update of " + update.getId() + " failed, race
condition?");
- throw new DocumentStoreException("update of " +
update.getId() + " failed, race condition?", null,
- DocumentStoreException.Type.TRANSIENT);
+ LOG.error("update of " + update.getId() + " failed, race
condition?");
+ throw new DocumentStoreException("update of " +
update.getId() + " failed, race condition?", null,
+ DocumentStoreException.Type.TRANSIENT);
}
}
return result;
@@ -1669,7 +1669,7 @@ public class RDBDocumentStore implements DocumentStore {
*/
@Nullable
private <T extends Document> T internalUpdate(Collection<T> collection,
UpdateOp update, T oldDoc, boolean checkConditions,
- int maxRetries) {
+ int maxRetries) {
if (checkConditions && !UpdateUtils.checkConditions(oldDoc,
update.getConditions())) {
return null;
} else {
@@ -1756,7 +1756,7 @@ public class RDBDocumentStore implements DocumentStore {
}
private <T extends Document> List<T> internalQuery(Collection<T>
collection, String fromKey, String toKey,
- List<String> excludeKeyPatterns, List<QueryCondition> conditions,
int limit) {
+ List<String>
excludeKeyPatterns, List<QueryCondition> conditions, int limit) {
Connection connection = null;
RDBTableMetaData tmd = getTable(collection);
for (QueryCondition cond : conditions) {
@@ -1840,7 +1840,7 @@ public class RDBDocumentStore implements DocumentStore {
}
protected <T extends Document> Iterable<T> queryAsIterable(final
Collection<T> collection, String fromKey, String toKey,
- final List<String> excludeKeyPatterns, final List<QueryCondition>
conditions, final int limit, final List<String> sortBy) {
+ final
List<String> excludeKeyPatterns, final List<QueryCondition> conditions, final
int limit, final String sortBy) {
final RDBTableMetaData tmd = getTable(collection);
Set<String> allowedProps = Sets.intersection(INDEXEDPROPERTIES,
tmd.getColumnProperties());
@@ -1853,16 +1853,6 @@ public class RDBDocumentStore implements DocumentStore {
}
}
- if (sortBy != null && !sortBy.isEmpty()) {
- for (String key: sortBy) {
- if (!allowedProps.contains(key)) {
- final String message = "indexed property " + key + " not
supported. supported properties are " + allowedProps;
- LOG.error(message);
- throw new UnsupportedIndexedPropertyException(message);
- }
- }
- }
-
final String from = collection == Collection.NODES &&
NodeDocument.MIN_ID_VALUE.equals(fromKey) ? null : fromKey;
final String to = collection == Collection.NODES &&
NodeDocument.MAX_ID_VALUE.equals(toKey) ? null : toKey;
@@ -1900,19 +1890,19 @@ public class RDBDocumentStore implements DocumentStore {
}
protected <T extends Document> long queryCount(final Collection<T>
collection, String fromKey, String toKey,
- final List<String> excludeKeyPatterns, final List<QueryCondition>
conditions) {
+ final List<String>
excludeKeyPatterns, final List<QueryCondition> conditions) {
return internalGetAggregate(collection, "COUNT", "*", fromKey, toKey,
excludeKeyPatterns, conditions);
}
protected <T extends Document> long getMinValue(final Collection<T>
collection, String field, String fromKey, String toKey,
- final List<String> excludeKeyPatterns, final List<QueryCondition>
conditions) {
+ final List<String>
excludeKeyPatterns, final List<QueryCondition> conditions) {
return internalGetAggregate(collection, "MIN", field, fromKey, toKey,
excludeKeyPatterns, conditions);
}
private <T extends Document> long internalGetAggregate(final Collection<T>
collection, final String aggregrate, String field,
- String fromKey, String toKey, final List<String>
excludeKeyPatterns, final List<QueryCondition> conditions) {
+ String fromKey,
String toKey, final List<String> excludeKeyPatterns, final List<QueryCondition>
conditions) {
final RDBTableMetaData tmd = getTable(collection);
for (QueryCondition cond : conditions) {
@@ -2075,7 +2065,7 @@ public class RDBDocumentStore implements DocumentStore {
}
private <T extends Document> boolean updateDocument(@NotNull Collection<T>
collection, @NotNull T document,
- @NotNull UpdateOp update, Long oldmodcount) {
+ @NotNull UpdateOp
update, Long oldmodcount) {
Connection connection = null;
RDBTableMetaData tmd = getTable(collection);
String data = null;
@@ -2139,7 +2129,7 @@ public class RDBDocumentStore implements DocumentStore {
private static void continueIfStringOverflow(SQLException ex) throws
SQLException {
String state = ex.getSQLState();
if ("22001".equals(state) /* everybody */|| ("72000".equals(state) &&
1489 == ex.getErrorCode()) /* Oracle */
- || ("S0001".equals(state) && 2628 == ex.getErrorCode())
/* MSSQL update*/) {
+ || ("S0001".equals(state) && 2628 == ex.getErrorCode()) /*
MSSQL update*/) {
// ok
} else {
throw (ex);
@@ -2405,7 +2395,7 @@ public class RDBDocumentStore implements DocumentStore {
}
private <T extends Document> DocumentStoreException handleException(String
message, Exception ex, Collection<T> collection,
- java.util.Collection<String> ids) {
+
java.util.Collection<String> ids) {
if (collection == Collection.NODES) {
for (String id : ids) {
invalidateCache(collection, id, false);
@@ -2415,7 +2405,7 @@ public class RDBDocumentStore implements DocumentStore {
}
private <T extends Document> DocumentStoreException handleException(String
message, Exception ex, Collection<T> collection,
- String id) {
+ String
id) {
return handleException(message, ex, collection,
Collections.singleton(id));
}
@@ -2493,4 +2483,4 @@ public class RDBDocumentStore implements DocumentStore {
}
}
}
-}
+}
\ No newline at end of file
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
index 59dfb968b0..3ca7601de6 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.document.rdb;
-import static java.util.List.of;
-import static java.util.stream.Collectors.joining;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSet;
import static
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.CHAR2OCTETRATIO;
@@ -88,7 +86,7 @@ public class RDBDocumentStoreJDBC {
private final int queryHitsLimit, queryTimeLimit;
private static final Long INITIALMODCOUNT = Long.valueOf(1);
-
+
public RDBDocumentStoreJDBC(RDBDocumentStoreDB dbInfo,
RDBDocumentSerializer ser, int queryHitsLimit, int queryTimeLimit) {
this.dbInfo = dbInfo;
this.ser = ser;
@@ -461,7 +459,7 @@ public class RDBDocumentStoreJDBC {
+ excludeKeyPatterns + ", conditions=" +
conditions + ", limit=" + limit)
: null);
stmt = prepareQuery(connection, tmd, fields, minId,
- maxId, excludeKeyPatterns, conditions, limit, of("ID"));
+ maxId, excludeKeyPatterns, conditions, limit, "ID");
rs = stmt.executeQuery();
while (rs.next() && result.size() < limit) {
int field = 1;
@@ -556,7 +554,7 @@ public class RDBDocumentStoreJDBC {
@NotNull
public Iterator<RDBRow> queryAsIterator(RDBConnectionHandler ch,
RDBTableMetaData tmd, String minId, String maxId,
- List<String> excludeKeyPatterns, List<QueryCondition> conditions,
int limit, List<String> sortBy) throws SQLException {
+ List<String> excludeKeyPatterns,
List<QueryCondition> conditions, int limit, String sortBy) throws SQLException {
return new ResultSetIterator(ch, tmd, minId, maxId,
excludeKeyPatterns, conditions, limit, sortBy);
}
@@ -575,7 +573,7 @@ public class RDBDocumentStoreJDBC {
private long pstart;
public ResultSetIterator(RDBConnectionHandler ch, RDBTableMetaData
tmd, String minId, String maxId,
- List<String> excludeKeyPatterns, List<QueryCondition>
conditions, int limit, List<String> sortBy) throws SQLException {
+ List<String> excludeKeyPatterns,
List<QueryCondition> conditions, int limit, String sortBy) throws SQLException {
long start = System.currentTimeMillis();
try {
this.ch = ch;
@@ -697,7 +695,7 @@ public class RDBDocumentStoreJDBC {
@NotNull
private PreparedStatement prepareQuery(Connection connection,
RDBTableMetaData tmd, String columns, String minId, String maxId,
- List<String> excludeKeyPatterns, List<QueryCondition> conditions,
int limit, List<String> sortBy) throws SQLException {
+ List<String> excludeKeyPatterns,
List<QueryCondition> conditions, int limit, String sortBy) throws SQLException {
StringBuilder selectClause = new StringBuilder();
@@ -716,8 +714,8 @@ public class RDBDocumentStoreJDBC {
query.append(" where ").append(whereClause);
}
- if (sortBy != null && !sortBy.isEmpty()) {
- query.append(" order by
").append(sortBy.stream().map(INDEXED_PROP_MAPPING::get).collect(joining(",
")));
+ if (sortBy != null) {
+ query.append(" order by ID");
}
if (limit != Integer.MAX_VALUE) {
@@ -914,7 +912,7 @@ public class RDBDocumentStoreJDBC {
}
public boolean update(Connection connection, RDBTableMetaData tmd, String
id, Long modified, Number hasBinary,
- Boolean deletedOnce, Long modcount, Long cmodcount, Long
oldmodcount, String data) throws SQLException {
+ Boolean deletedOnce, Long modcount, Long cmodcount,
Long oldmodcount, String data) throws SQLException {
StringBuilder t = new StringBuilder();
t.append("update " + tmd.getName() + " set ");
@@ -968,7 +966,6 @@ public class RDBDocumentStoreJDBC {
tmp.put(NodeDocument.SD_TYPE, "SDTYPE");
tmp.put(NodeDocument.SD_MAX_REV_TIME_IN_SECS, "SDMAXREVTIME");
tmp.put(RDBDocumentStore.VERSIONPROP, "VERSION");
- tmp.put(NodeDocument.ID, "ID");
INDEXED_PROP_MAPPING = Collections.unmodifiableMap(tmp);
}
@@ -1137,4 +1134,4 @@ public class RDBDocumentStoreJDBC {
return input.getId();
}
};
-}
+}
\ No newline at end of file