Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V6.3 dans data station 10890 #202

Draft
wants to merge 2 commits into
base: v6.3-DANS-DataStation
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions doc/release-notes/10814-Differencing improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### More Scalable Dataset Version Differencing

Differencing between dataset versions, which is done during dataset edit operations and to populate the dataset page versions table has been made signficantly more scalable.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class DatasetFieldServiceBean implements java.io.Serializable {

//Flat list of cvoc term-uri and managed fields by Id
Set<Long> cvocFieldSet = null;

//The hash of the existing CVocConf setting. Used to determine when the setting has changed and it needs to be re-parsed to recreate the cvocMaps
String oldHash = null;

Expand Down Expand Up @@ -276,9 +276,11 @@ public ControlledVocabAlternate save(ControlledVocabAlternate alt) {
* @return - a map of JsonObjects containing configuration information keyed by the DatasetFieldType id (Long)
*/
public Map<Long, JsonObject> getCVocConf(boolean byTermUriField){

return getCVocConf(byTermUriField, settingsService.getValueForKey(SettingsServiceBean.Key.CVocConf));
}

public Map<Long, JsonObject> getCVocConf(boolean byTermUriField, String cvocSetting) {
//ToDo - change to an API call to be able to provide feedback if the json is invalid?
String cvocSetting = settingsService.getValueForKey(SettingsServiceBean.Key.CVocConf);
if (cvocSetting == null || cvocSetting.isEmpty()) {
oldHash=null;
//Release old maps
Expand All @@ -295,7 +297,7 @@ public Map<Long, JsonObject> getCVocConf(boolean byTermUriField){
cvocMap=new HashMap<>();
cvocMapByTermUri=new HashMap<>();
cvocFieldSet = new HashSet<>();

try (JsonReader jsonReader = Json.createReader(new StringReader(settingsService.getValueForKey(SettingsServiceBean.Key.CVocConf)))) {
JsonArray cvocConfJsonArray = jsonReader.readArray();
for (JsonObject jo : cvocConfJsonArray.getValuesAs(JsonObject.class)) {
Expand Down Expand Up @@ -356,11 +358,11 @@ public Set<Long> getCvocFieldSet() {
/**
* Adds information about the external vocabulary term being used in this DatasetField to the ExternalVocabularyValue table if it doesn't already exist.
* @param df - the primitive/parent compound field containing a newly saved value
* @param cvocEntry
*/
public void registerExternalVocabValues(DatasetField df) {
public void registerExternalVocabValues(DatasetField df, JsonObject cvocEntry) {
DatasetFieldType dft = df.getDatasetFieldType();
logger.fine("Registering for field: " + dft.getName());
JsonObject cvocEntry = getCVocConf(true).get(dft.getId());
if (dft.isPrimitive()) {
List<DatasetField> siblingsDatasetFields = new ArrayList<>();
if(dft.getParentDatasetFieldType()!=null) {
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
import edu.harvard.iq.dataverse.search.SearchServiceBean;
import edu.harvard.iq.dataverse.search.SearchUtil;
import edu.harvard.iq.dataverse.search.SolrClientService;
import edu.harvard.iq.dataverse.settings.FeatureFlags;
import edu.harvard.iq.dataverse.settings.JvmSettings;
import edu.harvard.iq.dataverse.util.SignpostingResources;
import edu.harvard.iq.dataverse.util.FileMetadataUtil;
Expand Down Expand Up @@ -1104,7 +1105,7 @@ public Set<Long> getFileIdsInVersionFromSolr(Long datasetVersionId, String patte
while (iter.hasNext()) {
SolrDocument solrDocument = iter.next();
Long entityid = (Long) solrDocument.getFieldValue(SearchFields.ENTITY_ID);
logger.fine("solr result id: "+entityid);
logger.finest("solr result id: "+entityid);
resultIds.add(entityid);
}

Expand Down Expand Up @@ -2695,7 +2696,9 @@ public void edit(EditMode editMode) {
dataset = datasetService.find(dataset.getId());
}
workingVersion = dataset.getOrCreateEditVersion();
clone = workingVersion.cloneDatasetVersion();
if(!FeatureFlags.DISABLE_EDIT_DRAFT_LOGGING.enabled()) {
clone = workingVersion.cloneDatasetVersion();
}
if (editMode.equals(EditMode.METADATA)) {
datasetVersionUI = datasetVersionUI.initDatasetVersionUI(workingVersion, true);
updateDatasetFieldInputLevels();
Expand Down Expand Up @@ -3950,7 +3953,10 @@ public String save() {
cmd = new UpdateDatasetVersionCommand(dataset, dvRequestService.getDataverseRequest(), filesToBeDeleted, clone );
((UpdateDatasetVersionCommand) cmd).setValidateLenient(true);
}
long start = System.currentTimeMillis();

dataset = commandEngine.submit(cmd);
logger.fine("Save done in: " + (System.currentTimeMillis()-start) + " ms");
if (editMode == EditMode.CREATE) {
if (session.getUser() instanceof AuthenticatedUser) {
userNotificationService.sendNotification((AuthenticatedUser) session.getUser(), dataset.getCreateDate(), UserNotification.Type.CREATEDS, dataset.getLatestVersion().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public DatasetLock addDatasetLock(Long datasetId, DatasetLock.Reason reason, Lon
// (to prevent multiple, duplicate locks on the dataset!)
DatasetLock lock = dataset.getLockFor(reason);
if (lock != null) {
logger.warning("There was a lock!");
return lock;
}

Expand Down
Loading
Loading