Skip to content

Commit

Permalink
Random binary string as prefix to index uuid
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <[email protected]>
  • Loading branch information
ashking94 committed Oct 11, 2023
1 parent c0852f8 commit 53ff8f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ java.nio.file.Files#getFileStore(java.nio.file.Path) @ Use org.opensearch.env.En
java.nio.file.Files#isWritable(java.nio.file.Path) @ Use org.opensearch.env.Environment.isWritable() instead, impacted by JDK-8034057

@defaultMessage Use org.opensearch.common.Randomness#get for reproducible sources of randomness
java.util.Random#<init>()
java.util.concurrent.ThreadLocalRandom

java.security.MessageDigest#clone() @ use org.opensearch.common.hash.MessageDigests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ com.carrotsearch.randomizedtesting.annotations.Nightly @ We don't run nightly te
org.junit.Test @defaultMessage Just name your test method testFooBar

java.lang.Math#random() @ Use one of the various randomization methods from LuceneTestCase or OpenSearchTestCase for reproducibility

@defaultMessage Use org.opensearch.common.Randomness#get for reproducible sources of randomness
java.util.Random#<init>()
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -889,7 +890,7 @@ static Settings aggregateIndexSettings(
indexSettingsBuilder.put(SETTING_CREATION_DATE, Instant.now().toEpochMilli());
}
indexSettingsBuilder.put(IndexMetadata.SETTING_INDEX_PROVIDED_NAME, request.getProvidedName());
indexSettingsBuilder.put(SETTING_INDEX_UUID, UUIDs.randomBase64UUID());
indexSettingsBuilder.put(SETTING_INDEX_UUID, Integer.toBinaryString(new Random().nextInt(256)) + UUIDs.randomBase64UUID());

updateReplicationStrategy(indexSettingsBuilder, request.settings(), settings);
updateRemoteStoreSettings(indexSettingsBuilder, settings);
Expand Down

0 comments on commit 53ff8f0

Please sign in to comment.