[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): table suspension reason in wal_tables() and warnings endpoint #4607

Merged
merged 45 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
13c4816
feat(core): display table suspension reason in wal_tables()
glasstiger May 28, 2024
2282e38
windows fix
glasstiger May 28, 2024
784629b
testing tag names
glasstiger May 28, 2024
9f71e41
OOM tags
glasstiger May 28, 2024
c3821c1
fix CairoException error codes
glasstiger May 28, 2024
70025c3
windows fix
glasstiger May 28, 2024
b3446b2
Merge branch 'master' into ia_wal_error
glasstiger May 28, 2024
f31dc39
OTHER tag
glasstiger May 28, 2024
7e362ce
remove error code from wal_tables() output
glasstiger May 29, 2024
54740bd
store error message as string
glasstiger May 29, 2024
70d5d18
remove WalError class
glasstiger May 29, 2024
98b1535
Merge branch 'master' into ia_wal_error
glasstiger May 29, 2024
1b510a8
feat(core): alter table suspend command
glasstiger May 30, 2024
9c74bbd
windows fix
glasstiger May 30, 2024
6b77fc9
Merge branch 'master' into ia_wal_error
glasstiger May 30, 2024
dc528b2
Merge branch 'master' into ia_wal_error
glasstiger May 31, 2024
2d2bc33
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jun 14, 2024
66a83e5
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jun 14, 2024
0ece716
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jun 18, 2024
9804024
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jun 20, 2024
99bb5b1
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jun 20, 2024
72a1607
Merge branch 'master' into ia_wal_error
glasstiger Jun 21, 2024
64ef0a3
Merge branch 'ia_wal_error' of https://github.com/questdb/questdb int…
glasstiger Jun 21, 2024
2c2d300
small refactoring
glasstiger Jun 21, 2024
30a7f88
Merge branch 'master' into ia_wal_error
glasstiger Jun 25, 2024
fbec4ea
Merge branch 'master' into ia_wal_error
glasstiger Jun 27, 2024
605a629
Merge branch 'master' into ia_wal_error
glasstiger Jul 2, 2024
d63966e
suspend SQL to support error tag text
glasstiger Jul 2, 2024
f21fbd1
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jul 3, 2024
0e8d5e7
renaming error tags
glasstiger Jul 3, 2024
ce807af
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jul 5, 2024
301398c
warnings endpoint
glasstiger Jul 5, 2024
1c7d275
Merge remote-tracking branch 'origin/master' into ia_wal_error
glasstiger Jul 5, 2024
52f6bea
fix merge
glasstiger Jul 5, 2024
92820b8
warnings json fix
glasstiger Jul 10, 2024
c8c6171
Merge branch 'master' into ia_wal_error
glasstiger Jul 10, 2024
3039305
function for simulating warnings
glasstiger Jul 11, 2024
e292fef
fix java 8 build
glasstiger Jul 11, 2024
ef8cdd7
Merge branch 'master' into ia_wal_error
glasstiger Jul 11, 2024
1052247
fix tests
glasstiger Jul 11, 2024
e9c0751
Merge remote-tracking branch 'origin/ia_wal_error' into ia_wal_error
glasstiger Jul 11, 2024
c6edce7
Merge branch 'master' into ia_wal_error
glasstiger Jul 11, 2024
7d8c024
dev mode config
glasstiger Jul 15, 2024
49d0b91
Merge branch 'master' into ia_wal_error
glasstiger Jul 15, 2024
5188563
addressing review comments
glasstiger Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions core/src/main/java/io/questdb/PropServerConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

