Skip to content

Commit

Permalink
fix: avoid storage to go in read only mode if index key type validati…
Browse files Browse the repository at this point in the history
…on fails
  • Loading branch information
tglman committed Oct 24, 2023
1 parent d2c45e3 commit 52b8557
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,22 @@ public int addIndexEngine(
throw new OIndexException("Types of indexed keys have to be provided");
}

final OBinarySerializer<?> keySerializer = determineKeySerializer(indexDefinition);
if (keySerializer == null) {
throw new OIndexException("Can not determine key serializer");
}

final int keySize = determineKeySize(indexDefinition);

final boolean nullValuesSupport = !indexDefinition.isNullValuesIgnored();
final byte serializerId;

if (valueSerializer != null) {
serializerId = valueSerializer.getId();
} else {
serializerId = -1;
}

checkBackupRunning();
stateLock.writeLock().lock();
try {
Expand Down Expand Up @@ -2806,22 +2822,6 @@ public int addIndexEngine(
}
}

final OBinarySerializer<?> keySerializer = determineKeySerializer(indexDefinition);
if (keySerializer == null) {
throw new OIndexException("Can not determine key serializer");
}

final int keySize = determineKeySize(indexDefinition);

final boolean nullValuesSupport = !indexDefinition.isNullValuesIgnored();
final byte serializerId;

if (valueSerializer != null) {
serializerId = valueSerializer.getId();
} else {
serializerId = -1;
}

final OBaseIndexEngine engine =
addIndexEngineInternal(
atomicOperation,
Expand Down

0 comments on commit 52b8557

Please sign in to comment.