Fix issues from code review
This commit is contained in:
parent
01c45240f1
commit
b135975061
@ -73,32 +73,15 @@ public class DeprecationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkDatabaseTypeDeprecation() {
|
private void checkDatabaseTypeDeprecation() {
|
||||||
String deprecatedDatabaseType = "timescale";
|
if ("timescale".equals(tsType) || "timescale".equals(tsLatestType)) {
|
||||||
var fieldsWithDeprecatedType = new ArrayList<String>();
|
String deprecatedDatabaseType = "Timescale";
|
||||||
|
|
||||||
addFieldIfValueDeprecated(tsType, "ts", fieldsWithDeprecatedType, deprecatedDatabaseType);
|
log.warn("WARNING: Starting with ThingsBoard 4.0, the database type {} will no longer be supported as a storage provider. " +
|
||||||
addFieldIfValueDeprecated(tsLatestType, "ts_latest", fieldsWithDeprecatedType, deprecatedDatabaseType);
|
"Please migrate to Cassandra or PostgreSQL.", deprecatedDatabaseType);
|
||||||
|
notificationCenter.sendGeneralWebNotification(TenantId.SYS_TENANT_ID, new SystemAdministratorsFilter(),
|
||||||
if (fieldsWithDeprecatedType.isEmpty()) {
|
DefaultNotifications.databaseTypeDeprecation.toTemplate(), new GeneralNotificationInfo(Map.of(
|
||||||
return;
|
"databaseType", deprecatedDatabaseType
|
||||||
}
|
)));
|
||||||
|
|
||||||
String deprecatedFieldNames = String.join(", ", fieldsWithDeprecatedType);
|
|
||||||
|
|
||||||
log.warn("WARNING: Starting with ThingsBoard 4.0, {} will no longer be supported as a database type for telemetry storage. " +
|
|
||||||
"Please migrate to Cassandra or SQL-based storage solutions. This change will not impact the telemetry query.",
|
|
||||||
deprecatedDatabaseType);
|
|
||||||
|
|
||||||
notificationCenter.sendGeneralWebNotification(TenantId.SYS_TENANT_ID, new SystemAdministratorsFilter(),
|
|
||||||
DefaultNotifications.databaseTypeDeprecation.toTemplate(), new GeneralNotificationInfo(Map.of(
|
|
||||||
"databaseType", deprecatedDatabaseType,
|
|
||||||
"deprecatedFields", deprecatedFieldNames
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addFieldIfValueDeprecated(String fieldValue, String fieldName, List<String> fieldsWithDeprecatedType, String deprecatedDatabaseType) {
|
|
||||||
if (deprecatedDatabaseType.equals(fieldValue)) {
|
|
||||||
fieldsWithDeprecatedType.add(fieldName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -212,9 +212,9 @@ ui:
|
|||||||
database:
|
database:
|
||||||
ts_max_intervals: "${DATABASE_TS_MAX_INTERVALS:700}" # Max number of DB queries generated by a single API call to fetch telemetry records
|
ts_max_intervals: "${DATABASE_TS_MAX_INTERVALS:700}" # Max number of DB queries generated by a single API call to fetch telemetry records
|
||||||
ts:
|
ts:
|
||||||
type: "${DATABASE_TS_TYPE:timescale}" # cassandra, sql (timescale is deprecated and no longer supported in ThingsBoard 4.0)
|
type: "${DATABASE_TS_TYPE:sql}" # cassandra, sql. timescale option is deprecated and will no longer be supported in ThingsBoard 4.0
|
||||||
ts_latest:
|
ts_latest:
|
||||||
type: "${DATABASE_TS_LATEST_TYPE:sql}" # cassandra, sql (timescale is deprecated and no longer supported in ThingsBoard 4.0)
|
type: "${DATABASE_TS_LATEST_TYPE:sql}" # cassandra, sql. timescale option is deprecated and will no longer be supported in ThingsBoard 4.0
|
||||||
|
|
||||||
# Cassandra driver configuration parameters
|
# Cassandra driver configuration parameters
|
||||||
cassandra:
|
cassandra:
|
||||||
|
|||||||
@ -384,9 +384,9 @@ public class DefaultNotifications {
|
|||||||
public static final DefaultNotification databaseTypeDeprecation = DefaultNotification.builder()
|
public static final DefaultNotification databaseTypeDeprecation = DefaultNotification.builder()
|
||||||
.name("Database type deprecation")
|
.name("Database type deprecation")
|
||||||
.type(NotificationType.GENERAL)
|
.type(NotificationType.GENERAL)
|
||||||
.subject("WARNING: Database type '${databaseType}' is deprecated")
|
.subject("WARNING: '${databaseType}' deprecation")
|
||||||
.text("Starting with ThingsBoard 4.0, the database type '${databaseType}' (${deprecatedFields}) will no longer be supported. " +
|
.text("Starting with ThingsBoard 4.0, the database type '${databaseType}' will no longer be supported as a storage provider." +
|
||||||
"Please migrate to Cassandra or SQL-based storage solutions")
|
"Please migrate to Cassandra or Cassandra or PostgreSQL")
|
||||||
.icon("warning")
|
.icon("warning")
|
||||||
.color(RED_COLOR)
|
.color(RED_COLOR)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user