Skip to content

IGNITE-21899 added GridInt utils#200

Open
FewJuho wants to merge 13 commits intoapache:masterfrom
FewJuho:ignite-21899
Open

IGNITE-21899 added GridInt utils#200
FewJuho wants to merge 13 commits intoapache:masterfrom
FewJuho:ignite-21899

Conversation

@FewJuho
Copy link
Copy Markdown
Contributor

@FewJuho FewJuho commented Jul 21, 2025

No description provided.

new ver 2.16

added ignite-indexing
}
catch (Throwable t) {
if (verbose) {
log.warn("New keys type {} is not on classpath, will fallback to int[] (cause: {})",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At which circumstance we should proceed if class not found?

Copy link
Copy Markdown
Contributor Author

@FewJuho FewJuho Aug 26, 2025

Choose a reason for hiding this comment

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

Is it better to fail an entire build? Looks like in that case we can load third party constructor to proceed migration.

try (Ignite ig = Ignition.start(cfg)) {
ig.cluster().state(ClusterState.ACTIVE);

Collection<String> cacheNames = new ArrayList<>(ig.cacheNames());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need scan all caches?

Copy link
Copy Markdown
Contributor Author

@FewJuho FewJuho Aug 26, 2025

Choose a reason for hiding this comment

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

Seems good to scan all caches to prevent cache data loss. There's CLI command --cache to specify caches' names to scan/apply if needed.

* ./gradlew -p migrator run --args="--apply --report 500" # apply to all caches
*/

public final class GridIntListMigrator {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see we have DbMigrations class with caches/data migrations. Can we built this code in the class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is an online migration class that is called every time the bot is started. It doesnt seem necessary to add a one-time offline migration functionality there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most of migrations are one-shot tasks, see DbMigrations#applyMigration - it skips a migration if it had been already applied. Is there other reason to keep this migration in a separate module?

* limitations under the License.
*/

package src.main.java.migrate;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wrong package.

int[] res = new int[g.size()];

for (int i = 0; i < res.length; i++)
res[i] = g.get(i);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use System.arrayCopy instead?

if (obj instanceof org.apache.ignite.internal.util.GridIntList) {
org.apache.ignite.internal.util.GridIntList g = (org.apache.ignite.internal.util.GridIntList)obj;

int[] res = new int[g.size()];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's do not create new array for every record.

}
catch (Throwable t) {
if (verbose)
log.info("Deserialize fallback: {}", t.toString());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At which case we failed here?

* or falls back to int[] if the class is not on the classpath.
*/
private Object buildNewKeys(int[] ints) {
if (newKeysCachedConstruct != null) {
Copy link
Copy Markdown
Member

@timoninmaxim timoninmaxim Sep 2, 2025

Choose a reason for hiding this comment

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

At which case it is null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TO-DO: to reflect about ability to tune migrator with third-party constructor

fixed migrator module build file

fixed build

updated DbMigrations

added GridIntList migration into DbMigration class

fixed reportEvery to Int

dedupl
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.

2 participants