Skip to content

Commit 2daf127

Browse files
Merge pull request #70 from yuriy-glotanov/2025.1
RELEASE 2025.1
2 parents 03caa18 + 7c226d1 commit 2daf127

18 files changed

+292
-25
lines changed

src/main/java/su/interference/core/Config.java

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ this software and associated documentation files (the "Software"), to deal in
2626

2727
import org.slf4j.Logger;
2828
import org.slf4j.LoggerFactory;
29+
import su.interference.mgmt.MgmtConfig;
2930

30-
import java.util.ArrayList;
31-
import java.util.Properties;
31+
import java.util.*;
3232
import java.io.FileInputStream;
3333
import java.io.File;
3434
import java.io.IOException;
35-
import java.util.StringTokenizer;
3635

3736
/**
3837
* @author Yuriy Glotanov
@@ -460,4 +459,46 @@ private static int validatePercent(String value, String description, int def) {
460459
return def;
461460
}
462461

462+
public Map<String, Object> getSystemParameters() {
463+
Map<String, Object> result = new HashMap<>();
464+
result.put(P_LOCAL_NODE_ID, LOCAL_NODE_ID);
465+
result.put(P_DB_PATH, DB_PATH);
466+
result.put(JOURNAL_PATH, JOURNAL_PATH);
467+
result.put(P_CLUSTER_NODES, CLUSTER_NODES);
468+
result.put(P_REGISTER_CLASSES, REGISTER_CLASSES);
469+
result.put(P_MMPORT, MMPORT);
470+
result.put(P_RMPORT, RMPORT);
471+
result.put(P_FRAMESIZE, FRAMESIZE);
472+
result.put(P_FRAMESIZE2, FRAMESIZE2);
473+
result.put(P_FILES_AMOUNT, FILES_AMOUNT);
474+
result.put(P_DISKIO_MODE, DISKIO_MODE);
475+
result.put(P_SYNC_LOCK_ENABLE, SYNC_LOCK_ENABLE);
476+
result.put(P_SYNC_PERIOD, SYNC_PERIOD);
477+
result.put(P_RETRIEVE_QUEUE_SIZE, RETRIEVE_QUEUE_SIZE);
478+
result.put(P_RETRIEVE_THREADS_AMOUNT, RETRIEVE_THREADS_AMOUNT);
479+
result.put(P_CODEPAGE, CODEPAGE);
480+
result.put(P_DATEFORMAT, DATEFORMAT);
481+
result.put(P_REMOTE_SYNC_TIMEOUT, REMOTE_SYNC_TIMEOUT);
482+
result.put(P_READ_BUFFER_SIZE, READ_BUFFER_SIZE);
483+
result.put(P_WRITE_BUFFER_SIZE, WRITE_BUFFER_SIZE);
484+
result.put(P_TRANS_CLEANUP_TIMEOUT, TRANS_CLEANUP_TIMEOUT);
485+
result.put(P_CLEANUP_ENABLE, CLEANUP_ENABLE);
486+
result.put(P_CLEANUP_TIMEOUT, CLEANUP_TIMEOUT);
487+
result.put(P_CLEANUP_PROTECTION_THR, CLEANUP_PROTECTION_THR);
488+
result.put(P_IX_CLEANUP_PROTECTION_THR, IX_CLEANUP_PROTECTION_THR);
489+
result.put(P_HEAP_USE_THR_DATA, HEAP_USE_THR_DATA);
490+
result.put(P_HEAP_USE_THR_INDX, HEAP_USE_THR_INDX);
491+
result.put(P_HEAP_USE_THR_TEMP, HEAP_USE_THR_TEMP);
492+
result.put(P_HEAP_USE_THR_UNDO, HEAP_USE_THR_UNDO);
493+
return result;
494+
}
495+
496+
public List<MgmtConfig> getMgmtConfigParams() {
497+
List<MgmtConfig> result = new ArrayList<>();
498+
for (Map.Entry<String, Object> entry : getSystemParameters().entrySet()) {
499+
result.add(new MgmtConfig(entry.getKey(), entry.getValue()));
500+
}
501+
return result;
502+
}
503+
463504
}

src/main/java/su/interference/core/Instance.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,31 @@ public FreeFrame getFreeFrameById (long id) {
749749
return (FreeFrame)dc.getEntity();
750750
}
751751

752+
public int getFreeFramesCount (int fileId) {
753+
final IndexList ixf = tFreeFrame.getIndexFieldByColumn("frameId").getIndex();
754+
int result = 0;
755+
for (Object o : ixf.getContent()) {
756+
final DataChunk dc = (DataChunk) o;
757+
if (((FreeFrame) dc.getEntity()).getFile() == fileId) {
758+
result++;
759+
}
760+
}
761+
return result;
762+
}
763+
764+
public int getFramesCount (int fileId) {
765+
final MapField ixf = tFrameData.getMapFieldByColumn("frameId");
766+
final Map ixl = ixf.getMap();
767+
int result = 0;
768+
for (Object o : ixl.values()) {
769+
final DataChunk dc = (DataChunk) o;
770+
if (((FrameData) dc.getEntity()).getFile() == fileId) {
771+
result++;
772+
}
773+
}
774+
return result;
775+
}
776+
752777
public ArrayList<FrameSync> getSyncFrames(int nodeId) {
753778
final ArrayList<FrameSync> r = new ArrayList<>();
754779
String uuid = null;

src/main/java/su/interference/core/SyncQueue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2021 head systems, ltd
4+
Copyright (c) 2010-2025 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -140,6 +140,7 @@ public void commit() throws Exception {
140140
}
141141

142142
public void run () {
143+
this.f = true;
143144
Thread.currentThread().setName("interference-sync-thread-"+Thread.currentThread().getId());
144145
while (f) {
145146
latch = new CountDownLatch(1);

src/main/java/su/interference/core/SystemCleanUp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class SystemCleanUp implements Runnable, ManagedProcess {
4545
public static final int INDEX_RETRIEVED_PRIORITY = 9;
4646

4747
public void run () {
48+
this.f = true;
4849
Thread.currentThread().setName("interference-cleanup-thread-"+Thread.currentThread().getId());
4950
while (f) {
5051
latch = new CountDownLatch(1);

src/main/java/su/interference/core/TransCleanUp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The MIT License (MIT)
33
4-
Copyright (c) 2010-2021 head systems, ltd
4+
Copyright (c) 2010-2025 head systems, ltd
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -44,6 +44,7 @@ public class TransCleanUp implements Runnable, ManagedProcess {
4444
private final static Logger logger = LoggerFactory.getLogger(TransCleanUp.class);
4545

4646
public void run () {
47+
this.f = true;
4748
Thread.currentThread().setName("interference-transactions-cleanup-thread-"+Thread.currentThread().getId());
4849
while (f) {
4950
latch = new CountDownLatch(1);
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2010-2025 interference
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
this software and associated documentation files (the "Software"), to deal in
8+
the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+
the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+
*/
24+
25+
package su.interference.mgmt;
26+
27+
/**
28+
* @author Yuriy Glotanov
29+
* @since 1.0
30+
*/
31+
32+
@MgmtClass
33+
public class MgmtConfig {
34+
@MgmtColumn(name="Configuration parameter",width=20)
35+
private final String confParam;
36+
@MgmtColumn(name="Parameter Value",width=80)
37+
private final Object confValue;
38+
39+
public MgmtConfig(String confParam, Object confValue) {
40+
this.confParam = confParam;
41+
this.confValue = confValue;
42+
}
43+
44+
public String getConfParam() {
45+
return confParam;
46+
}
47+
48+
public String getConfValue() {
49+
if (confValue instanceof String[]) {
50+
return String.join("<br>", ((String[]) confValue));
51+
} else {
52+
return String.valueOf(confValue);
53+
}
54+
}
55+
}