public class PropServerConfiguration implements ServerConfiguration {

public static final String ACL_ENABLED = "acl.enabled";
public static final long COMMIT_INTERVAL_DEFAULT = 2000;
public static final String CONFIG_DIRECTORY = "conf";
public static final String DB_DIRECTORY = "db";
Expand Down Expand Up @@ -127,6 +128,7 @@ public class PropServerConfiguration implements ServerConfiguration {
private final boolean defaultSymbolCacheFlag;
private final int defaultSymbolCapacity;
private final int detachedMkdirMode;
private final boolean devModeEnabled;
private final boolean enableTestFactories;
private final int fileOperationRetryCount;
private final FilesFacade filesFacade;
Expand Down Expand Up @@ -240,6 +242,7 @@ public class PropServerConfiguration implements ServerConfiguration {
private final PropPGWireDispatcherConfiguration propPGWireDispatcherConfiguration = new PropPGWireDispatcherConfiguration();
private final String publicDirectory;
private final PublicPassthroughConfiguration publicPassthroughConfiguration = new PropPublicPassthroughConfiguration();
private final int queryCacheEventQueueCapacity;
private final long queryTimeout;
private final int readerPoolMaxSegments;
private final int repeatMigrationFromVersion;
Expand All @@ -261,7 +264,6 @@ public class PropServerConfiguration implements ServerConfiguration {
private final long sharedWorkerSleepThreshold;
private final long sharedWorkerSleepTimeout;
private final long sharedWorkerYieldThreshold;
private final boolean simulateCrashEnabled;
private final String snapshotInstanceId;
private final boolean snapshotRecoveryEnabled;
private final String snapshotRoot;
Expand Down Expand Up @@ -516,7 +518,6 @@ public class PropServerConfiguration implements ServerConfiguration {
private long pgWorkerNapThreshold;
private long pgWorkerSleepThreshold;
private long pgWorkerYieldThreshold;
private final int queryCacheEventQueueCapacity;
private boolean stringToCharCastAllowed;
private long symbolCacheWaitUsBeforeReload;

Expand Down Expand Up @@ -653,7 +654,7 @@ public PropServerConfiguration(

this.snapshotInstanceId = getString(properties, env, PropertyKey.CAIRO_SNAPSHOT_INSTANCE_ID, "");
this.snapshotRecoveryEnabled = getBoolean(properties, env, PropertyKey.CAIRO_SNAPSHOT_RECOVERY_ENABLED, true);
this.simulateCrashEnabled = getBoolean(properties, env, PropertyKey.CAIRO_SIMULATE_CRASH_ENABLED, false);
this.devModeEnabled = getBoolean(properties, env, PropertyKey.DEV_MODE_ENABLED, false);

int cpuAvailable = Runtime.getRuntime().availableProcessors();
int cpuUsed = 0;
Expand Down Expand Up @@ -2494,11 +2495,6 @@ public long getSequencerCheckInterval() {
return sequencerCheckInterval;
}

@Override
public boolean getSimulateCrashEnabled() {
return simulateCrashEnabled;
}

@Override
public @NotNull CharSequence getSnapshotInstanceId() {
return snapshotInstanceId;
Expand Down Expand Up @@ -2978,6 +2974,11 @@ public int getWriterTickRowsCountMod() {
return writerTickRowsCountMod;
}

@Override
public boolean isDevModeEnabled() {
return devModeEnabled;
}

@Override
public boolean isGroupByPresizeEnabled() {
return cairoGroupByPresizeEnabled;
Expand Down Expand Up @@ -3061,7 +3062,7 @@ public boolean mangleTableDirNames() {
public void populateSettings(CharSequenceObjHashMap<CharSequence> settings) {
settings.put(RELEASE_TYPE, str(getReleaseType()));
settings.put(RELEASE_VERSION, str(getBuildInformation().getSwVersion()));
settings.put("acl.enabled", Boolean.toString(!Chars.empty(httpUsername)));
settings.put(ACL_ENABLED, Boolean.toString(!Chars.empty(httpUsername)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/questdb/PropertyKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public enum PropertyKey implements ConfigPropertyKey {
CAIRO_MAX_FILE_NAME_LENGTH("cairo.max.file.name.length"),
LINE_AUTO_CREATE_NEW_COLUMNS("line.auto.create.new.columns"),
LINE_AUTO_CREATE_NEW_TABLES("line.auto.create.new.tables"),
CAIRO_SIMULATE_CRASH_ENABLED("cairo.enable.crash.simulation"),
DEV_MODE_ENABLED("dev.mode.enabled"),
CAIRO_WAL_ENABLED_DEFAULT("cairo.wal.enabled.default"),
CAIRO_WAL_PURGE_INTERVAL("cairo.wal.purge.interval"),
CAIRO_WAL_SEGMENT_ROLLOVER_ROW_COUNT("cairo.wal.segment.rollover.row.count"),
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/questdb/cairo/CairoConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ default RostiAllocFacade getRostiAllocFacade() {

long getSequencerCheckInterval();

boolean getSimulateCrashEnabled();

/**
* Returns database instance id. The instance id is used by the snapshot recovery mechanism:
* on database start the id is compared with the id stored in a snapshot, if any. If the ids
Expand Down Expand Up @@ -570,6 +568,8 @@ default int getWalPurgeWaitBeforeDelete() {

int getWriterTickRowsCountMod();

boolean isDevModeEnabled();

boolean isGroupByPresizeEnabled();

boolean isIOURingEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,6 @@ public long getSequencerCheckInterval() {
return getDelegate().getSequencerCheckInterval();
}

@Override
public boolean getSimulateCrashEnabled() {
return getDelegate().getSimulateCrashEnabled();
}

@Override
public @NotNull CharSequence getSnapshotInstanceId() {
return getDelegate().getSnapshotInstanceId();
Expand Down Expand Up @@ -1055,6 +1050,11 @@ public int getWriterTickRowsCountMod() {
return getDelegate().getWriterTickRowsCountMod();
}

@Override
public boolean isDevModeEnabled() {
return getDelegate().isDevModeEnabled();
}

@Override
public boolean isGroupByPresizeEnabled() {
return getDelegate().isGroupByPresizeEnabled();
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/questdb/cairo/CairoException.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class CairoException extends RuntimeException implements Sinkable, Flywei
public static final int METADATA_VALIDATION = -100;
public static final int ILLEGAL_OPERATION = METADATA_VALIDATION - 1;
private static final int TABLE_DROPPED = ILLEGAL_OPERATION - 1;
public static final int METADATA_VALIDATION_RECOVERABLE = METADATA_VALIDATION - 1;
public static final int METADATA_VALIDATION_RECOVERABLE = TABLE_DROPPED - 1;
public static final int PARTITION_MANIPULATION_RECOVERABLE = METADATA_VALIDATION_RECOVERABLE - 1;
public static final int NON_CRITICAL = -1;
private static final StackTraceElement[] EMPTY_STACK_TRACE = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,6 @@ public long getSequencerCheckInterval() {
return 10_000;
}

@Override
public boolean getSimulateCrashEnabled() {
return false;
}

@Override
public @NotNull CharSequence getSnapshotInstanceId() {
return "";
Expand Down Expand Up @@ -1055,6 +1050,11 @@ public int getWriterTickRowsCountMod() {
return 1024 - 1;
}

@Override
public boolean isDevModeEnabled() {
return false;
}

@Override
public boolean isGroupByPresizeEnabled() {
return true;
Expand Down
73 changes: 73 additions & 0 deletions core/src/main/java/io/questdb/cairo/ErrorTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package io.questdb.cairo;

import io.questdb.std.Chars;
import io.questdb.std.Os;
import org.jetbrains.annotations.NotNull;

public enum ErrorTag {
NONE(""),
UNSUPPORTED_FILE_SYSTEM("UNSUPPORTED FILE SYSTEM"),
DISK_FULL("DISK FULL"),
TOO_MANY_OPEN_FILES("TOO MANY OPEN FILES"),
OUT_OF_MMAP_AREAS("OUT OF MMAP AREAS"),
OUT_OF_MEMORY("OUT OF MEMORY");

private final String text;

ErrorTag(String text) {
this.text = text;
}

public static ErrorTag resolveTag(@NotNull CharSequence text) {
if (Chars.equals(text, UNSUPPORTED_FILE_SYSTEM.text)) {
return UNSUPPORTED_FILE_SYSTEM;
} else if (Chars.equals(text, DISK_FULL.text)) {
return DISK_FULL;
} else if (Chars.equals(text, TOO_MANY_OPEN_FILES.text)) {
return TOO_MANY_OPEN_FILES;
} else if (Chars.equals(text, OUT_OF_MMAP_AREAS.text)) {
return OUT_OF_MMAP_AREAS;
} else if (Chars.equals(text, OUT_OF_MEMORY.text)) {
return OUT_OF_MEMORY;
} else if (Chars.equals(text, NONE.text)) {
return NONE;
} else {
throw CairoException.nonCritical().put("Invalid WAL error tag [").put(text).put("]");
}
}
nwoolmer marked this conversation as resolved.
Show resolved Hide resolved

public static ErrorTag resolveTag(int code) {
return Os.isWindows() ? windows(code) : linux(code);
}

public String text() {
return text;
}

static ErrorTag linux(int code) {
switch (code) {
case 28:
return DISK_FULL;
case 24:
return TOO_MANY_OPEN_FILES;
case 12:
return OUT_OF_MMAP_AREAS;
default:
return NONE;
}
}

static ErrorTag windows(int code) {
switch (code) {
case 39:
case 112:
return DISK_FULL;
case 4:
return TOO_MANY_OPEN_FILES;
case 8:
return OUT_OF_MMAP_AREAS;
default:
return NONE;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void authorizeAlterTableAddIndex(TableToken tableToken, @NotNull ObjList<
public void authorizeAlterTableAlterColumnCache(TableToken tableToken, @NotNull ObjList<CharSequence> columnNames) {
throw CairoException.authorization().put("Write permission denied").setCacheable(true);
}

@Override
public void authorizeAlterTableAlterColumnType(TableToken tableToken, @NotNull ObjList<CharSequence> columnNames) {
throw CairoException.authorization().put("Write permission denied").setCacheable(true);
Expand Down
Loading