Skip to content

IGNITE-12061 Fix inline size change.#6770

Closed
zstan wants to merge 4 commits intoapache:masterfrom
gridgain:ignite-12061
Closed

IGNITE-12061 Fix inline size change.#6770
zstan wants to merge 4 commits intoapache:masterfrom
gridgain:ignite-12061

Conversation

@zstan
Copy link
Contributor

@zstan zstan commented Aug 13, 2019

No description provided.

*/
public class H2Tree extends BPlusTree<H2Row, H2Row> {
/** */
public static final String IGNITE_THROTTLE_INLINE_SIZE_CALCULATION = "IGNITE_THROTTLE_INLINE_SIZE_CALCULATION";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do not we place property name constant to IgniteSystemProperties class as usual? With a bit of description in javadoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in some case we didnt ex: org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager#IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC , i just dont want to have a lot of changes instead of master code here, do u insist of this change ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the property is not going to be used by user it can be kept here. Otherwise it is better to move it.

throws IgniteCheckedException{
String sql = H2Utils.indexDropSql(schemaName, idxName, ifExists);

GridH2Table tbl = dataTableForIndex(schemaName, idxName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert tbl != null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search can go here only through a particular schema tables. An equivalent of operation schema(schemaName).tables().stream().filter(d -> d.table().containsUserIndex(idxName)).findAny().get() can be used for it.

Copy link
Contributor Author

@zstan zstan Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert ok, other honestly don`t understand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataTableForIndex iterates through all tables, schema(schemaName).tables() returns only currently needed schema tables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch it, but what`s the difference between for loop with break and stream ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned more about access to tables using schema(schemaName).tables. Used a stream syntax just for a one-liner in a comment. For vs stream does not look as a big deal for me here.

cctx0.shared().database().checkpointReadLock();

try {
((GridH2IndexBase)idx0).destroy(rmIndex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to pass rmIndex parameter here? In what cases we expect rmIndex == false here? Can we pass true unconditionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cause on node and further cache.stop we need to set false here, that by design and beyond the scope of this ticket. If we pass almost true we would have undeterminate pageStore exceptions here )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank, got it.

/** */
@Test
@WithSystemProperty(key = IGNITE_THROTTLE_INLINE_SIZE_CALCULATION, value = "1")
public void testInlineSizeChange() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it would be great to reproduce in tests problems related to possible index corruption and other artifacts possible before that patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ticket will be soon, but it still beyond the scope of this ticket.


assert tbl != null;

tbl.setRemoveIndexOnDestroy(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking about a race condition when an index is being dropped and a cache is stopping on deactivation concurrently. A following invalid scenario looks possible:

  1. On deactivation rmIndex flag is set to false.
  2. On index drop rmIndexis set to true. Index is dropped.
  3. rmIndex == true leads that all indexes are destroyed on deactivation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a method name setRemoveIndexOnDestroy (and a javadoc) becomes misleading as it is going to be used for destroying an index on drop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ivan,
Cache stop and schema operations (e.g. index drop) causes PME and should be serialized.
All schema operations are queued via GridQueryProcessor.schemaOps.
Cache stop operation fall into GridQueryProcessor.onCacheStop0 where all schemaOps have cancelled right before
setRemoveIndexOnDestroy flag is changed (inside idx.unregisterCache() call).

Possibly, GridQueryProcessor should wait for active SchemaOperationManager.worker-s before idx.unregisterCache(), but this should be investigated.

Copy link
Contributor

@pavlukhin pavlukhin Aug 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, GridQueryProcessor should wait for active SchemaOperationManager.worker-s before idx.unregisterCache(), but this should be investigated.

Will be good to check it. AFAIK, cancellation uses Thread.interrupt, which cannot cancel running setRemoveIndexOnDestroy method alone.

Also, I think that it would be great to separate an intent of removing indexes on per-operation basis rather than having a single boolean flag shared between different operations (cache stop, drop index).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, why do we need to do fake "Drop table" on deactivation, though database "Shutdown" is called later?

@asfgit asfgit closed this in dde8174 Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants