Commit c13308b1158298d935347df9f696defc88abd560
Committed by
GitHub
Merge pull request #3225 from YevhenBondarenko/master
Cassandra ts latest improvements
Showing
1 changed file
with
7 additions
and
0 deletions
@@ -55,6 +55,8 @@ import static org.thingsboard.server.service.install.migrate.CassandraToSqlColum | @@ -55,6 +55,8 @@ import static org.thingsboard.server.service.install.migrate.CassandraToSqlColum | ||
55 | @Slf4j | 55 | @Slf4j |
56 | public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateService { | 56 | public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateService { |
57 | 57 | ||
58 | + private static final int LATEST_KEY_LENGTH = 255; | ||
59 | + | ||
58 | @Autowired | 60 | @Autowired |
59 | private EntityDatabaseSchemaService entityDatabaseSchemaService; | 61 | private EntityDatabaseSchemaService entityDatabaseSchemaService; |
60 | 62 | ||
@@ -168,6 +170,11 @@ public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateServ | @@ -168,6 +170,11 @@ public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateServ | ||
168 | } | 170 | } |
169 | 171 | ||
170 | protected Integer getOrSaveKeyId(String strKey) { | 172 | protected Integer getOrSaveKeyId(String strKey) { |
173 | + if (strKey.length() > LATEST_KEY_LENGTH) { | ||
174 | + log.warn("Key is long. Max key length is 255\n{}", strKey); | ||
175 | + strKey = strKey.substring(0, LATEST_KEY_LENGTH); | ||
176 | + } | ||
177 | + | ||
171 | Integer keyId = tsKvDictionaryMap.get(strKey); | 178 | Integer keyId = tsKvDictionaryMap.get(strKey); |
172 | if (keyId == null) { | 179 | if (keyId == null) { |
173 | Optional<TsKvDictionary> tsKvDictionaryOptional; | 180 | Optional<TsKvDictionary> tsKvDictionaryOptional; |