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

Hotfix 1.8.x sup 13391 #1456

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions LTS-CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ include::content/docs/variables.adoc-include[]
The LTS changelog lists releases which are only accessible via a commercial subscription.
All fixes and changes in LTS releases will be released the next minor release. Changes from LTS 1.4.x will be included in release 1.5.0.

[[v1.8.12]]
== 1.8.12 (TBD)

icon:check[] OrientDB: previously when a backup was in progress all requests would fail with a 500 status code as an internal error. This has been changed to send a 503 status code with a descriptive message.

[[v1.8.11]]
== 1.8.11 (06.10.2022)

Expand Down Expand Up @@ -74,6 +79,11 @@ enforced in the UI, and is now enforced in the REST API. The check is not perfor

icon:check[] Core: When a project was deleted, its associated version purge job were not. This has been fixed.

[[v1.6.36]]
== 1.6.36 (TBD)

icon:check[] OrientDB: previously when a backup was in progress all requests would fail with a 500 status code as an internal error. This has been changed to send a 503 status code with a descriptive message.

[[v1.6.35]]
== 1.6.35 (06.10.2022)

Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/i18n/translations_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ import_failed=Import fehlgeschlagen.

backup_finished=Backup abgeschlossen.
backup_failed=Backup fehlgeschlagen.
backup_in_progress=Zugriff auf Datenbank nicht m�glich, Backup l�uft.
backup_consistency_check_failed=Backup fehlgeschlagen. Der Konsistenzcheck hat {0} Inkonsistenzen gefunden.
backup_error_not_supported_in_memory_mode=Backup Operationen können nicht durchgeführt werden wenn der in-memory modus verwendet wird.

Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/i18n/translations_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ import_failed=Import failed.

backup_finished=Backup completed.
backup_failed=Backup failed.
backup_in_progress=Cannot access database, backup is in progress.
backup_consistency_check_failed=Backup failed. Consistency check found {0} inconsistencies.
backup_error_not_supported_in_memory_mode=Backup operation can not be run in memory mode.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.gentics.mesh.Mesh;
import com.gentics.mesh.MeshStatus;
import com.gentics.mesh.core.rest.error.BackupInProgressException;
import com.gentics.mesh.metric.MetricsService;

import io.micrometer.core.instrument.Counter;
Expand Down Expand Up @@ -48,6 +49,8 @@ protected void checkStatus() {
case READY:
case STARTING:
return;
case BACKUP:
throw new BackupInProgressException();
default:
throw new RuntimeException("Mesh is not ready. Current status " + status.name() + ". Aborting transaction.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Abstract class for regular rest exceptions. This class should be used when returning the exception information via a JSON response.
*/
@JsonIgnoreProperties({ "suppressed", "cause", "detailMessage", "stackTrace", "localizedMessage" })
@JsonIgnoreProperties({ "suppressed", "cause", "detailMessage", "stackTrace", "localizedMessage", "logStackTrace" })
public abstract class AbstractRestException extends RuntimeException {

private static final long serialVersionUID = 2209919403583173663L;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.gentics.mesh.core.rest.error;

import io.netty.handler.codec.http.HttpResponseStatus;

/**
* This exception should be thrown when the database is not available due to a backup.
*/
public class BackupInProgressException extends AbstractRestException {

private static final String TYPE = "backup_in_progress";

public BackupInProgressException() {
super(HttpResponseStatus.SERVICE_UNAVAILABLE, "backup_in_progress");
}

@Override
public String getType() {
return TYPE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.FileUtils;
import org.junit.Before;
Expand Down Expand Up @@ -52,6 +54,16 @@ public void testWriteConfig() throws Exception {
assertEquals(PLUGIN_DIR + "/dummy/storage", plugin.getStorageDir().getPath());
}

@Test(expected = Exception.class)
public void testReadInvalidYamlFile() throws Exception {
DummyPlugin plugin = mockPlugin();
File file = plugin.getConfigFile();
FileUtils.writeStringToFile(file, "foo bar", StandardCharsets.UTF_8);

// this should fail since the yaml format is invalid
plugin.readConfig(DummyPluginConfig.class);
}

@Test
public void testReadConfigOverride() throws FileNotFoundException, IOException {
DummyPlugin plugin = mockPlugin();
Expand Down