Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Khoury andrewmkhoury

View GitHub Profile
View ecma6_notes.md
  • Arrows - => defines function sharing lexical this as function body (unlike subfunctions).
  • Classes - class, extends, constructor,get,set, static are syntactic sugar over prototypes patterns (i.e. proper-interoperable class definitions).
    class SkinnedMesh extends THREE.Mesh {
      constructor(geometry, materials) {
        super(geometry, materials);
    
        this.idMatrix = SkinnedMesh.defaultMatrix();
        this.bones = [];
        this.boneMatrices = [];
    
@andrewmkhoury
andrewmkhoury / README.md
Created Aug 16, 2021
Adobe Target + IMS integration "Create offer request failed!"
View README.md

Issue

15.08.2021 16:57:24.511 *ERROR* [[0:0:0:0:0:0:0:1] [1629071844241] POST /libs/cq/experience-fragments/content/commons/targetexporter.html HTTP/1.1] com.adobe.cq.xf.impl.adobetarget.exporter.AbstractExperienceFragmentExporter Create offer request failed!
API request failed
com.day.cq.analytics.testandtarget.TestandtargetException: Create offer request failed!
	at com.day.cq.analytics.testandtarget.impl.RestApiAdapter.create(RestApiAdapter.java:115)
	at com.day.cq.analytics.testandtarget.impl.RestApiAdapter.createOffer(RestApiAdapter.java:98)
	at com.day.cq.analytics.testandtarget.impl.TestandtargetServiceImpl.createHTMLOffer(TestandtargetServiceImpl.java:65)
	at com.day.cq.analytics.testandtarget.impl.TestandtargetCampaignMediatorImpl.syncOffer(TestandtargetCampaignMediatorImpl.java:537)
	at com.adobe.cq.xf.impl.adobetarget.exporter.AbstractExperienceFragmentExporter.exportVariation(AbstractExperienceFragmentExporter.java:115)
@andrewmkhoury
andrewmkhoury / 1 - Fix Versions.md
Last active Jul 28, 2021
Fix Corrupt Jackrabbit Oak Version Histories
View 1 - Fix Versions.md
View 1-Oak SegmentNotFoundException repair scenario.md

The objective here is to find all SegmentNotFoundException type corruption and remove it (as we don't have a valid backup)

Before running any of the below steps we created an index.json file (see the file below) which contains only the index definitions of the corrupted indexes.

  1. This generates the file indexing-results\index-definities.json
java -Xmx8g -jar oak-run-1.8.12.jar index --fds-path=crx-quickstart\repository\datastore crx-quickstart\repository\segmentstore --index-definitions
  1. From that file we copied only the definitions we needed and created index.json (file attached here )
@andrewmkhoury
andrewmkhoury / findLargeBinaries.groovy
Created May 5, 2020
Apache Oak Groovy Script to find large binary properties in Oak JCR
View findLargeBinaries.groovy
//Adaptation of @stillalex's script from here https://gist.github.com/stillalex/06303f8cc1d3780d3eab4c72575883ae
//This version works with Oak 1.6 and later versions
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicInteger
import org.apache.jackrabbit.oak.api.Type
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
import com.google.common.collect.Lists
import java.util.List
@andrewmkhoury
andrewmkhoury / oakTreeNodeCount.groovy
Last active Apr 29, 2021
Counting nodes in a tree of Oak repository using the oak-run console tool
View oakTreeNodeCount.groovy
import org.apache.jackrabbit.oak.spi.state.NodeState
import java.util.concurrent.atomic.AtomicInteger
def countNodes(NodeState n, String path = "/", flush = 5000, AtomicInteger count = new AtomicInteger(0), root = true) {
if(root) {
println "Counting nodes in tree ${path}"
}
cnt = count.incrementAndGet()
if (cnt % flush == 0) println(" " + cnt)
@andrewmkhoury
andrewmkhoury / readme.md
Last active Apr 29, 2021
How to clean up unreferenced checkpoints in Oak 1.0.x
View readme.md

Clean up unreferenced checkpoints

  1. Download or build oak-run 1.x matching the version you have installed in your Oak environment.
  2. Stop all AEM instances
  3. Upload the oak-run to the AEM server if using TarMK or MongoDB server (if using MongoMK)
  4. Run this command to cleanup unreferenced checkpoints on TarMK:
java -Xmx4096m -jar /apps/staging/oak-run-1.*.jar checkpoints crx-quickstart/repository/segmentstore rm-unreferenced

Clean up unreferenced checkpoints on MongoMK:

View AEM6.x Migration Instructions.md

AEM6.x Migration

  • How to Rebuild a Pre-Existing AEM+Mongo Cluster
  • or migrate from Tar to MongoDB or MongoDB to Tar"
  • or migrate from 5.6.1 or 6.x to 6.x via data migration instead of jar upgrade
  1. (Mongo to Mongo only) Remove one replica from the replica set and delete/recreate the db
    1. Remove the replica node from the set: http://docs.mongodb.org/master/tutorial/remove-replica-set-member/
    2. Validate that no other nodes in the set consider that node to be part of the set anymore. Log into each node in the cluster via mongo shell and run rs.status() to validate that the node that was taken out is not in the cluster any longer.
    3. Drop the aem database on that node http://docs.mongodb.org/manual/reference/command/dropDatabase/
    4. Re-add the database with the correct user permissions (do not add the mongo instance back to the replica set)
@andrewmkhoury
andrewmkhoury / ClonedReindexingInstructions.md
Last active Apr 29, 2021
Reindexing Oak Async Indexes on a Clone AEM Instance
View ClonedReindexingInstructions.md

How to Reindex AEM on a Clone Instance and Sync over the Changes

  1. Clone your AEM instance to another VM for reindexing
  2. Download these oak-run jars:
  1. Upload the oak-run jars to the clone server
  2. Stop AEM (stop all AEM instances if a cluster or cold standby)
  3. Run this command (using oak-run-1.6.6.jar)
  • java -Xmx4096m -jar oak-run-1.6.6.jar checkpoints /path/to/repository/segmentstore
  1. Run this command (using oak-run-1.6.6.jar)
View Oak offline compaction instructions.md

Note that offline compaction requires a long duration of downtime from 30 minutes to 7 hours (and in extreme cases more time).

Offline Oak compaction with debug logging:

  1. Stop Oak / AEM
  2. Install the latest Oak hotfix to your AEM instance: