@@ -136,11 +136,14 @@ public void cleanICEntities() {
136136 }
137137 }
138138
139- public IndexFrame add (DataChunk e , Table t , Session s , LLT llt ) throws Exception {
139+ public synchronized IndexFrame add (DataChunk e , Table t , Session s , LLT llt ) throws Exception {
140140 if (this .isFill (e )) {
141141
142142 final int nfileId = t .getIndexFileId (this .getFrameData ());
143- final IndexFrame res = t .createNewFrame (this .getFrameData (), nfileId , this .getType (), 0 , false , false , false , s , llt ).getIndexFrame ();
143+ final IndexFrame res = t .createNewFrame (this .getFrameData (), null , nfileId , this .getType (), 0 , false , false , false , s , llt ).getIndexFrame ();
144+ //paranoid fix
145+ llt .add (res );
146+ llt .add (this );
144147 res .setParentF (this .getParentF ());
145148 res .setParentB (this .getParentB ());
146149 final ValueSet max = this .sort ();
@@ -159,19 +162,18 @@ public IndexFrame add (DataChunk e, Table t, Session s, LLT llt) throws Exceptio
159162 }
160163 this .setHasMV (1 );
161164 }
162- res .setLcF (this .getLcF ());
163- res .setLcB (this .getLcB ());
164- this .setLcF (0 );
165- this .setLcB (0 );
165+ res .setLcId (this .getLcId ());
166+ this .setLcId (0 );
166167 } else {
167- final int cmv = e .getDcs ().compareTo (this .getFrameData ().getMv ());
168+ //final int cmv = e.getDcs().compareTo(this.getFrameData().getMv());
169+ final int cmv = e .getDcs ().compareTo (max );
168170 if (cmv > 0 ) {
169171 throw new InternalException ();
170172 } else {
171173 res .setDivided (1 );
172174 this .insertChunk (e , s , false , llt );
173175 final ValueSet max2 = this .sort ();
174- final ArrayList <DataChunk > nlist = new ArrayList <DataChunk >();
176+ final ArrayList <DataChunk > nlist = new ArrayList <>();
175177 ValueSet pkey = null ;
176178 boolean keyrpt = false ;
177179 boolean norpt = false ;
@@ -222,7 +224,7 @@ private boolean isFill(DataChunk ie) {
222224 return ie .getBytesAmount () > this .getFrameFree ();
223225 }
224226
225- public ValueSet sort () throws InternalException {
227+ public synchronized ValueSet sort () throws InternalException {
226228 if (!this .data .isSorted ()) {
227229 this .data .sort ();
228230 }
@@ -236,7 +238,7 @@ public ValueSet sort() throws InternalException {
236238
237239 //accepted only to node element lists
238240 //for unique indexes
239- public DataChunk getChildElementPtr (ValueSet value ) throws InternalException {
241+ public synchronized DataChunk getChildElementPtr (ValueSet value ) throws InternalException {
240242 //todo if (!this.sorted) {
241243 this .sort ();
242244 //}
@@ -348,7 +350,7 @@ public synchronized int removeObjects(ValueSet key, Object o) throws InternalExc
348350 return len ;
349351 }
350352
351- public ValueSet getMaxValue () throws InternalException {
353+ public synchronized ValueSet getMaxValue () throws InternalException {
352354 this .sort ();
353355 return ((DataChunk )this .data .get (this .data .size ()-1 )).getDcs ();
354356 }
@@ -364,59 +366,52 @@ public HashMap<Long, Long> getAllocateMap() {
364366 return imap ;
365367 }
366368
367- public int getType () {
369+ public synchronized int getType () {
368370 return this .getRes01 ();
369371 }
370372
371- public void setType (int type ) {
373+ public synchronized void setType (int type ) {
372374 this .setRes01 (type );
373375 }
374376
375- public int getHasMV () {
377+ public synchronized int getHasMV () {
376378 return this .getRes02 ();
377379 }
378380
379- public void setHasMV (int hasMV ) {
381+ public synchronized void setHasMV (int hasMV ) {
380382 this .setRes02 (hasMV );
381383 }
382384
383- public int getDivided () {
385+ public synchronized int getDivided () {
384386 return this .getRes03 ();
385387 }
386388
387- public void setDivided (int divided ) {
389+ public synchronized void setDivided (int divided ) {
388390 this .setRes03 (divided );
389391 }
390392
391- public int getParentF () {
393+ public synchronized int getParentF () {
392394 return this .getRes04 ();
393395 }
394396
395- public void setParentF (int parentF ) {
397+ public synchronized void setParentF (int parentF ) {
396398 this .setRes04 (parentF );
397399 }
398400
399- public long getParentB () {
401+ public synchronized long getParentB () {
400402 return this .getRes06 ();
401403 }
402404
403- public void setParentB (long parentB ) {
405+ public synchronized void setParentB (long parentB ) {
404406 this .setRes06 (parentB );
405407 }
406408
407- public int getLcF () {
408- return this .getRes05 ();
409+ public synchronized long getLcId () {
410+ return this .getRes05 () + this . getRes07 () ;
409411 }
410412
411- public void setLcF (int lcF ) {
412- this .setRes05 (lcF );
413- }
414-
415- public long getLcB () {
416- return this .getRes07 ();
417- }
418-
419- public void setLcB (long lcB ) {
420- this .setRes07 (lcB );
413+ public synchronized void setLcId (long lcId ) {
414+ this .setRes05 ((int )lcId %4096 );
415+ this .setRes07 (lcId - lcId %4096 );
421416 }
422417}
0 commit comments