Skip to content

Commit

Permalink
Bring parts of CNDB-11336 from main missing here
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaterinadimitrova2 committed Nov 7, 2024
1 parent 3846e52 commit 3554475
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/unit/org/apache/cassandra/index/sai/SAITester.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.service.snapshot.TableSnapshot;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.ReflectionUtils;
import org.apache.cassandra.utils.Throwables;
import org.apache.lucene.codecs.CodecUtil;
import org.awaitility.Awaitility;
Expand Down Expand Up @@ -898,7 +899,7 @@ protected static void setSegmentWriteBufferSpace(final int segmentSize) throws E
NamedMemoryLimiter limiter = (NamedMemoryLimiter) V1OnDiskFormat.class.getDeclaredField("SEGMENT_BUILD_MEMORY_LIMITER").get(null);
Field limitBytes = limiter.getClass().getDeclaredField("limitBytes");
limitBytes.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(limitBytes, limitBytes.getModifiers() & ~Modifier.FINAL);
limitBytes.set(limiter, segmentSize);
Expand Down
3 changes: 2 additions & 1 deletion test/unit/org/apache/cassandra/index/sai/SAIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.lang.reflect.Field;

import org.apache.cassandra.index.sai.disk.format.Version;
import org.apache.cassandra.utils.ReflectionUtils;

public class SAIUtil
{
Expand All @@ -31,7 +32,7 @@ public static void setLatestVersion(Version version)
{
latest = Version.class.getDeclaredField("LATEST");
latest.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers");
modifiersField.setAccessible(true);
latest.set(null, version);
}
Expand Down

0 comments on commit 3554475

Please sign in to comment.