Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions api/src/org/labkey/api/ApiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.labkey.api.attachments.LookAndFeelResourceType;
import org.labkey.api.attachments.SecureDocumentType;
import org.labkey.api.cache.BlockingCache;
import org.labkey.api.cache.CachingTestCase;
import org.labkey.api.collections.ArrayListMap;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.collections.CaseInsensitiveHashSet;
Expand Down Expand Up @@ -139,7 +138,32 @@
import org.labkey.api.settings.ExperimentalFeatureStartupListener;
import org.labkey.api.settings.LookAndFeelProperties;
import org.labkey.api.settings.WriteableLookAndFeelProperties;
import org.labkey.api.util.*;
import org.labkey.api.util.ChecksumUtil;
import org.labkey.api.util.Compress;
import org.labkey.api.util.ContextListener;
import org.labkey.api.util.DateUtil;
import org.labkey.api.util.DomTestCase;
import org.labkey.api.util.ExceptionUtil;
import org.labkey.api.util.ExtUtil;
import org.labkey.api.util.FileType;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.HelpTopic;
import org.labkey.api.util.JSoupUtil;
import org.labkey.api.util.JsonUtil;
import org.labkey.api.util.JspTestCase;
import org.labkey.api.util.MailHelper;
import org.labkey.api.util.MemTracker;
import org.labkey.api.util.MimeMap;
import org.labkey.api.util.NumberUtilsLabKey;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.Pair;
import org.labkey.api.util.Path;
import org.labkey.api.util.ResultSetUtil;
import org.labkey.api.util.SessionHelper;
import org.labkey.api.util.StringExpressionFactory;
import org.labkey.api.util.StringUtilsLabKey;
import org.labkey.api.util.SystemMaintenance;
import org.labkey.api.util.URLHelper;
import org.labkey.api.util.emailTemplate.EmailTemplate;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.FileServlet;
Expand Down Expand Up @@ -367,7 +391,6 @@ public void registerServlets(ServletContext servletCtx)
AppPropsTestCase.class,
AtomicDatabaseInteger.TestCase.class,
BlockingCache.BlockingCacheTest.class,
CachingTestCase.class,
CompareType.TestCase.class,
ContainerDisplayColumn.TestCase.class,
ContainerFilter.TestCase.class,
Expand Down
13 changes: 0 additions & 13 deletions api/src/org/labkey/api/cache/CachingTestCase.java

This file was deleted.

184 changes: 0 additions & 184 deletions api/src/org/labkey/api/cache/DbCache.java

This file was deleted.

2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/AbstractTableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ public void fireRowTrigger(Container c, User user, TriggerType type, boolean bef
}


/** TableInfo does not support DbCache by default */
/** TableInfo does not support QueryHelper by default */
@Override
public Path getNotificationKey()
{
Expand Down
25 changes: 2 additions & 23 deletions api/src/org/labkey/api/data/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;
import org.labkey.api.cache.DbCache;
import org.labkey.api.collections.BoundMap;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.collections.CaseInsensitiveHashSet;
Expand Down Expand Up @@ -917,8 +916,6 @@ else if (column.isAutoIncrement())

_copyInsertSpecialFields(returnObject, fields);
_copyUpdateSpecialFields(table, returnObject, fields);

notifyTableUpdate(table);
}
catch(SQLException e)
{
Expand Down Expand Up @@ -1098,7 +1095,6 @@ else if (pkVals instanceof Map)
}

_copyUpdateSpecialFields(table, fieldsIn, fields);
notifyTableUpdate(table);
}
catch (OptimisticConflictException e)
{
Expand Down Expand Up @@ -1140,9 +1136,7 @@ public static int delete(TableInfo table)
{
assert (table.getTableType() != DatabaseTableType.NOT_IN_DB): (table.getName() + " is not in the physical database.");
SqlExecutor sqlExecutor = new SqlExecutor(table.getSchema());
int result = sqlExecutor.execute("DELETE FROM " + table.getSelectName());
notifyTableUpdate(table);
return result;
return sqlExecutor.execute("DELETE FROM " + table.getSelectName());
}

public static int delete(TableInfo table, Filter filter)
Expand All @@ -1152,27 +1146,22 @@ public static int delete(TableInfo table, Filter filter)
SQLFragment where = filter.getSQLFragment(table.getSqlDialect(), null, createColumnMap(table,null));

SQLFragment deleteSQL = new SQLFragment("DELETE FROM ").append(table).append("\n\t").append(where);
int result = new SqlExecutor(table.getSchema()).execute(deleteSQL);

notifyTableUpdate(table);
return result;
return new SqlExecutor(table.getSchema()).execute(deleteSQL);
}

