ifesdjeen commented on code in PR #4200: URL: https://github.com/apache/cassandra/pull/4200#discussion_r2149590613
########## test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java: ########## @@ -99,16 +100,16 @@ public boolean matches(int i, int i1, IMessage iMessage) ICoordinator coordinator = cluster.coordinator(1); final int repairInterval = Integer.MAX_VALUE; // final int repairInterval = 3000; - final int compactionInterval = Integer.MAX_VALUE; -// final int compactionInterval = 3000; - final int flushInterval = Integer.MAX_VALUE; +// final int compactionInterval = Integer.MAX_VALUE; + final int compactionInterval = 20_000; Review Comment: nit: indentation ########## test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java: ########## @@ -141,32 +142,42 @@ public boolean matches(int i, int i1, IMessage iMessage) { inFlight.acquire(); rateLimiter.acquire(); - long commandStart = System.nanoTime(); - int k = random.nextInt(keyCount); - if (random.nextFloat() < readChance) + try { - coordinator.executeWithResult((success, fail) -> { - inFlight.release(); - if (fail == null) histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart)); - // else exceptions.add(fail); - }, "SELECT * FROM " + qualifiedAccordTableName + " WHERE k = ?;", ConsistencyLevel.SERIAL, k); - } - else if (initialised.get(k)) - { - coordinator.executeWithResult((success, fail) -> { - inFlight.release(); - if (fail == null) histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart)); - // else exceptions.add(fail); - }, "UPDATE " + qualifiedAccordTableName + " SET v += 1 WHERE k = ? IF EXISTS;", ConsistencyLevel.SERIAL, ConsistencyLevel.QUORUM, k); + long commandStart = System.nanoTime(); + int k = random.nextInt(keyCount); + if (random.nextFloat() < readChance) + { + coordinator.executeWithResult((success, fail) -> { + inFlight.release(); + if (fail == null) histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart)); + // else exceptions.add(fail); Review Comment: nit: commented, should we keep this? ########## test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java: ########## @@ -185,23 +196,34 @@ else if (initialised.get(k)) nextCompactionAt += compactionInterval; System.out.println("compacting accord..."); cluster.forEach(i -> { - i.nodetool("compact", "system_accord.journal"); + try { i.nodetool("compact", "system_accord.journal"); } + catch (Throwable t) { logger.error("", t); } }); } if ((nextFlushAt -= batchSize) <= 0) { nextFlushAt += flushInterval; System.out.println("flushing journal..."); - cluster.forEach(i -> i.runOnInstance(() -> { - ((AccordService) AccordService.instance()).journal().closeCurrentSegmentForTestingIfNonEmpty(); - })); + cluster.forEach(i -> { + try + { + i.runOnInstance(() -> { + ((AccordService) AccordService.instance()).journal().closeCurrentSegmentForTestingIfNonEmpty(); + }); + } + catch (Throwable t) + { + logger.error("", t); + } + }); } if ((nextRestartAt -= batchSize) <= 0) { nextRestartAt += restartInterval; - int nodeIdx = random.nextInt(cluster.size()); +// int nodeIdx = 1 + random.nextInt(cluster.size()); Review Comment: nit: commented; should we keep this? ########## src/java/org/apache/cassandra/service/accord/AccordJournalTable.java: ########## @@ -410,18 +409,37 @@ private void readAllFromTable(K key, TableRecordConsumer onEntry) if (view.sstables.isEmpty()) return; - List<UnfilteredRowIterator> iters = new ArrayList<>(view.sstables.size()); - for (SSTableReader sstable : view.sstables) - if (sstable.mayContainAssumingKeyIsInRange(pk)) - iters.add(StorageHook.instance.makeRowIterator(cfs, sstable, pk, Slices.ALL, ColumnFilter.all(cfs.metadata()), false, NOOP_LISTENER)); + List<UnfilteredRowIterator> iters = new ArrayList<>(Math.min(4, view.sstables.size())); + try + { + for (SSTableReader sstable : view.sstables) + { + if (sstable.mayContainAssumingKeyIsInRange(pk)) Review Comment: nit: should we `continue` on `!` and un-nest, such as ``` if (!sstable.mayContainAssumingKeyIsInRange(pk)) continue; UnfilteredRowIterator iter = StorageHook.instance.makeRowIterator(cfs, sstable, pk, Slices.ALL, ColumnFilter.all(cfs.metadata()), false, NOOP_LISTENER); .... ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org