Skip to content

Commit 5161629

Browse files
2020.3 hotfix (NPE in session.find())
1 parent 8ac514d commit 5161629

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public class Config {
113113
public final int READ_BUFFER_SIZE = 33554432;
114114
public final int WRITE_BUFFER_SIZE = 33554432;
115115
// cleanup
116+
public final int TRANS_CLEANUP_TIMEOUT = 5000;
116117
public final int CLEANUP_TIMEOUT = 3000;
117118
public final int CLEANUP_PROTECTION_THR = 1000;
118119
public final int IX_CLEANUP_PROTECTION_THR = 5000;

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ public Table getT() {
176176
return t;
177177
}
178178

179-
protected void setT(Table t) {
180-
this.t = t;
181-
}
182-
183179
public Comparable getId (Field idfield, Session s) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
184180
if (serializedId==null) {
185181
if (entity==null) {
@@ -325,12 +321,18 @@ public DataChunk (ValueSet vs, Session s, Table t) {
325321

326322
//serializer INSERT ONLY!!! (with generate Id value)
327323
public DataChunk (Object o, Session s) {
328-
this(o, s, null);
324+
this(o, s, null, null);
325+
}
326+
327+
//serializer INSERT ONLY!!! (with generate Id value)
328+
public DataChunk (Object o, Session s, Table t) {
329+
this(o, s, null, t);
329330
}
330331

331332
//serializer INSERT ONLY!!! (with generate Id value) - rowid for index chunk
332-
public DataChunk (Object o, Session s, RowId r) {
333+
public DataChunk (Object o, Session s, RowId r, Table t) {
333334
this.entity = o;
335+
this.t = t;
334336
this.state = NORMAL_STATE;
335337
this.header = new RowHeader(r, null, getChunk().length, false);
336338
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public SyncFrame(Frame frame, Session s, FreeFrame fb, boolean proc) throws Exce
8989
className = bd == null ? null : t.getName();
9090

9191
rtran = frame.getLiveTransactions();
92-
uframes = allowR ? bd.getLiveUFrameAllocIds() : null;
92+
uframes = allowR ? bd == null ? null : bd.getLiveUFrameAllocIds() : null;
9393

9494
if (frame.getClass().getName().equals("su.interference.core.DataFrame")) {
9595
if (frame.getType()!=0) {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public ArrayList<Object> getFrameEntities(Session s) throws Exception {
212212

213213
public Frame getFrame() throws Exception {
214214
if (frame == null) {
215-
if (getDataObject().isIndex()) {
215+
if (isIndex()) {
216216
frame = getIndexFrame();
217217
} else {
218218
frame = getDataFrame();
@@ -222,6 +222,10 @@ public Frame getFrame() throws Exception {
222222
return frame;
223223
}
224224

225+
public boolean isIndex() {
226+
return getDataObject().isIndex();
227+
}
228+
225229
public boolean isFrame() {
226230
return frame != null;
227231
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ protected DataChunk persist (final Object o, final Session s, final LLT extllt)
11511151
this.ident(o, s, llt); //ident system entities during persist
11521152
}
11531153

1154-
final DataChunk nc = new DataChunk(o, s);
1154+
final DataChunk nc = new DataChunk(o, s, this);
11551155
final int len = nc.getBytesAmount();
11561156
final WaitFrame bdw = getAvailableFrame(o, fpart);
11571157
final FrameData bd = bdw.getBd();
@@ -1797,7 +1797,7 @@ private byte[] append(byte[] b, byte[] toAdd){
17971797
//rowid used in DataChunk constructor for build standalone indexes
17981798
private synchronized void add (RowId rowid, Object o, Session s, LLT extllt) throws Exception {
17991799

1800-
final DataChunk dc = new DataChunk(o, s, rowid);
1800+
final DataChunk dc = new DataChunk(o, s, rowid, this);
18011801
final int len = dc.getBytesAmount();
18021802
dc.getHeader().setTran(s.getTransaction());
18031803

0 commit comments

Comments
 (0)