Skip to content

Instantly share code, notes, and snippets.

View bluestreak01's full-sized avatar

Vlad Ilyushchenko bluestreak01

View GitHub Profile
*
* +-----+
* +----->| C1 |
* | +-----+
* |
* +----+ +-----+
* | P1 |--->| C2 |
* +----+ +-----+
* |
* | +-----+
while (true) {
// consumer receives next cursor
// if cursor is >= 0 - thread can use it as ring queue index
// if cursor == -1 - ring queue is full, thread has a choice to do something else
// if cursor == -2 - there was CAS failure and thread can retry more eagerly
// for purpose of this test we busy loop regardless
long cursor = sequence.next();
if (cursor < 0) {
continue;
}
@bluestreak01
bluestreak01 / questdb.cla
Last active February 25, 2021 11:47
CLA
### QuestDB Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by QuestDB Ltd or its affiliates (“QuestDB”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to QuestDB in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact bluestreak@gmail.com.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to QuestDB a non-exclusive, perpetua
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<arrangement>
[lang]
- subqueries
- simple aggregation (sum, count, avg etc)
- simple resampling (where aggregation function produces single row of values)
- multi-row aggregation
- multi-row resampling
- classic sql joins (hash, nested loops)
- time joins (merge)
- as of joins
@bluestreak01
bluestreak01 / BufferUtils.java
Last active August 29, 2015 14:05
DirectBuffer release example
/**
* Releases ByteBuffer if possible. Call semantics should be as follows:
* <p/>
* ByteBuffer buffer = ....
* <p/>
* buffer = release(buffer);
*
* @param buffer direct byte buffer
* @return null if buffer is released or same buffer if release is not possible.
*/
try (JournalFactory factory = new JournalFactory("c:\\temp\\nfsdb")) {
// delete existing price journal
Files.delete(new File(factory.getConfiguration().getJournalBase(), "price"));
final int count = 1000000;
try (JournalWriter<Price> writer = factory.writer(Price.class)) {
long tZero = System.nanoTime();
Price p = new Price();
for (int i = 0; i < count; i++) {