Commit c13308b1158298d935347df9f696defc88abd560

Authored by Igor Kulikov
Committed by GitHub
2 parents 67f12264 062cae2e

Merge pull request #3225 from YevhenBondarenko/master

Cassandra ts latest improvements
... ... @@ -55,6 +55,8 @@ import static org.thingsboard.server.service.install.migrate.CassandraToSqlColum
55 55 @Slf4j
56 56 public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateService {
57 57
  58 + private static final int LATEST_KEY_LENGTH = 255;
  59 +
58 60 @Autowired
59 61 private EntityDatabaseSchemaService entityDatabaseSchemaService;
60 62
... ... @@ -168,6 +170,11 @@ public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateServ
168 170 }
169 171
170 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 178 Integer keyId = tsKvDictionaryMap.get(strKey);
172 179 if (keyId == null) {
173 180 Optional<TsKvDictionary> tsKvDictionaryOptional;
... ...