public static void truncate(TableInfo table)
{
assert (table.getTableType() != DatabaseTableType.NOT_IN_DB): (table.getName() + " is not in the physical database.");
SqlExecutor sqlExecutor = new SqlExecutor(table.getSchema());
sqlExecutor.execute(table.getSqlDialect().getTruncateSql(table.getSelectName()));
notifyTableUpdate(table);
}


public static SQLFragment getSelectSQL(TableInfo table, @Nullable Collection<ColumnInfo> columns, @Nullable Filter filter, @Nullable Sort sort)
{
return QueryService.get().getSelectSQL(table, columns, filter, sort, ALL_ROWS, NO_OFFSET, false);
}


public static void ensureRequiredColumns(TableInfo table, Map<FieldKey, ColumnInfo> cols, @Nullable Filter filter, @Nullable Sort sort, @Nullable List<Aggregate> aggregates)
{
List<ColumnInfo> allColumns = table.getColumns();
Expand Down Expand Up @@ -1219,15 +1208,6 @@ public static void snapshot(TableInfo tinfo, String tableName)
new SqlExecutor(tinfo.getSchema()).execute(sqlSelectInto);
}


// Table modification

public static void notifyTableUpdate(/*String operation,*/ TableInfo table/*, Container c*/)
{
DbCache.invalidateAll(table);
}


private static void _logQuery(Level level, @Nullable SQLFragment sqlFragment, @Nullable Connection conn)
{
if (!_log.isEnabled(level) || null == sqlFragment)
Expand Down Expand Up @@ -1281,7 +1261,6 @@ static void _appendTableStackTrace(StringBuilder sb, int count)
}
}


public static class TestCase extends Assert
{
private static final CoreSchema _core = CoreSchema.getInstance();
Expand Down
6 changes: 2 additions & 4 deletions api/src/org/labkey/api/data/TableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,8 @@ void fireRowTrigger(Container c, User user, TriggerType type, boolean before, in
default boolean hasDbTriggers() { return false; }

/**
* TableInfos that can be associated with a DbCache need a reliable key other than a TableInfo instance.
* Return null if DbCache is not supported.
*
* We should probably kill DbCache, but let's fix this for now (https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=10508)
* TableInfos that can be associated with a QueryHelper need a reliable key other than a TableInfo instance.
* Return null if QueryHelper is not supported.
*/
Path getNotificationKey();

Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/exp/OntologyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ public static Pair<String, GUID> getCacheKey(String uri, Container c)
return Pair.of(uri, projId);
}

//TODO: DbCache semantics. This loads the cache but does not fetch cause need to get them all together
//TODO: Cache semantics. This loads the cache but does not fetch cause need to get them all together
public static List<PropertyDescriptor> getPropertiesForType(String typeURI, Container c)
{
List<Pair<String, Boolean>> propertyURIs = DOMAIN_PROPERTIES_CACHE.get(getCacheKey(typeURI, c));
Expand Down
9 changes: 2 additions & 7 deletions api/src/org/labkey/api/query/DefaultQueryUpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.attachments.AttachmentFile;
import org.labkey.api.cache.DbCache;
import org.labkey.api.collections.ArrayListMap;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.ColumnInfo;
Expand Down Expand Up @@ -335,9 +334,7 @@ protected Map<String, Object> _insert(User user, Container c, Map<String, Object

try
{
Map<String, Object> ret = Table.insert(user, getDbTable(), row);
if (getDbTable().getName().equals("AssaySpecimen")) { DbCache.trackRemove(getDbTable()); }
return ret;
return Table.insert(user, getDbTable(), row);
}
catch (RuntimeValidationException e)
{
Expand Down Expand Up @@ -566,9 +563,7 @@ protected Map<String, Object> _update(User user, Container c, Map<String, Object
}
}

Map<String, Object> ret = Table.update(user, getDbTable(), row, keys);
if (getDbTable().getName().equals("AssaySpecimen")) DbCache.trackRemove(getDbTable()); // Handled in caller (TreatmentManager.saveAssaySpecimen())
return ret;
return Table.update(user, getDbTable(), row, keys); // Cache-invalidation handled in caller (TreatmentManager.saveAssaySpecimen())
}

// Get value from row map where the keys are column names.
Expand Down
Loading