[ignite-3] branch ignite-13670 updated: Omit writing null map if all column are non-nullable.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git The following commit(s) were added to refs/heads/ignite-13670 by this push: new 1f72d75 Omit writing null map if all column are non-nullable. 1f72d75 is described below commit 1f72d75e418f6c61c2c2c4dff5b67610e9c37632 Author: Andrew Mashenkov AuthorDate: Thu Apr 22 03:04:29 2021 +0300 Omit writing null map if all column are non-nullable. --- .../org/apache/ignite/internal/schema/Columns.java | 14 ++- .../org/apache/ignite/internal/schema/Row.java | 117 +++-- .../ignite/internal/schema/RowAssembler.java | 7 +- .../apache/ignite/internal/schema/ColumnsTest.java | 14 ++- .../ignite/internal/schema/RowAssemblerTest.java | 66 ++-- 5 files changed, 123 insertions(+), 95 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Columns.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Columns.java index 28a7f9c..10e3965 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Columns.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Columns.java @@ -99,7 +99,7 @@ public class Columns { firstVarlenColIdx = findFirstVarlenColumn(); -nullMapSize = (cols.length + 7) / 8; +nullMapSize = hasNullableColumn() ? (cols.length + 7) / 8 : 0; buildFoldingTable(); } @@ -207,6 +207,18 @@ public class Columns { } /** + * @return {@code True} if there is one or more nullable columns, {@code false} otherwise. + */ +private boolean hasNullableColumn() { +for (int i = 0; i < cols.length; i++) { +if (cols[i].nullable()) +return true; +} + +return false; +} + +/** * */ private void buildFoldingTable() { diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java index f562ded..70ea05e 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java @@ -331,7 +331,10 @@ public class Row implements BinaryRow { protected long findColumn(int colIdx, NativeTypeSpec type) throws InvalidTypeException { // Get base offset (key start or value start) for the given column. boolean keyCol = schema.isKeyColumn(colIdx); -Columns cols = keyCol ? schema.keyColumns() : schema.valueColumns(); + +final short flags = readShort(FLAGS_FIELD_OFFSET); + +assert keyCol || (flags & RowFlags.NO_VALUE_FLAG) == 0; int off = KEY_CHUNK_OFFSET; @@ -343,22 +346,23 @@ public class Row implements BinaryRow { colIdx -= schema.keyColumns().length(); } -Column col = cols.column(colIdx); +Columns cols = keyCol ? schema.keyColumns() : schema.valueColumns(); -if (col.type().spec() != type) +if (cols.column(colIdx).type().spec() != type) throw new InvalidTypeException("Invalid column type requested [requested=" + type + -", column=" + col + ']'); +", column=" + cols.column(colIdx) + ']'); -if (isNull(off, colIdx)) -return -1; +boolean hasVarTable = ((keyCol ? RowFlags.OMIT_KEY_VARTBL_FLAG : RowFlags.OMIT_VAL_VARTBL_FLAG) & flags) == 0; +boolean hasNullMap = ((keyCol ? RowFlags.OMIT_KEY_NULL_MAP_FLAG : RowFlags.OMIT_VAL_NULL_MAP_FLAG) & flags) == 0; -short flags = readShort(FLAGS_FIELD_OFFSET); +if (hasNullMap && isNull(off, colIdx)) +return -1; -boolean noVarTable = ((keyCol ? RowFlags.OMIT_KEY_VARTBL_FLAG : RowFlags.OMIT_VAL_VARTBL_FLAG) & flags) != 0; +assert hasVarTable || type.fixedLength(); return type.fixedLength() ? -fixlenColumnOffset(cols, off, colIdx, noVarTable) : -varlenColumnOffsetAndLength(cols, off, colIdx); +fixlenColumnOffset(cols, off, colIdx, hasVarTable, hasNullMap) : +varlenColumnOffsetAndLength(cols, off, colIdx, hasNullMap); } /** @@ -421,40 +425,47 @@ public class Row implements BinaryRow { * @param cols Columns chunk. * @param baseOff Chunk base offset. * @param idx Column index in the chunk. + * @param hasNullMap Has null map flag. * @return Encoded offset (from the row start) and length of the column with the given index. */ -private long varlenColumnOffsetAndLength(Columns cols, int baseOff, int idx) { -int nullMapOff = nullMapOffset(baseOff); - -int nullStartByte = cols.firstVarlengthColumn() / 8; -int startBitInByte = cols.firstVarlengthColumn() % 8; +private long varlenColumnOffsetAndL
[ignite-3] 02/02: Omit writing empty varlen table.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git commit cdfae80c9a60592764f1bbd328a7d91a5b362a00 Author: Andrew Mashenkov AuthorDate: Thu Apr 22 02:05:40 2021 +0300 Omit writing empty varlen table. --- .../org/apache/ignite/internal/schema/Row.java | 18 +++- .../ignite/internal/schema/RowAssembler.java | 22 +++-- .../ignite/internal/schema/RowAssemblerTest.java | 100 ++--- 3 files changed, 81 insertions(+), 59 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java index e970f3d..f562ded 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java @@ -307,6 +307,13 @@ public class Row implements BinaryRow { } /** + * @return Row flags. + */ +private boolean hasFlag(int flag) { +return ((readShort(FLAGS_FIELD_OFFSET) & flag)) != 0; +} + +/** * Gets the column offset and length encoded into a single 8-byte value (4 least significant bytes encoding the * offset from the beginning of the row and 4 most significant bytes encoding the field length for varlength * columns). The offset and length should be extracted using {@link #offset(long)} and {@link #length(long)} @@ -345,8 +352,12 @@ public class Row implements BinaryRow { if (isNull(off, colIdx)) return -1; +short flags = readShort(FLAGS_FIELD_OFFSET); + +boolean noVarTable = ((keyCol ? RowFlags.OMIT_KEY_VARTBL_FLAG : RowFlags.OMIT_VAL_VARTBL_FLAG) & flags) != 0; + return type.fixedLength() ? -fixlenColumnOffset(cols, off, colIdx) : +fixlenColumnOffset(cols, off, colIdx, noVarTable) : varlenColumnOffsetAndLength(cols, off, colIdx); } @@ -459,9 +470,10 @@ public class Row implements BinaryRow { * @param cols Columns chunk. * @param baseOff Chunk base offset. * @param idx Column index in the chunk. + * @param noVarlen Varlen table is ommited. * @return Encoded offset (from the row start) of the requested fixlen column. */ -int fixlenColumnOffset(Columns cols, int baseOff, int idx) { +int fixlenColumnOffset(Columns cols, int baseOff, int idx, boolean noVarlen) { int nullMapOff = nullMapOffset(baseOff); int off = 0; @@ -480,7 +492,7 @@ public class Row implements BinaryRow { int vartableOffset = vartableOffset(baseOff, cols); -int vartableLen = varlenItemOffset(readShort(vartableOffset)); +int vartableLen = noVarlen ? 0 : varlenItemOffset(readShort(vartableOffset)); return vartableOffset + vartableLen + off; } diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java index e5b139e..a62715f 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java @@ -80,7 +80,8 @@ public class RowAssembler { * @return Total size of the varlen table. */ public static int varlenTableSize(int nonNullVarlenCols) { -return VARLEN_TABLE_SIZE_FIELD_SIZE + nonNullVarlenCols * VARLEN_COLUMN_OFFSET_FIELD_SIZE; +return nonNullVarlenCols == 0 ? 0 : +VARLEN_TABLE_SIZE_FIELD_SIZE + nonNullVarlenCols * VARLEN_COLUMN_OFFSET_FIELD_SIZE; } /** @@ -171,10 +172,17 @@ public class RowAssembler { initOffsets(BinaryRow.KEY_CHUNK_OFFSET, nonNullVarlenKeyCols); +//if (nullMapSize == 0) +//flags |= (baseOff == KEY_CHUNK_OFFSET ? RowFlags.NO_KEY_NULL_MAP : RowFlags.NO_VALUE_NULL_MAP); + buf = new ExpandableByteBuf(size); buf.putShort(0, (short)schema.version()); -buf.putShort(nullMapOff + curCols.nullMapSize(), (short)nonNullVarlenKeyCols); + +if (nonNullVarlenKeyCols == 0) +flags |= RowFlags.OMIT_KEY_VARTBL_FLAG; +else +buf.putShort(varlenTblOff, (short)nonNullVarlenKeyCols); } /** @@ -453,15 +461,17 @@ public class RowAssembler { buf.putShort(baseOff, (short)keyLen); -if (schema.valueColumns() == curCols) { -buf.putShort(nullMapOff + curCols.nullMapSize(), (short)nonNullVarlenValCols); - +if (schema.valueColumns() == curCols) return; // No more columns. -} curCols = schema.valueColumns(); // Switch key->value columns. initOffsets(baseOff + keyLen, nonNullVarlenValCols); + +if (nonNullVarlenValCols == 0) +
[ignite-3] 01/02: Minor refactoring.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git commit 6f838eb89529c6a17ab109e59304971d5f625279 Author: Andrew Mashenkov AuthorDate: Wed Apr 21 23:24:06 2021 +0300 Minor refactoring. --- .../org/apache/ignite/internal/schema/BinaryRow.java | 10 +- .../apache/ignite/internal/schema/ByteBufferRow.java | 2 +- .../java/org/apache/ignite/internal/schema/Row.java | 20 ++-- .../apache/ignite/internal/schema/RowAssembler.java | 17 ++--- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java index 577f50b..835b1d1 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java @@ -134,19 +134,19 @@ public interface BinaryRow { */ final class RowFlags { /** Flag indicated is row has no value chunk. */ -public static final int NO_VALUE = 1; +public static final int NO_VALUE_FLAG = 1; /** Flag indicates key chunk omits null map. */ -public static final int NO_KEY_NULL_MAP = 1 << 1; +public static final int OMIT_KEY_NULL_MAP_FLAG = 1 << 1; /** Flag indicates value chunk omits null map. */ -public static final int NO_VALUE_NULL_MAP = 1 << 2; +public static final int OMIT_VAL_NULL_MAP_FLAG = 1 << 2; /** Flag indicates key chunk omits varlen table. */ -public static final int NO_VARLEN_KEY_COL = 1 << 3; +public static final int OMIT_KEY_VARTBL_FLAG = 1 << 3; /** Flag indicates value chunk omits varlen table. */ -public static final int NO_VARLEN_VALUE_COL = 1 << 4; +public static final int OMIT_VAL_VARTBL_FLAG = 1 << 4; /** Stub. */ private RowFlags() { diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java index 8b86bc7..a2ed1a5 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java @@ -57,7 +57,7 @@ public class ByteBufferRow implements BinaryRow { @Override public boolean hasValue() { short flags = readShort(FLAGS_FIELD_OFFSET); -return (flags & RowFlags.NO_VALUE) == 0; +return (flags & RowFlags.NO_VALUE_FLAG) == 0; } /** {@inheritDoc} */ diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java index b9cf9cd..e970f3d 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java @@ -25,7 +25,7 @@ import java.util.UUID; /** * Schema-aware row. - * + * * The class contains non-generic methods to read boxed and unboxed primitives based on the schema column types. * Any type conversions and coercions should be implemented outside the row by the key-value or query runtime. * When a non-boxed primitive is read from a null column value, it is converted to the primitive type default value. @@ -38,6 +38,14 @@ public class Row implements BinaryRow { private final BinaryRow row; /** + * @param itemIdx Varlen table item index. + * @return Varlen item offset. + */ +public static int varlenItemOffset(int itemIdx) { +return VARLEN_TABLE_SIZE_FIELD_SIZE + itemIdx * VARLEN_COLUMN_OFFSET_FIELD_SIZE; +} + +/** * Constructor. * * @param schema Schema. @@ -431,15 +439,15 @@ public class Row implements BinaryRow { idx -= cols.numberOfFixsizeColumns() + numNullsBefore; int vartableSize = readShort(vartableOffset(baseOff, cols)); -int vartableOff = vartableOffset(baseOff, cols) + VARLEN_TABLE_SIZE_FIELD_SIZE; +int vartableOff = vartableOffset(baseOff, cols); // Offset of idx-th column is from base offset. -int resOff = readShort(vartableOff + VARLEN_COLUMN_OFFSET_FIELD_SIZE * idx); +int resOff = readShort(vartableOff + varlenItemOffset(idx)); long len = idx == vartableSize - 1 ? // totalLength - columnStartOffset readInteger(baseOff) - resOff : // nextColumnStartOffset - columnStartOffset -readShort(vartableOff + VARLEN_COLUMN_OFFSET_FIELD_SIZE * (idx + 1)) - resOff; +readShort(vartableOff + varlenItemOffset(idx + 1)) - resOff; return (len << 32) | (resOff + baseOff); } @@ -470,9 +478,9 @@ public cla
[ignite-3] branch ignite-13670 updated (55df701 -> cdfae80)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. discard 55df701 Minor refactoring. new 6f838eb Minor refactoring. new cdfae80 Omit writing empty varlen table. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (55df701) \ N -- N -- N refs/heads/ignite-13670 (cdfae80) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/ignite/internal/schema/BinaryRow.java | 10 +-- .../ignite/internal/schema/ByteBufferRow.java | 2 +- .../org/apache/ignite/internal/schema/Row.java | 22 +++-- .../ignite/internal/schema/RowAssembler.java | 28 -- .../ignite/internal/schema/RowAssemblerTest.java | 100 ++--- 5 files changed, 92 insertions(+), 70 deletions(-)
[ignite-3] 02/02: Minor refactoring.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git commit 55df701b77191056f4d6d0f4788d13966de447f3 Author: Andrew Mashenkov AuthorDate: Wed Apr 21 23:24:06 2021 +0300 Minor refactoring. --- .../main/java/org/apache/ignite/internal/schema/Row.java | 16 .../org/apache/ignite/internal/schema/RowAssembler.java | 11 +++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java index b9cf9cd..2b736ad 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java @@ -38,6 +38,14 @@ public class Row implements BinaryRow { private final BinaryRow row; /** + * @param itemIdx Varlen table item index. + * @return Varlen item offset. + */ +public static int varlenItemOffset(int itemIdx) { +return VARLEN_TABLE_SIZE_FIELD_SIZE + itemIdx * VARLEN_COLUMN_OFFSET_FIELD_SIZE; +} + +/** * Constructor. * * @param schema Schema. @@ -431,15 +439,15 @@ public class Row implements BinaryRow { idx -= cols.numberOfFixsizeColumns() + numNullsBefore; int vartableSize = readShort(vartableOffset(baseOff, cols)); -int vartableOff = vartableOffset(baseOff, cols) + VARLEN_TABLE_SIZE_FIELD_SIZE; +int vartableOff = vartableOffset(baseOff, cols); // Offset of idx-th column is from base offset. -int resOff = readShort(vartableOff + VARLEN_COLUMN_OFFSET_FIELD_SIZE * idx); +int resOff = readShort(vartableOff + varlenItemOffset(idx)); long len = idx == vartableSize - 1 ? // totalLength - columnStartOffset readInteger(baseOff) - resOff : // nextColumnStartOffset - columnStartOffset -readShort(vartableOff + VARLEN_COLUMN_OFFSET_FIELD_SIZE * (idx + 1)) - resOff; +readShort(vartableOff + varlenItemOffset(idx + 1)) - resOff; return (len << 32) | (resOff + baseOff); } @@ -472,7 +480,7 @@ public class Row implements BinaryRow { final int vartableOffset = vartableOffset(baseOff, cols); -int vartableLen = VARLEN_TABLE_SIZE_FIELD_SIZE + readShort(vartableOffset) * VARLEN_COLUMN_OFFSET_FIELD_SIZE; +int vartableLen = varlenItemOffset(readShort(vartableOffset)); return vartableOffset + vartableLen + off; } diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java index 1d589d5..08d9a58 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java @@ -24,6 +24,9 @@ import java.util.BitSet; import java.util.UUID; import org.apache.ignite.internal.schema.BinaryRow.RowFlags; +import static org.apache.ignite.internal.schema.BinaryRow.VARLEN_COLUMN_OFFSET_FIELD_SIZE; +import static org.apache.ignite.internal.schema.BinaryRow.VARLEN_TABLE_SIZE_FIELD_SIZE; + /** * Utility class to build rows using column appending pattern. The external user of this class must consult * with the schema and provide the columns in strict internal column sort order during the row construction. @@ -77,7 +80,7 @@ public class RowAssembler { * @return Total size of the varlen table. */ public static int varlenTableSize(int nonNullVarlenCols) { -return nonNullVarlenCols * BinaryRow.VARLEN_COLUMN_OFFSET_FIELD_SIZE; +return VARLEN_TABLE_SIZE_FIELD_SIZE + nonNullVarlenCols * VARLEN_COLUMN_OFFSET_FIELD_SIZE; } /** @@ -138,7 +141,7 @@ public class RowAssembler { */ static int rowChunkSize(Columns cols, int nonNullVarlenCols, int nonNullVarlenSize) { int size = BinaryRow.CHUNK_LEN_FIELD_SIZE + cols.nullMapSize() + -BinaryRow.VARLEN_TABLE_SIZE_FIELD_SIZE + varlenTableSize(nonNullVarlenCols); +varlenTableSize(nonNullVarlenCols); for (int i = 0; i < cols.numberOfFixsizeColumns(); i++) size += cols.column(i).type().length(); @@ -379,7 +382,7 @@ public class RowAssembler { private void writeOffset(int tblEntryIdx, int off) { assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ? RowFlags.NO_VARLEN_KEY_COL : RowFlags.NO_VARLEN_VALUE_COL)) == 0; -buf.putShort(varlenTblOff + BinaryRow.VARLEN_COLUMN_OFFSET_FIELD_SIZE * tblEntryIdx, (short)off); +buf.putShort(varlenTblOff + Row.varlenItemOffset(tblEntryIdx), (short)off); } /** @@ -473,7 +476,7 @@ public class RowAssembler { curVarlenTblEntry = 0; nullMapO
[ignite-3] branch ignite-13670 updated (091605b -> 55df701)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. discard 091605b Put RowFlags in order described in IEP. new 3355eda Put RowFlags in order described in IEP. new 55df701 Minor refactoring. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (091605b) \ N -- N -- N refs/heads/ignite-13670 (55df701) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/ignite/internal/schema/BinaryRow.java | 2 +- .../main/java/org/apache/ignite/internal/schema/Row.java | 16 .../org/apache/ignite/internal/schema/RowAssembler.java | 11 +++ 3 files changed, 20 insertions(+), 9 deletions(-)
[ignite-3] 01/02: Put RowFlags in order described in IEP.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git commit 3355eda6354e3da7089acdccc0f80de24eca70b4 Author: Andrew Mashenkov AuthorDate: Wed Apr 21 22:59:19 2021 +0300 Put RowFlags in order described in IEP. --- .../apache/ignite/internal/schema/BinaryRow.java | 17 +--- .../ignite/internal/schema/ByteBufferRow.java | 2 +- .../ignite/internal/schema/RowAssembler.java | 9 -- .../ignite/internal/schema/RowAssemblerTest.java | 32 +++--- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java index 776504a..577f50b 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java @@ -133,11 +133,20 @@ public interface BinaryRow { * Row flags. */ final class RowFlags { -/** Tombstone flag. */ -public static final int TOMBSTONE = 1; +/** Flag indicated is row has no value chunk. */ +public static final int NO_VALUE = 1; -/** Null-value flag. */ -public static final int NULL_VALUE = 1 << 1; +/** Flag indicates key chunk omits null map. */ +public static final int NO_KEY_NULL_MAP = 1 << 1; + +/** Flag indicates value chunk omits null map. */ +public static final int NO_VALUE_NULL_MAP = 1 << 2; + +/** Flag indicates key chunk omits varlen table. */ +public static final int NO_VARLEN_KEY_COL = 1 << 3; + +/** Flag indicates value chunk omits varlen table. */ +public static final int NO_VARLEN_VALUE_COL = 1 << 4; /** Stub. */ private RowFlags() { diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java index 86672c7..8b86bc7 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java @@ -57,7 +57,7 @@ public class ByteBufferRow implements BinaryRow { @Override public boolean hasValue() { short flags = readShort(FLAGS_FIELD_OFFSET); -return (flags & (RowFlags.NULL_VALUE | RowFlags.TOMBSTONE)) == 0; +return (flags & RowFlags.NO_VALUE) == 0; } /** {@inheritDoc} */ diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java index 8994ab1..1d589d5 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java @@ -22,6 +22,7 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; import java.util.BitSet; import java.util.UUID; +import org.apache.ignite.internal.schema.BinaryRow.RowFlags; /** * Utility class to build rows using column appending pattern. The external user of this class must consult @@ -349,9 +350,9 @@ public class RowAssembler { throw new AssemblyException("Key column missed: colIdx=" + curCol); else { if (curCol == 0) -flags |= BinaryRow.RowFlags.NULL_VALUE; +flags |= RowFlags.NO_VALUE; else if (schema.valueColumns().length() != curCol) -throw new AssemblyException("Value column missed: colIdx=" + curCol); +throw new AssemblyException("Value column missed: colIdx=" + curCol); } buf.putShort(BinaryRow.FLAGS_FIELD_OFFSET, flags); @@ -376,6 +377,8 @@ public class RowAssembler { * @param off Offset to write. */ private void writeOffset(int tblEntryIdx, int off) { +assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ? RowFlags.NO_VARLEN_KEY_COL : RowFlags.NO_VARLEN_VALUE_COL)) == 0; + buf.putShort(varlenTblOff + BinaryRow.VARLEN_COLUMN_OFFSET_FIELD_SIZE * tblEntryIdx, (short)off); } @@ -407,6 +410,8 @@ public class RowAssembler { * @param colIdx Column index. */ private void setNull(int colIdx) { +assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ? RowFlags.NO_KEY_NULL_MAP : RowFlags.NO_VALUE_NULL_MAP)) == 0; + int byteInMap = colIdx / 8; int bitInByte = colIdx % 8; diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java index f215855..8ca733e 100644 --- a/modules/schema/src/test/java/org/apach
[ignite-3] 01/01: Put RowFlags in order described in IEP.
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git commit 091605b36c613f39edb7010b3b9eeea280c39dc3 Author: Andrew Mashenkov AuthorDate: Wed Apr 21 22:59:19 2021 +0300 Put RowFlags in order described in IEP. --- .../apache/ignite/internal/schema/BinaryRow.java | 17 +--- .../ignite/internal/schema/ByteBufferRow.java | 2 +- .../ignite/internal/schema/RowAssembler.java | 9 -- .../ignite/internal/schema/RowAssemblerTest.java | 32 +++--- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java index 776504a..5c8310a 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java @@ -133,11 +133,20 @@ public interface BinaryRow { * Row flags. */ final class RowFlags { -/** Tombstone flag. */ -public static final int TOMBSTONE = 1; +/** Flag indicated is row has no value. */ +public static final int NO_VALUE = 1; -/** Null-value flag. */ -public static final int NULL_VALUE = 1 << 1; +/** Flag indicates key chunk omits null map. */ +public static final int NO_KEY_NULL_MAP = 1 << 1; + +/** Flag indicates value chunk omits null map. */ +public static final int NO_VALUE_NULL_MAP = 1 << 2; + +/** Flag indicates key chunk omits varlen table. */ +public static final int NO_VARLEN_KEY_COL = 1 << 3; + +/** Flag indicates value chunk omits varlen table. */ +public static final int NO_VARLEN_VALUE_COL = 1 << 4; /** Stub. */ private RowFlags() { diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java index 86672c7..8b86bc7 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ByteBufferRow.java @@ -57,7 +57,7 @@ public class ByteBufferRow implements BinaryRow { @Override public boolean hasValue() { short flags = readShort(FLAGS_FIELD_OFFSET); -return (flags & (RowFlags.NULL_VALUE | RowFlags.TOMBSTONE)) == 0; +return (flags & RowFlags.NO_VALUE) == 0; } /** {@inheritDoc} */ diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java index 8994ab1..1d589d5 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java @@ -22,6 +22,7 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; import java.util.BitSet; import java.util.UUID; +import org.apache.ignite.internal.schema.BinaryRow.RowFlags; /** * Utility class to build rows using column appending pattern. The external user of this class must consult @@ -349,9 +350,9 @@ public class RowAssembler { throw new AssemblyException("Key column missed: colIdx=" + curCol); else { if (curCol == 0) -flags |= BinaryRow.RowFlags.NULL_VALUE; +flags |= RowFlags.NO_VALUE; else if (schema.valueColumns().length() != curCol) -throw new AssemblyException("Value column missed: colIdx=" + curCol); +throw new AssemblyException("Value column missed: colIdx=" + curCol); } buf.putShort(BinaryRow.FLAGS_FIELD_OFFSET, flags); @@ -376,6 +377,8 @@ public class RowAssembler { * @param off Offset to write. */ private void writeOffset(int tblEntryIdx, int off) { +assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ? RowFlags.NO_VARLEN_KEY_COL : RowFlags.NO_VARLEN_VALUE_COL)) == 0; + buf.putShort(varlenTblOff + BinaryRow.VARLEN_COLUMN_OFFSET_FIELD_SIZE * tblEntryIdx, (short)off); } @@ -407,6 +410,8 @@ public class RowAssembler { * @param colIdx Column index. */ private void setNull(int colIdx) { +assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ? RowFlags.NO_KEY_NULL_MAP : RowFlags.NO_VALUE_NULL_MAP)) == 0; + int byteInMap = colIdx / 8; int bitInByte = colIdx % 8; diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java index f215855..8ca733e 100644 --- a/modules/schema/src/test/java/org/apache/igni
[ignite-3] branch ignite-13670 created (now 091605b)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-13670 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. at 091605b Put RowFlags in order described in IEP. This branch includes the following new commits: new 091605b Put RowFlags in order described in IEP. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[ignite-python-thin-client] annotated tag 0.4.0 created (now 0546f4c)
This is an automated email from the ASF dual-hosted git repository. isapego pushed a change to annotated tag 0.4.0 in repository https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git. at 0546f4c (tag) tagging 466b54527e6e42bc585c594d840a959d0b8626ef (commit) replaces 0.3.4 by Igor Sapego on Wed Apr 21 12:32:56 2021 -0700 - Log - 0.4.0 -BEGIN PGP SIGNATURE- iQGzBAABCgAdFiEEXBCgci2UdyeSPJi1rzXb2Vj+jcUFAmCAfewACgkQrzXb2Vj+ jcVTogwAnBb9VDSocZmjojg7ImHTToCOs2pvrC/K/wWooE3e3aXbbrSTts3bRPlQ hYFtRIpvI22o1TuPk6zPeeCGBvUCp6awOB0EL+GE7eJ4oZq29gP3UqO2MIySkNdh FtiP1HDijbut6ZuB9twk1V1MoHc8G4G0DQhiIVoAyUWie/fQmf/eDpw/MvJt+jmU HQNjTK942f/MLhgZ/eneXiFWOBSoHImCFtD4JlqjqqGnQQuThVv9hemFPD8XG6zZ Ymp0wGB2ukkhkhryfLfTTpHGJEOEXPtwfU7cAx4kKHHsorMsF68ag8+TJ0FH53lp BASFCwUo58tHvfwtIToDzNnntSvX6tVrZ8koD1EV8SektZeirrr5vs5erTPzup4+ r9KhbTNCdsFCty7QkCon6i6vN+jhFBJum8YwK8DnM7uuIMPjU97oIxTjJ1JW9um8 nJ5sRvNGVQ9GNLHHWQnn9RgIAOD/PYY+PWAJfPW5e73ZbXHl9mhY3i1N0W40BRbZ o+bHctTo =ED1+ -END PGP SIGNATURE- --- No new revisions were added by this update.
[ignite-3] branch main updated (3565c9d -> 73befa6)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git. from 3565c9d IGNITE-14411 Defined minimal set of cluster components and their lifecycle. Fixes #96 add 73befa6 IGNITE-14558 Add information about javadoc validation and generation commands to DEVNOTES.md (#97) No new revisions were added by this update. Summary of changes: DEVNOTES.md| 37 ++--- parent/pom.xml | 18 ++ 2 files changed, 48 insertions(+), 7 deletions(-)
svn commit: r47318 - in /release/ignite/pyignite: ./ 0.4.0/ 0.4.0/x86/ 0.4.0/x86_64/
Author: isapego Date: Wed Apr 21 18:55:40 2021 New Revision: 47318 Log: Publish pyignite-0.4.0 Added: release/ignite/pyignite/ release/ignite/pyignite/0.4.0/ release/ignite/pyignite/0.4.0/pyignite-0.4.0.tar.gz (with props) release/ignite/pyignite/0.4.0/pyignite-0.4.0.tar.gz.asc release/ignite/pyignite/0.4.0/pyignite-0.4.0.tar.gz.sha512 release/ignite/pyignite/0.4.0/pyignite-0.4.0.zip (with props) release/ignite/pyignite/0.4.0/pyignite-0.4.0.zip.asc release/ignite/pyignite/0.4.0/pyignite-0.4.0.zip.sha512 release/ignite/pyignite/0.4.0/x86/ release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-manylinux1_i686.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-manylinux1_i686.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-manylinux1_i686.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-win32.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-win32.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp36-cp36m-win32.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-manylinux1_i686.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-manylinux1_i686.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-manylinux1_i686.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-win32.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-win32.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp37-cp37m-win32.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-manylinux1_i686.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-manylinux1_i686.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-manylinux1_i686.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-win32.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-win32.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp38-cp38-win32.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-manylinux1_i686.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-manylinux1_i686.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-manylinux1_i686.whl.sha512 release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-win32.whl (with props) release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-win32.whl.asc release/ignite/pyignite/0.4.0/x86/pyignite-0.4.0-cp39-cp39-win32.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/ release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-manylinux1_x86_64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-manylinux1_x86_64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-manylinux1_x86_64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-win_amd64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-win_amd64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp36-cp36m-win_amd64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-manylinux1_x86_64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-manylinux1_x86_64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-manylinux1_x86_64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-win_amd64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-win_amd64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp37-cp37m-win_amd64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-manylinux1_x86_64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-manylinux1_x86_64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-manylinux1_x86_64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-win_amd64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-win_amd64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp38-cp38-win_amd64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-manylinux1_x86_64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-manylinux1_x86_64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-manylinux1_x86_64.whl.sha512 release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-win_amd64.whl (with props) release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-win_amd64.whl.asc release/ignite/pyignite/0.4.0/x86_64/pyignite-0.4.0-cp39-cp39-win_amd64.whl.
[ignite-3] branch ignite-14557 updated (f560628 -> c30d85c)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-14557 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. discard f560628 Minor refactoring. Add row layout tests. add c30d85c Minor refactoring. Add row layout tests. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (f560628) \ N -- N -- N refs/heads/ignite-14557 (c30d85c) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../ignite/internal/schema/marshaller/asm/AsmSerializerGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[ignite-3] branch ignite-14557 updated (6913e2f -> f560628)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-14557 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. discard 6913e2f Minor refactoring. Add row layout tests. add f560628 Minor refactoring. Add row layout tests. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (6913e2f) \ N -- N -- N refs/heads/ignite-14557 (f560628) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../org/apache/ignite/internal/schema/RowAssembler.java | 1 - .../apache/ignite/internal/schema/RowAssemblerTest.java | 17 + 2 files changed, 17 insertions(+), 1 deletion(-)
[ignite-3] branch ignite-14557 updated (1ea9977 -> 6913e2f)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-14557 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. from 1ea9977 Minor. add 6913e2f Minor refactoring. Add row layout tests. No new revisions were added by this update. Summary of changes: .../ignite/internal/schema/ExpandableByteBuf.java | 4 +- .../ignite/internal/schema/RowAssembler.java | 58 +- .../marshaller/reflection/JavaSerializer.java | 2 +- .../ignite/internal/schema/RowAssemblerTest.java | 613 + .../org/apache/ignite/internal/schema/RowTest.java | 2 +- 5 files changed, 648 insertions(+), 31 deletions(-) create mode 100644 modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java
[ignite] branch sql-calcite updated: IGNITE-13548 Calcite integration. DROP TABLE support
This is an automated email from the ASF dual-hosted git repository. tledkov pushed a commit to branch sql-calcite in repository https://gitbox.apache.org/repos/asf/ignite.git The following commit(s) were added to refs/heads/sql-calcite by this push: new b839f0e IGNITE-13548 Calcite integration. DROP TABLE support b839f0e is described below commit b839f0e9ae09e09124fb0270dce33a56f8bc Author: korlov42 AuthorDate: Wed Apr 21 18:50:35 2021 +0300 IGNITE-13548 Calcite integration. DROP TABLE support --- modules/calcite/src/main/codegen/config.fmpp | 2 + .../src/main/codegen/includes/parserImpls.ftl | 48 +++ .../java/org/apache/calcite/sql/IgniteSqlNode.java | 31 .../query/calcite/exec/ExecutionServiceImpl.java | 1 + .../query/calcite/exec/ddl/DdlCommandHandler.java | 26 ++ .../prepare/ddl/DdlSqlToCommandConverter.java | 92 ++ .../calcite/prepare/ddl/DropTableCommand.java | 74 + .../calcite/sql/IgniteSqlCreateTableOption.java| 34 ++-- ...ationTest.java => TableDdlIntegrationTest.java} | 79 ++- .../ignite/testsuites/IgniteCalciteTestSuite.java | 4 +- 10 files changed, 304 insertions(+), 87 deletions(-) diff --git a/modules/calcite/src/main/codegen/config.fmpp b/modules/calcite/src/main/codegen/config.fmpp index a7db7a4..635bf1f 100644 --- a/modules/calcite/src/main/codegen/config.fmpp +++ b/modules/calcite/src/main/codegen/config.fmpp @@ -28,6 +28,7 @@ data: { # Example: "org.apache.calcite.sql.*", "java.util.List". imports: [ "org.apache.calcite.sql.SqlCreate", + "org.apache.calcite.sql.SqlDrop", "org.apache.calcite.sql.SqlLiteral", "org.apache.calcite.schema.ColumnStrategy", "org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTable", @@ -589,6 +590,7 @@ data: { # Each must accept arguments "(SqlParserPos pos)". # Example: "SqlDropSchema". dropStatementParserMethods: [ + "SqlDropTable" ] # List of methods for parsing extensions to "DROP" calls. diff --git a/modules/calcite/src/main/codegen/includes/parserImpls.ftl b/modules/calcite/src/main/codegen/includes/parserImpls.ftl index 6583b7d..7b43a6d 100644 --- a/modules/calcite/src/main/codegen/includes/parserImpls.ftl +++ b/modules/calcite/src/main/codegen/includes/parserImpls.ftl @@ -39,41 +39,41 @@ SqlNodeList CreateTableOptionList() : } } -IgniteSqlCreateTableOptionEnum CreateTableOptionEnumOpt() : +SqlLiteral CreateTableOptionKey() : { } { - { return IgniteSqlCreateTableOptionEnum.TEMPLATE; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.TEMPLATE, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.BACKUPS; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.BACKUPS, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.AFFINITY_KEY; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.AFFINITY_KEY, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.ATOMICITY; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.ATOMICITY, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.WRITE_SYNCHRONIZATION_MODE; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.WRITE_SYNCHRONIZATION_MODE, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.CACHE_GROUP; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.CACHE_GROUP, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.CACHE_NAME; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.CACHE_NAME, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.DATA_REGION; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.DATA_REGION, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.KEY_TYPE; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.KEY_TYPE, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.VALUE_TYPE; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.VALUE_TYPE, getPos()); } | - { return IgniteSqlCreateTableOptionEnum.ENCRYPTED; } + { return SqlLiteral.createSymbol(IgniteSqlCreateTableOptionEnum.ENCRYPTED, getPos()); } } void CreateTableOption(List list) : { final Span s; -final IgniteSqlCreateTableOptionEnum key; +final SqlLiteral key; final SqlNode val; } { -key = CreateTableOptionEnumOpt() { s = span(); } +key = CreateTableOptionKey() { s = span(); } ( val = Literal() @@ -164,6 +164,26 @@ SqlCreate SqlCreateTable(Span s, boolean replace) : } } +boolean IfExistsOpt() : +{ +} +{ + { return true; } +| +{ return false; } +} + +SqlDrop SqlDropTable(Span s, boolean replace) : +{ +final boolean ifExists; +final SqlIdentifier id; +} +{ + ifExists = IfExistsOpt() id = CompoundIdentifie
[ignite] branch ignite-ducktape updated: IGNITE-14601 Specs should use service's params instead of copying. (#9027)
This is an automated email from the ASF dual-hosted git repository. av pushed a commit to branch ignite-ducktape in repository https://gitbox.apache.org/repos/asf/ignite.git The following commit(s) were added to refs/heads/ignite-ducktape by this push: new 09050ab IGNITE-14601 Specs should use service's params instead of copying. (#9027) 09050ab is described below commit 09050abb157395f2031f0f9cd4acc76628586425 Author: Anton Vinogradov AuthorDate: Wed Apr 21 18:28:20 2021 +0300 IGNITE-14601 Specs should use service's params instead of copying. (#9027) --- .../ducktests/tests/ignitetest/services/ignite.py | 2 +- .../tests/ignitetest/services/ignite_app.py| 3 +- .../ignitetest/services/utils/ignite_aware.py | 7 +- .../tests/ignitetest/services/utils/ignite_spec.py | 180 ++--- .../tests/ignitetest/services/utils/jmx_utils.py | 10 +- .../tests/ignitetest/tests/snapshot_test.py| 50 ++ 6 files changed, 106 insertions(+), 146 deletions(-) diff --git a/modules/ducktests/tests/ignitetest/services/ignite.py b/modules/ducktests/tests/ignitetest/services/ignite.py index 659739c..1e926c7 100644 --- a/modules/ducktests/tests/ignitetest/services/ignite.py +++ b/modules/ducktests/tests/ignitetest/services/ignite.py @@ -30,4 +30,4 @@ class IgniteService(IgniteAwareService): def __init__(self, context, config, num_nodes, jvm_opts=None, full_jvm_opts=None, startup_timeout_sec=60, shutdown_timeout_sec=10, modules=None): super().__init__(context, config, num_nodes, startup_timeout_sec, shutdown_timeout_sec, self.APP_SERVICE_CLASS, - modules=modules, jvm_opts=jvm_opts, full_jvm_opts=full_jvm_opts) + modules, jvm_opts=jvm_opts, full_jvm_opts=full_jvm_opts) diff --git a/modules/ducktests/tests/ignitetest/services/ignite_app.py b/modules/ducktests/tests/ignitetest/services/ignite_app.py index 59e87ff..fa9f765 100644 --- a/modules/ducktests/tests/ignitetest/services/ignite_app.py +++ b/modules/ducktests/tests/ignitetest/services/ignite_app.py @@ -40,8 +40,7 @@ class IgniteApplicationService(IgniteAwareService): shutdown_timeout_sec=10, modules=None, main_java_class=SERVICE_JAVA_CLASS_NAME, jvm_opts=None, full_jvm_opts=None): super().__init__(context, config, num_nodes, startup_timeout_sec, shutdown_timeout_sec, main_java_class, - modules=modules, java_class_name=java_class_name, params=params, - jvm_opts=jvm_opts, full_jvm_opts=full_jvm_opts) + modules, jvm_opts=jvm_opts, full_jvm_opts=full_jvm_opts) self.java_class_name = java_class_name self.params = params diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index ca906fd..10fbf54 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -54,7 +54,7 @@ class IgniteAwareService(BackgroundThreadService, IgnitePathAware, metaclass=ABC ALL = 2 # pylint: disable=R0913 -def __init__(self, context, config, num_nodes, startup_timeout_sec, shutdown_timeout_sec, main_java_class, +def __init__(self, context, config, num_nodes, startup_timeout_sec, shutdown_timeout_sec, main_java_class, modules, **kwargs): """ **kwargs are params that passed to IgniteSpec @@ -69,8 +69,9 @@ class IgniteAwareService(BackgroundThreadService, IgnitePathAware, metaclass=ABC self.main_java_class = main_java_class self.startup_timeout_sec = startup_timeout_sec self.shutdown_timeout_sec = shutdown_timeout_sec +self.modules = modules -self.spec = resolve_spec(self, context, config, main_java_class, **kwargs) +self.spec = resolve_spec(self, **kwargs) self.init_logs_attribute() self.disconnected_nodes = [] @@ -113,7 +114,7 @@ class IgniteAwareService(BackgroundThreadService, IgnitePathAware, metaclass=ABC wait_until(lambda: self.alive(node), timeout_sec=10) -ignite_jmx_mixin(node, self.spec, self.pids(node)) +ignite_jmx_mixin(node, self) def stop_async(self, force_stop=False, **kwargs): """ diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 28f309c..9731e2c 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -31,13 +31,14 @@ from ignitetest.services.utils.path import get_home_dir, get_module_path, Ignite from ignitetest.utils.version import DEV_BRANCH -def resolve_spec(service, context, config, main_java_class, **kwargs): +def resolve_spec(service,
[ignite] branch sql-calcite updated: IGNITE-14590 Calcite engine. Sort out the types/decimal and types/string directories
This is an automated email from the ASF dual-hosted git repository. tledkov pushed a commit to branch sql-calcite in repository https://gitbox.apache.org/repos/asf/ignite.git The following commit(s) were added to refs/heads/sql-calcite by this push: new 021452d IGNITE-14590 Calcite engine. Sort out the types/decimal and types/string directories 021452d is described below commit 021452dfcff8ea4854884c4178baacde7bb75218 Author: korlov42 AuthorDate: Wed Apr 21 17:30:31 2021 +0300 IGNITE-14590 Calcite engine. Sort out the types/decimal and types/string directories --- .../query/calcite/externalize/RelJsonReader.java | 6 ++- .../query/calcite/prepare/IgniteSqlValidator.java | 7 +++ .../query/calcite/logical/ScriptTestRunner.java| 7 ++- .../query/calcite/logical/SqlScriptRunner.java | 3 +- .../test/sql/types/decimal/cast_from_decimal.test | 18 --- ...decimal.test => cast_from_decimal.test_ignored} | 1 + .../test/sql/types/decimal/cast_to_decimal.test| 60 +++--- ...o_decimal.test => cast_to_decimal.test_ignored} | 1 + .../test/sql/types/decimal/decimal_aggregates.test | 48 ++--- ...egates.test => decimal_aggregates.test_ignored} | 4 ++ .../test/sql/types/decimal/decimal_arithmetic.test | 41 ++- ...hmetic.test => decimal_arithmetic.test_ignored} | 1 + .../sql/types/decimal/large_decimal_constants.test | 21 ...s.test => large_decimal_constants.test_ignored} | 1 + ...test_decimal.test => test_decimal.test_ignored} | 2 + .../test/sql/types/decimal/test_decimal_ops.test | 21 ++-- ...imal_ops.test => test_decimal_ops.test_ignored} | 1 + .../test/sql/types/string/test_big_strings.test| 8 +-- .../types/string/test_scan_big_varchar.test_slow | 56 ++-- ...low => test_scan_big_varchar.test_slow_ignored} | 33 ++-- ...test_unicode.test => test_unicode.test_ignored} | 1 + 21 files changed, 96 insertions(+), 245 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java index 3461d89..10aea34f 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.function.Function; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import org.apache.calcite.plan.RelOptCluster; @@ -57,6 +58,9 @@ public class RelJsonReader { new TypeReference>() {}; /** */ +private final ObjectMapper mapper = new ObjectMapper().enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); + +/** */ private final RelOptCluster cluster; /** */ @@ -90,7 +94,7 @@ public class RelJsonReader { public RelNode read(String s) { try { lastRel = null; -Map o = new ObjectMapper().readValue(s, TYPE_REF); +Map o = mapper.readValue(s, TYPE_REF); List> rels = (List)o.get("rels"); readRels(rels); return lastRel; diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java index 0eb189d5..ac46fe4 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java @@ -44,6 +44,7 @@ import org.apache.calcite.sql.SqlUpdate; import org.apache.calcite.sql.SqlUtil; import org.apache.calcite.sql.dialect.CalciteSqlDialect; import org.apache.calcite.sql.parser.SqlParserPos; +import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.sql.validate.SelectScope; import org.apache.calcite.sql.validate.SqlValidator; import org.apache.calcite.sql.validate.SqlValidatorImpl; @@ -120,6 +121,12 @@ public class IgniteSqlValidator extends SqlValidatorImpl { } /** {@inheritDoc} */ +@Override public void validateLiteral(SqlLiteral literal) { +if (literal.getTypeName() != SqlTypeName.DECIMAL) +super.validateLiteral(literal); +} + +/** {@inheritDoc} */ @Override protected SqlSelect createSourceSelectForUpdate(SqlUpdate call) { final SqlNodeList selectList = SqlNodeList.of( new SqlIdentifier(QueryUtils.KEY_FIELD_NAME, SqlParserPos.ZERO), diff --git a/modules/calcite/src/
[ignite] branch sql-calcite updated: IGNITE-14549 Calcite. ORDER BY column not from SELECT LIST
This is an automated email from the ASF dual-hosted git repository. tledkov pushed a commit to branch sql-calcite in repository https://gitbox.apache.org/repos/asf/ignite.git The following commit(s) were added to refs/heads/sql-calcite by this push: new 9c32f78 IGNITE-14549 Calcite. ORDER BY column not from SELECT LIST 9c32f78 is described below commit 9c32f7874331044e31bb6eb3baa06ef959a06bff Author: korlov42 AuthorDate: Wed Apr 21 16:38:20 2021 +0300 IGNITE-14549 Calcite. ORDER BY column not from SELECT LIST --- .../query/calcite/exec/ExecutionServiceImpl.java | 20 +++-- .../query/calcite/prepare/IgnitePlanner.java | 3 +-- .../query/calcite/CalciteQueryProcessorTest.java | 25 ++ .../query/calcite/planner/PlannerTest.java | 2 +- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java index b9ca57d..449ddb5 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java @@ -41,6 +41,8 @@ import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.RelRoot; import org.apache.calcite.rel.hint.Hintable; import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.rex.RexNode; import org.apache.calcite.sql.SqlDdl; import org.apache.calcite.sql.SqlExplain; import org.apache.calcite.sql.SqlExplainLevel; @@ -50,6 +52,7 @@ import org.apache.calcite.sql.parser.SqlParseException; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.tools.Frameworks; import org.apache.calcite.tools.ValidationException; +import org.apache.calcite.util.Pair; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.cache.query.FieldsQueryCursor; @@ -104,6 +107,7 @@ import org.apache.ignite.internal.processors.query.calcite.prepare.Splitter; import org.apache.ignite.internal.processors.query.calcite.prepare.ValidationResult; import org.apache.ignite.internal.processors.query.calcite.prepare.ddl.DdlSqlToCommandConverter; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteConvention; +import org.apache.ignite.internal.processors.query.calcite.rel.IgniteProject; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteRel; import org.apache.ignite.internal.processors.query.calcite.schema.SchemaHolder; import org.apache.ignite.internal.processors.query.calcite.trait.CorrelationTraitDef; @@ -631,7 +635,7 @@ public class ExecutionServiceImpl extends AbstractService implements Execut // Convert to Relational operators graph RelRoot root = planner.rel(sqlNode); -RelNode rel = root.project(); +RelNode rel = root.rel; if (rel instanceof Hintable) planner.setDisabledRules(HintUtils.disabledRules((Hintable)rel)); @@ -645,7 +649,19 @@ public class ExecutionServiceImpl extends AbstractService implements Execut .replace(root.collation == null ? RelCollations.EMPTY : root.collation) .simplify(); -return planner.transform(PlannerPhase.OPTIMIZATION, desired, rel); +IgniteRel igniteRel = planner.transform(PlannerPhase.OPTIMIZATION, desired, rel); + +if (!root.isRefTrivial()) { +final List projects = new ArrayList<>(); +final RexBuilder rexBuilder = igniteRel.getCluster().getRexBuilder(); + +for (int field : Pair.left(root.fields)) +projects.add(rexBuilder.makeInputRef(igniteRel, field)); + +igniteRel = new IgniteProject(igniteRel.getCluster(), desired, igniteRel, projects, root.validatedRowType); +} + +return igniteRel; } catch (Throwable ex) { log.error("Unexpected error at query optimizer.", ex); diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgnitePlanner.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgnitePlanner.java index ec7daaf..fdf9b73 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgnitePlanner.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgnitePlanner.java @@ -208,7 +208,7 @@ public class IgnitePlanner implements Planner, RelOptTable.ViewExpander { /** {@inheritDoc} */ @Override public RelNode convert(SqlNode sql) { -return rel(sq
[ignite-3] branch main updated: IGNITE-14411 Defined minimal set of cluster components and their lifecycle. Fixes #96
This is an automated email from the ASF dual-hosted git repository. sk0x50 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git The following commit(s) were added to refs/heads/main by this push: new 3565c9d IGNITE-14411 Defined minimal set of cluster components and their lifecycle. Fixes #96 3565c9d is described below commit 3565c9d0ab61af1dcc44ad3060e1facae4d7461c Author: Alexander Lapin AuthorDate: Wed Apr 21 15:29:21 2021 +0300 IGNITE-14411 Defined minimal set of cluster components and their lifecycle. Fixes #96 Signed-off-by: Slava Koptilin --- modules/{table => affinity}/pom.xml| 43 ++- .../ignite/internal/affinity/AffinityManager.java | 60 modules/api/pom.xml| 6 + .../main/java/org/apache/ignite/app/Ignite.java} | 15 +- .../main/java/org/apache/ignite/app/Ignition.java} | 17 +- .../org/apache/ignite/app/IgnitionManager.java | 62 .../network/NetworkConfigurationSchema.java} | 15 +- .../schemas/rest}/RestConfigurationSchema.java | 6 +- .../runner/ClusterConfigurationSchema.java}| 25 +- .../apache/ignite/table/manager/TableManager.java} | 7 +- modules/baseline/pom.xml | 54 .../ignite/internal/baseline/BaselineManager.java | 58 .../notifications/ConfigurationListenerTest.java | 16 +- .../ignite/configuration/sample/UsageTest.java | 21 +- modules/configuration/pom.xml | 5 + .../ignite/configuration/ConfigurationChanger.java | 7 + .../configuration/ConfigurationRegistry.java | 34 +- .../internal/ConfigurationManager.java | 92 ++ .../internal/rest/FormatConverter.java}| 25 +- .../configuration/internal/rest/JsonConverter.java | 356 + .../ignite/configuration/validation/Validator.java | 2 - modules/metastorage/pom.xml| 60 .../internal/metastorage/MetaStorageManager.java | 112 +++ .../network/MetaStorageMessageTypes.java} | 30 +- .../org/apache/ignite/internal/raft/Loza.java} | 21 +- modules/rest/pom.xml | 6 + .../java/org/apache/ignite/rest/RestModule.java| 5 +- .../rest/presentation/json/JsonConverterTest.java | 12 +- modules/runner/pom.xml | 61 +++- .../ignite/internal/runner/app/IgnitionTest.java | 81 + .../java/org/apache/ignite/app/IgniteRunner.java | 113 +-- .../ignite/configuration/ConfigurationModule.java | 67 .../apache/ignite/internal/app/IgniteImpl.java}| 29 +- .../apache/ignite/internal/app/IgnitionImpl.java | 181 +++ .../storage/DistributedConfigurationStorage.java | 104 ++ .../storage/LocalConfigurationStorage.java | 104 ++ .../services/org.apache.ignite.app.Ignition| 1 + .../ignite/internal/schema/SchemaManager.java} | 21 +- modules/table/pom.xml | 31 ++ .../table/distributed/TableManagerImpl.java| 69 modules/{api => vault}/pom.xml | 15 +- .../ignite/internal/vault/VaultManager.java} | 17 +- parent/pom.xml | 1 + pom.xml| 4 + 44 files changed, 1766 insertions(+), 305 deletions(-) diff --git a/modules/table/pom.xml b/modules/affinity/pom.xml similarity index 55% copy from modules/table/pom.xml copy to modules/affinity/pom.xml index 1f58901..42c02af 100644 --- a/modules/table/pom.xml +++ b/modules/affinity/pom.xml @@ -1,25 +1,22 @@ + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> - http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> @@ -32,38 +29,38 @@ ../../parent/pom.xml -ignite-table +ignite-affinity 3.0.0-SNAPSHOT org.apache.ignite -ignite-api +ignite-configuration ${project.version} org.apache.ignite -ignite-schema +ignite-metastorage ${project.version} org.apache.ignite -ignite-core +ignite-baseline ${project.version} - + org.junit.jupiter -junit-jupiter-engine +junit-jupiter-api test org.junit.jupiter -junit-ju
[ignite] branch master updated: IGNITE-13399 Fix access right issues in computation of system metrics - Fixes #8903.
This is an automated email from the ASF dual-hosted git repository. ilyak pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite.git The following commit(s) were added to refs/heads/master by this push: new 46e0449 IGNITE-13399 Fix access right issues in computation of system metrics - Fixes #8903. 46e0449 is described below commit 46e0449b2fdf3c103da8b38056fb6b7cd3b065f6 Author: Denis Mekhanikov AuthorDate: Wed Apr 21 14:29:02 2021 +0300 IGNITE-13399 Fix access right issues in computation of system metrics - Fixes #8903. Signed-off-by: Ilya Kasnacheev --- .../processors/metric/GridMetricManager.java | 10 +++- .../ignite/internal/metric/SystemMetricsTest.java | 66 ++ .../ignite/testsuites/IgniteCacheTestSuite9.java | 2 + 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java index 267b2a1..3527bc0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java @@ -781,7 +781,9 @@ public class GridMetricManager extends GridManagerAdapter imp */ private long totalSysMemory() { try { -return U.property(os, "totalPhysicalMemorySize"); +com.sun.management.OperatingSystemMXBean sunOs = (com.sun.management.OperatingSystemMXBean) os; + +return sunOs.getTotalPhysicalMemorySize(); } catch (RuntimeException ignored) { return -1; @@ -840,9 +842,11 @@ public class GridMetricManager extends GridManagerAdapter imp long cpuTime; try { -cpuTime = U.property(os, "processCpuTime"); +com.sun.management.OperatingSystemMXBean sunOs = (com.sun.management.OperatingSystemMXBean) os; + +cpuTime = sunOs.getProcessCpuTime(); } -catch (IgniteException ignored) { +catch (RuntimeException ignored) { return -1; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemMetricsTest.java new file mode 100644 index 000..f2a72c9 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemMetricsTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.metric; + +import org.apache.ignite.internal.IgniteNodeAttributes; +import org.apache.ignite.internal.processors.metric.GridMetricManager; +import org.apache.ignite.internal.processors.metric.MetricRegistry; +import org.apache.ignite.spi.metric.DoubleMetric; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; + +/** */ +public class SystemMetricsTest extends GridCommonAbstractTest { +/** {@inheritDoc} */ +@Override protected void beforeTestsStarted() throws Exception { +super.beforeTestsStarted(); + +startGrid(0); +} + +/** {@inheritDoc} */ +@Override protected void afterTestsStopped() throws Exception { +super.afterTestsStopped(); + +stopAllGrids(); +} + +/** + * Checks that the process CPU load metric is positive. + */ +@Test +public void testCpuLoadMetric() { +MetricRegistry sysReg = grid(0).context().metric().registry(GridMetricManager.SYS_METRICS); + +DoubleMetric cpuLoad = sysReg.doubleMetric(GridMetricManager.CPU_LOAD, GridMetricManager.CPU_LOAD_DESCRIPTION); + +double loadVal = cpuLoad.value(); + +assertTrue("CPU Load is negative: " + loadVal, loadVal >= 0); +} + +/** + * Checks that the total physical memory node attribute has a positive value. + */ +@Test +public void testTotalSystemMemory() { +long phyMem = (long)grid(0).context().nodeAttribute(IgniteNodeAttributes.ATTR_P
[ignite-3] branch ignite-14557 updated (fe74545 -> 1ea9977)
This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a change to branch ignite-14557 in repository https://gitbox.apache.org/repos/asf/ignite-3.git. from fe74545 Swap null-map and varlen-table. add 1ea9977 Minor. No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/ignite/internal/schema/BinaryRow.java | 6 +++--- .../main/java/org/apache/ignite/internal/schema/RowAssembler.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)