src/main/java/su/interference/persistent/Cursor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ this software and associated documentation files (the "Software"), to deal in
2828
import su.interference.exception.InternalException;
2929
import su.interference.mgmt.MgmtClass;
3030
import su.interference.mgmt.MgmtColumn;
31+
import su.interference.sql.SQLCursor;
3132
import su.interference.sql.SQLSelect;
3233

3334
import javax.persistence.*;
@@ -221,4 +222,8 @@ public boolean isStream() {
221222
return this.type == STREAM_TYPE;
222223
}
223224

225+
public List<SQLCursor> getSQLCursors() {
226+
return this.getSqlStmt().getSQLCursors();
227+
}
228+
224229
}

src/main/java/su/interference/persistent/DataFile.java

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ this software and associated documentation files (the "Software"), to deal in
4141
import java.lang.reflect.InvocationTargetException;
4242
import javax.persistence.*;
4343

44+
import static su.interference.core.Storage.*;
45+
4446
/**
4547
* @author Yuriy Glotanov
4648
* @since 1.0
@@ -59,7 +61,6 @@ public class DataFile implements Serializable {
5961
private int fileId;
6062
@Column
6163
@IndexColumn
62-
@MgmtColumn(name="Type",width=10)
6364
private int type;
6465
@Column
6566
@IndexColumn
@@ -69,14 +70,21 @@ public class DataFile implements Serializable {
6970
@MgmtColumn(name="Name",width=70)
7071
private String fileName;
7172
@Column
72-
@MgmtColumn(name="Size",width=10)
7373
private long fileSize;
7474
@Column
75-
@MgmtColumn(name="Used",width=10)
7675
private long fileUsed;
7776
@Column
7877
private int fileExtAmount;
78+
@MgmtColumn(name="Frames allocated",width=20)
79+
@Transient
80+
private int framesCnt;
81+
@MgmtColumn(name="Frames deallocated",width=20)
82+
@Transient
83+
private int freeFramesCnt;
7984

85+
@MgmtColumn(name="Type",width=20)
86+
@Transient
87+
private String dataFileType;
8088
@Transient
8189
public static final int CLASS_ID = 4;
8290
@Transient
@@ -523,7 +531,7 @@ public void writeFrame(FrameData bd, final long ptr, final byte[] b, LLT llt, Se
523531
}
524532

525533
public boolean isData() {
526-
return this.type == Storage.DATAFILE_TYPEID;
534+
return this.type == DATAFILE_TYPEID;
527535
}
528536

529537
public boolean isIndex() {
@@ -590,4 +598,25 @@ public void setFileExtAmount(int fileExtAmount) {
590598
this.fileExtAmount = fileExtAmount;
591599
}
592600

601+
public int getFramesCnt() {
602+
return Instance.getInstance().getFramesCount(this.fileId);
603+
}
604+
605+
public int getFreeFramesCnt() {
606+
return Instance.getInstance().getFreeFramesCount(this.fileId);
607+
}
608+
609+
public String getDataFileType() {
610+
switch (this.type) {
611+
case DATAFILE_TYPEID:
612+
return "DATA";
613+
case INDXFILE_TYPEID:
614+
return "INDEX";
615+
case UNDOFILE_TYPEID:
616+
return "UNDO";
617+
case TEMPFILE_TYPEID:
618+
return "TEMP";
619+
}
620+
return "N/A";
621+
}
593622
}

src/main/java/su/interference/persistent/Process.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public void start (Runnable r, Session s) {
8686
this.ro = r;
8787
this.th = new Thread(r);
8888
this.th.start();
89-
Thread.State ts = this.th.getState();
90-
this.state = ts.name();
89+
this.state = "STARTED";
9190
try {
9291
s.persist(this); //update
9392
} catch (Exception e) {

src/main/java/su/interference/persistent/Transaction.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public class Transaction implements Serializable {
7575
@MgmtColumn(name="Timestamp",width=10)
7676
private long timeStamp;
7777
@Column
78-
@MgmtColumn(name="Transaction type",width=10)
7978
private int transType; // 0 - READ COMMITTED, 1 - SERIALIZABLE, 9 - THR
8079
@Column
8180
@MgmtColumn(name="MTRAN",width=10)
@@ -84,6 +83,9 @@ public class Transaction implements Serializable {
8483
@MgmtColumn(name="Commit Id",width=10)
8584
private long cid;
8685

86+
@MgmtColumn(name="Transaction type",width=20)
87+
@Transient
88+
private String transactionType;
8789
@Transient
8890
private final transient List<TransFrame> tframes = new CopyOnWriteArrayList<>();
8991
@Transient
@@ -781,4 +783,18 @@ public SQLJoin getJoin() {
781783
public void setJoin(SQLJoin join) {
782784
this.join = join;
783785
}
786+
787+
public String getTransactionType() {
788+
switch (this.transType) {
789+
case TRAN_READ_COMMITTED:
790+
return "READ COMMITTED";
791+
case TRAN_SERIALIZABLE:
792+
return "SERIALIZABLE";
793+
case TRAN_THR:
794+
return "COMPLETED";
795+
case TRAN_LEGACY:
796+
return "COMPLETED";
797+
}
798+
return "N/A";
799+
}
784800
}

0 commit comments

Comments
 (0)